Title: [163596] trunk/Source/WebCore
Revision
163596
Author
[email protected]
Date
2014-02-06 18:04:27 -0800 (Thu, 06 Feb 2014)

Log Message

Use child iterator in HTMLDetailsElement::findMainSummary().
<https://webkit.org/b/128335>

Reviewed by Antti Koivisto.

* html/HTMLDetailsElement.h:
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::findMainSummary):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (163595 => 163596)


--- trunk/Source/WebCore/ChangeLog	2014-02-07 02:03:26 UTC (rev 163595)
+++ trunk/Source/WebCore/ChangeLog	2014-02-07 02:04:27 UTC (rev 163596)
@@ -1,3 +1,14 @@
+2014-02-06  Andreas Kling  <[email protected]>
+
+        Use child iterator in HTMLDetailsElement::findMainSummary().
+        <https://webkit.org/b/128335>
+
+        Reviewed by Antti Koivisto.
+
+        * html/HTMLDetailsElement.h:
+        * html/HTMLDetailsElement.cpp:
+        (WebCore::HTMLDetailsElement::findMainSummary):
+
 2014-02-06  Antti Koivisto  <[email protected]>
 
         Add missing &.

Modified: trunk/Source/WebCore/html/HTMLDetailsElement.cpp (163595 => 163596)


--- trunk/Source/WebCore/html/HTMLDetailsElement.cpp	2014-02-07 02:03:26 UTC (rev 163595)
+++ trunk/Source/WebCore/html/HTMLDetailsElement.cpp	2014-02-07 02:04:27 UTC (rev 163596)
@@ -22,6 +22,7 @@
 #include "HTMLDetailsElement.h"
 
 #if ENABLE(DETAILS_ELEMENT)
+#include "ElementIterator.h"
 #include "HTMLSummaryElement.h"
 #include "InsertionPoint.h"
 #include "LocalizedStrings.h"
@@ -121,12 +122,10 @@
     root->appendChild(DetailsContentElement::create(document()), ASSERT_NO_EXCEPTION);
 }
 
-Element* HTMLDetailsElement::findMainSummary() const
+const Element* HTMLDetailsElement::findMainSummary() const
 {
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
-        if (child->hasTagName(summaryTag))
-            return toElement(child);
-    }
+    if (auto summary = childrenOfType<HTMLSummaryElement>(*this).first())
+        return summary;
 
     return static_cast<DetailsSummaryElement*>(userAgentShadowRoot()->firstChild())->fallbackSummary();
 }

Modified: trunk/Source/WebCore/html/HTMLDetailsElement.h (163595 => 163596)


--- trunk/Source/WebCore/html/HTMLDetailsElement.h	2014-02-07 02:03:26 UTC (rev 163595)
+++ trunk/Source/WebCore/html/HTMLDetailsElement.h	2014-02-07 02:04:27 UTC (rev 163596)
@@ -30,7 +30,7 @@
     static PassRefPtr<HTMLDetailsElement> create(const QualifiedName& tagName, Document& document);
     void toggleOpen();
 
-    Element* findMainSummary() const;
+    const Element* findMainSummary() const;
 
 private:
     HTMLDetailsElement(const QualifiedName&, Document&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to