mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Implement XPath functionality using libxml2
This commit is contained in:
parent
f04b866cb0
commit
0ea519c539
Notes:
github-actions[bot]
2025-10-03 11:17:39 +00:00
Author: https://github.com/johannesg
Commit: 0ea519c539
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6342
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/gmta ✅
8 changed files with 277 additions and 6 deletions
|
|
@ -36,6 +36,34 @@ void XPathResult::visit_edges(Cell::Visitor& visitor)
|
|||
|
||||
XPathResult::~XPathResult() = default;
|
||||
|
||||
void XPathResult::set_number(WebIDL::Double number_value)
|
||||
{
|
||||
m_result_type = NUMBER_TYPE;
|
||||
m_number_value = number_value;
|
||||
}
|
||||
void XPathResult::set_string(String string_value)
|
||||
{
|
||||
m_result_type = STRING_TYPE;
|
||||
m_string_value = move(string_value);
|
||||
}
|
||||
|
||||
void XPathResult::set_boolean(bool boolean_value)
|
||||
{
|
||||
m_result_type = BOOLEAN_TYPE;
|
||||
m_boolean_value = boolean_value;
|
||||
}
|
||||
|
||||
void XPathResult::set_node_set(Vector<GC::Ptr<DOM::Node>> node_set, unsigned short type)
|
||||
{
|
||||
if (type >= XPathResult::UNORDERED_NODE_ITERATOR_TYPE && type <= XPathResult::FIRST_ORDERED_NODE_TYPE)
|
||||
m_result_type = type;
|
||||
else
|
||||
m_result_type = UNORDERED_NODE_ITERATOR_TYPE; // Default if the caller does not explicity ask for anything else
|
||||
|
||||
m_node_set = move(node_set);
|
||||
m_node_set_iter = m_node_set.begin();
|
||||
}
|
||||
|
||||
GC::Ptr<DOM::Node> XPathResult::iterate_next()
|
||||
{
|
||||
if (m_node_set_iter == m_node_set.end())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue