Title: [130847] trunk/Source/WebKit/chromium
Revision
130847
Author
tk...@chromium.org
Date
2012-10-09 22:07:13 -0700 (Tue, 09 Oct 2012)

Log Message

[Chromium] Add WebElement::hasHTMLTagName, and deprecate hasTagName
https://bugs.webkit.org/show_bug.cgi?id=98714

Reviewed by Abhishek Arya.

* public/WebElement.h:
(WebElement):
- Add a comment to tagName().
- Add a comment to hasTagName().
- Declare hasHTMLTagName(), which is useful to check HTML tags.
* src/WebElement.cpp:
(WebKit::WebElement::hasHTMLTagName): Added.

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (130846 => 130847)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-10-10 04:56:22 UTC (rev 130846)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-10-10 05:07:13 UTC (rev 130847)
@@ -1,3 +1,18 @@
+2012-10-08  Kent Tamura  <tk...@chromium.org>
+
+        [Chromium] Add WebElement::hasHTMLTagName, and deprecate hasTagName
+        https://bugs.webkit.org/show_bug.cgi?id=98714
+
+        Reviewed by Abhishek Arya.
+
+        * public/WebElement.h:
+        (WebElement):
+        - Add a comment to tagName().
+        - Add a comment to hasTagName().
+        - Declare hasHTMLTagName(), which is useful to check HTML tags.
+        * src/WebElement.cpp:
+        (WebKit::WebElement::hasHTMLTagName): Added.
+
 2012-10-09  Jian Li  <jia...@chromium.org>
 
         Update the CSS property used to support draggable regions.

Modified: trunk/Source/WebKit/chromium/public/WebElement.h (130846 => 130847)


--- trunk/Source/WebKit/chromium/public/WebElement.h	2012-10-10 04:56:22 UTC (rev 130846)
+++ trunk/Source/WebKit/chromium/public/WebElement.h	2012-10-10 05:07:13 UTC (rev 130847)
@@ -51,8 +51,15 @@
 
         WEBKIT_EXPORT bool isFormControlElement() const;
         WEBKIT_EXPORT bool isTextFormControlElement() const;
+        // Returns the qualified name, which may contain a prefix and a colon.
         WEBKIT_EXPORT WebString tagName() const;
+        // Check if this element has the specified qualified name. This function
+        // doesn't makes much sense because we have no ways to check namespace
+        // URI. Do not use this.
         WEBKIT_EXPORT bool hasTagName(const WebString&) const;
+        // Check if this element has the specified local tag name, and the HTML
+        // namespace. Tag name matching is case-insensitive.
+        WEBKIT_EXPORT bool hasHTMLTagName(const WebString&) const;
         WEBKIT_EXPORT bool hasAttribute(const WebString&) const;
         WEBKIT_EXPORT WebString getAttribute(const WebString&) const;
         WEBKIT_EXPORT bool setAttribute(const WebString& name, const WebString& value);

Modified: trunk/Source/WebKit/chromium/src/WebElement.cpp (130846 => 130847)


--- trunk/Source/WebKit/chromium/src/WebElement.cpp	2012-10-10 04:56:22 UTC (rev 130846)
+++ trunk/Source/WebKit/chromium/src/WebElement.cpp	2012-10-10 05:07:13 UTC (rev 130847)
@@ -64,6 +64,12 @@
                              tagName.operator String());
 }
 
+bool WebElement::hasHTMLTagName(const WebString& tagName) const
+{
+    const Element* element = constUnwrap<Element>();
+    return HTMLNames::xhtmlNamespaceURI == element->namespaceURI() && equalIgnoringCase(element->tagName(), String(tagName));
+}
+
 bool WebElement::hasAttribute(const WebString& attrName) const
 {
     return constUnwrap<Element>()->hasAttribute(attrName);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to