diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/dom_operations.cc | 25 | ||||
-rw-r--r-- | webkit/glue/dom_operations.h | 6 |
2 files changed, 31 insertions, 0 deletions
diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc index d0b371d..017c3c6 100644 --- a/webkit/glue/dom_operations.cc +++ b/webkit/glue/dom_operations.cc @@ -590,4 +590,29 @@ int NumberOfActiveAnimations(WebView* view) { return controller->numberOfActiveAnimations(); } +void GetMetaElementsWithName(WebDocument* document, + const string16& name, + std::vector<WebElement>* meta_elements) { + DCHECK(document); + DCHECK(meta_elements); + meta_elements->clear(); + WebElement head = document->head(); + if (head.isNull() || !head.hasChildNodes()) + return; + + WebNodeList children = head.childNodes(); + for (size_t i = 0; i < children.length(); ++i) { + WebNode node = children.item(i); + if (!node.isElementNode()) + continue; + WebElement element = node.to<WebElement>(); + if (!element.hasTagName("meta")) + continue; + WebString meta_name = element.getAttribute("name"); + if (meta_name.isNull() || meta_name != name) + continue; + meta_elements->push_back(element); + } +} + } // webkit_glue diff --git a/webkit/glue/dom_operations.h b/webkit/glue/dom_operations.h index 4741bce..b8915be 100644 --- a/webkit/glue/dom_operations.h +++ b/webkit/glue/dom_operations.h @@ -129,6 +129,12 @@ int NumberOfActiveAnimations(WebKit::WebView* view); WebKit::WebString GetSubResourceLinkFromElement( const WebKit::WebElement& element); +// Puts the meta-elements of |document| that have the specified |name| in +// |meta_elements|. +void GetMetaElementsWithName(WebKit::WebDocument* document, + const string16& name, + std::vector<WebKit::WebElement>* meta_elements); + } // namespace webkit_glue #endif // WEBKIT_GLUE_DOM_OPERATIONS_H__ |