Title: [189354] trunk
- Revision
- 189354
- Author
- [email protected]
- Date
- 2015-09-04 10:40:10 -0700 (Fri, 04 Sep 2015)
Log Message
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: trunk/LayoutTests/ChangeLog (189353 => 189354)
--- trunk/LayoutTests/ChangeLog 2015-09-04 17:21:53 UTC (rev 189353)
+++ trunk/LayoutTests/ChangeLog 2015-09-04 17:40:10 UTC (rev 189354)
@@ -1,3 +1,15 @@
+2015-09-04 Chris Dumez <[email protected]>
+
+ 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-04 Ryosuke Niwa <[email protected]>
Import css/css-color-3
Modified: trunk/LayoutTests/http/tests/w3c/html/dom/documents/dom-tree-accessors/document.body-getter-expected.txt (189353 => 189354)
--- trunk/LayoutTests/http/tests/w3c/html/dom/documents/dom-tree-accessors/document.body-getter-expected.txt 2015-09-04 17:21:53 UTC (rev 189353)
+++ trunk/LayoutTests/http/tests/w3c/html/dom/documents/dom-tree-accessors/document.body-getter-expected.txt 2015-09-04 17:40:10 UTC (rev 189354)
@@ -1,9 +1,9 @@
PASS Childless document
PASS Childless html element
-FAIL Body followed by frameset inside the html element assert_equals: expected Element node <body></body> but got Element node <frameset></frameset>
+PASS Body followed by frameset inside the html element
PASS Frameset followed by body inside the html element
-FAIL Body followed by frameset inside a non-HTML html element assert_equals: expected null but got Element node <frameset></frameset>
+FAIL Body followed by frameset inside a non-HTML html element assert_equals: expected null but got Element node <body></body>
FAIL Frameset followed by body inside a non-HTML html element assert_equals: expected null but got Element node <frameset></frameset>
PASS Non-HTML body followed by body inside the html element
PASS Non-HTML frameset followed by body inside the html element
Modified: trunk/Source/WebCore/ChangeLog (189353 => 189354)
--- trunk/Source/WebCore/ChangeLog 2015-09-04 17:21:53 UTC (rev 189353)
+++ trunk/Source/WebCore/ChangeLog 2015-09-04 17:40:10 UTC (rev 189354)
@@ -1,3 +1,23 @@
+2015-09-04 Chris Dumez <[email protected]>
+
+ 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-04 Csaba Osztrogonác <[email protected]>
Fix the !ENABLE(VIDEO) build after r189023
Modified: trunk/Source/WebCore/dom/Document.cpp (189353 => 189354)
--- trunk/Source/WebCore/dom/Document.cpp 2015-09-04 17:21:53 UTC (rev 189353)
+++ trunk/Source/WebCore/dom/Document.cpp 2015-09-04 17:40:10 UTC (rev 189354)
@@ -2477,13 +2477,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes