Title: [114686] trunk/Source/WebKit/chromium
- Revision
- 114686
- Author
- [email protected]
- Date
- 2012-04-19 15:59:58 -0700 (Thu, 19 Apr 2012)
Log Message
[chromium] Add simplified API for iterating over a WebElement's attributes.
<http://webkit.org/b/84183>
Reviewed by Dimitri Glazkov.
Add attributeCount(), attributeLocalName(index) and attributeValue(index) to the
WebElement API so that call sites currently using WebNamedNodeMap can be
converted, which will ultimately allow us to refactor WebCore::Attribute
on <http://webkit.org/b/83440>.
* public/WebElement.h:
* src/WebElement.cpp:
(WebKit::WebElement::attributeCount):
(WebKit::WebElement::attributeLocalName):
(WebKit::WebElement::attributeValue):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (114685 => 114686)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-04-19 22:49:04 UTC (rev 114685)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-04-19 22:59:58 UTC (rev 114686)
@@ -1,3 +1,21 @@
+2012-04-19 Andreas Kling <[email protected]>
+
+ [chromium] Add simplified API for iterating over a WebElement's attributes.
+ <http://webkit.org/b/84183>
+
+ Reviewed by Dimitri Glazkov.
+
+ Add attributeCount(), attributeLocalName(index) and attributeValue(index) to the
+ WebElement API so that call sites currently using WebNamedNodeMap can be
+ converted, which will ultimately allow us to refactor WebCore::Attribute
+ on <http://webkit.org/b/83440>.
+
+ * public/WebElement.h:
+ * src/WebElement.cpp:
+ (WebKit::WebElement::attributeCount):
+ (WebKit::WebElement::attributeLocalName):
+ (WebKit::WebElement::attributeValue):
+
2012-04-19 Mark Pilgrim <[email protected]>
[Chromium] Call signedPublicKeyAndChallengeString directly
Modified: trunk/Source/WebKit/chromium/public/WebElement.h (114685 => 114686)
--- trunk/Source/WebKit/chromium/public/WebElement.h 2012-04-19 22:49:04 UTC (rev 114685)
+++ trunk/Source/WebKit/chromium/public/WebElement.h 2012-04-19 22:59:58 UTC (rev 114686)
@@ -61,6 +61,9 @@
WEBKIT_EXPORT WebString innerText();
WEBKIT_EXPORT WebDocument document() const;
WEBKIT_EXPORT void requestFullScreen();
+ WEBKIT_EXPORT WebString attributeLocalName(unsigned index) const;
+ WEBKIT_EXPORT WebString attributeValue(unsigned index) const;
+ WEBKIT_EXPORT unsigned attributeCount() const;
// Returns the language code specified for this element. This attribute
// is inherited, so the returned value is drawn from the closest parent
Modified: trunk/Source/WebKit/chromium/src/WebElement.cpp (114685 => 114686)
--- trunk/Source/WebKit/chromium/src/WebElement.cpp 2012-04-19 22:49:04 UTC (rev 114685)
+++ trunk/Source/WebKit/chromium/src/WebElement.cpp 2012-04-19 22:59:58 UTC (rev 114686)
@@ -83,6 +83,27 @@
return !exceptionCode;
}
+unsigned WebElement::attributeCount() const
+{
+ if (!constUnwrap<Element>()->hasAttributes())
+ return 0;
+ return constUnwrap<Element>()->attributeCount();
+}
+
+WebString WebElement::attributeLocalName(unsigned index) const
+{
+ if (index >= attributeCount())
+ return WebString();
+ return constUnwrap<Element>()->attributeItem(index)->localName();
+}
+
+WebString WebElement::attributeValue(unsigned index) const
+{
+ if (index >= attributeCount())
+ return WebString();
+ return constUnwrap<Element>()->attributeItem(index)->value();
+}
+
WebNamedNodeMap WebElement::attributes() const
{
return WebNamedNodeMap(m_private->attributes());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes