Title: [189740] releases/WebKitGTK/webkit-2.10
Revision
189740
Author
carlo...@webkit.org
Date
2015-09-14 10:31:24 -0700 (Mon, 14 Sep 2015)

Log Message

Merge r189354 - Document.body should return the first body / frameset child of the html element
https://bugs.webkit.org/show_bug.cgi?id=148787
<rdar://problem/22566850>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Document.body should return the *first* body / frameset child of the html
element as per the specification:
https://html.spec.whatwg.org/multipage/dom.html#the-body-element-2

Chrome and Firefox both behave correctly. However, WebKit was prioritizing
frameset over body. This patch fixes this.

No new tests, already covered by existing test.

* dom/Document.cpp:
(WebCore::Document::bodyOrFrameset):

LayoutTests:

Rebaseline test now that a new check is passing.

* http/tests/w3c/html/dom/documents/dom-tree-accessors/document.body-getter-expected.txt:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (189739 => 189740)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-09-14 17:27:17 UTC (rev 189739)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-09-14 17:31:24 UTC (rev 189740)
@@ -1,3 +1,15 @@
+2015-09-04  Chris Dumez  <cdu...@apple.com>
+
+        Document.body should return the first body / frameset child of the html element
+        https://bugs.webkit.org/show_bug.cgi?id=148787
+        <rdar://problem/22566850>
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline test now that a new check is passing.
+
+        * http/tests/w3c/html/dom/documents/dom-tree-accessors/document.body-getter-expected.txt:
+
 2015-09-03  Chris Dumez  <cdu...@apple.com>
 
         document.createEvent("eventname") should do a case-insensitive match on the event name

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (189739 => 189740)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-09-14 17:27:17 UTC (rev 189739)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-09-14 17:31:24 UTC (rev 189740)
@@ -1,3 +1,23 @@
+2015-09-04  Chris Dumez  <cdu...@apple.com>
+
+        Document.body should return the first body / frameset child of the html element
+        https://bugs.webkit.org/show_bug.cgi?id=148787
+        <rdar://problem/22566850>
+
+        Reviewed by Ryosuke Niwa.
+
+        Document.body should return the *first* body / frameset child of the html
+        element as per the specification:
+        https://html.spec.whatwg.org/multipage/dom.html#the-body-element-2
+
+        Chrome and Firefox both behave correctly. However, WebKit was prioritizing
+        frameset over body. This patch fixes this.
+
+        No new tests, already covered by existing test.
+
+        * dom/Document.cpp:
+        (WebCore::Document::bodyOrFrameset):
+
 2015-09-03  Jinyoung Hur  <hur....@navercorp.com>
 
         [Texmap] highp precision should be used conditionally for fragment shaders on OpenGL ES

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Document.cpp (189739 => 189740)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Document.cpp	2015-09-14 17:27:17 UTC (rev 189739)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/dom/Document.cpp	2015-09-14 17:31:24 UTC (rev 189740)
@@ -2483,13 +2483,15 @@
 
 HTMLElement* Document::bodyOrFrameset() const
 {
-    // If the document element contains both a frameset and a body, the frameset wins.
+    // Return the first body or frameset child of the html element.
     auto* element = documentElement();
     if (!element)
         return nullptr;
-    if (auto* frameset = childrenOfType<HTMLFrameSetElement>(*element).first())
-        return frameset;
-    return childrenOfType<HTMLBodyElement>(*element).first();
+    for (auto& child : childrenOfType<HTMLElement>(*element)) {
+        if (is<HTMLBodyElement>(child) || is<HTMLFrameSetElement>(child))
+            return &child;
+    }
+    return nullptr;
 }
 
 void Document::setBodyOrFrameset(PassRefPtr<HTMLElement> prpNewBody, ExceptionCode& ec)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to