Title: [179157] trunk/Source
Revision
179157
Author
[email protected]
Date
2015-01-26 16:26:21 -0800 (Mon, 26 Jan 2015)

Log Message

Rename Document::body() to Document::bodyOrFrameset() for clarity
https://bugs.webkit.org/show_bug.cgi?id=140902

Reviewed by Andreas Kling.

Rename Document::body() to Document::bodyOrFrameset() for clarity. This
method does not necessarily return an HTMLBodyElement, it can also
return a frameset as per the specification:
http://www.w3.org/TR/html5/dom.html#dom-tree-accessors

This method is often misused internally (the caller is only interested
in the <body> element). I will fix these instances in a follow-up patch,
this patch is only renaming mechanically.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (179156 => 179157)


--- trunk/Source/WebCore/ChangeLog	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/ChangeLog	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1,3 +1,19 @@
+2015-01-26  Chris Dumez  <[email protected]>
+
+        Rename Document::body() to Document::bodyOrFrameset() for clarity
+        https://bugs.webkit.org/show_bug.cgi?id=140902
+
+        Reviewed by Andreas Kling.
+
+        Rename Document::body() to Document::bodyOrFrameset() for clarity. This
+        method does not necessarily return an HTMLBodyElement, it can also
+        return a frameset as per the specification:
+        http://www.w3.org/TR/html5/dom.html#dom-tree-accessors
+
+        This method is often misused internally (the caller is only interested
+        in the <body> element). I will fix these instances in a follow-up patch,
+        this patch is only renaming mechanically.
+
 2015-01-26  Byungseon Shin  <[email protected]>
 
         Fix Border-radius clipping issue on a composited descendants

Modified: trunk/Source/WebCore/WebCore.exp.in (179156 => 179157)


--- trunk/Source/WebCore/WebCore.exp.in	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/WebCore.exp.in	2015-01-27 00:26:21 UTC (rev 179157)
@@ -2101,8 +2101,8 @@
 __ZNK7WebCore7IntRectcv6CGRectEv
 __ZNK7WebCore8Document11completeURLERKN3WTF6StringE
 __ZNK7WebCore8Document13axObjectCacheEv
+__ZNK7WebCore8Document14bodyOrFramesetEv
 __ZNK7WebCore8Document31displayStringModifiedByEncodingERKN3WTF6StringE
-__ZNK7WebCore8Document4bodyEv
 __ZNK7WebCore8Document4pageEv
 __ZNK7WebCore8Document4viewEv
 __ZNK7WebCore8Document6domainEv

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (179156 => 179157)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1468,7 +1468,7 @@
     if (!documentTitle.isEmpty())
         return documentTitle;
     
-    if (auto* body = document->body())
+    if (auto* body = document->bodyOrFrameset())
         return body->getNameAttribute();
     
     return String();

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (179156 => 179157)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -527,7 +527,7 @@
     ASSERT(m_renderer);
     
     if (isWebArea()) {
-        if (HTMLElement* body = m_renderer->document().body()) {
+        if (HTMLElement* body = m_renderer->document().bodyOrFrameset()) {
             if (body->hasEditableStyle())
                 return false;
         }

Modified: trunk/Source/WebCore/dom/Document.cpp (179156 => 179157)


--- trunk/Source/WebCore/dom/Document.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/dom/Document.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1859,7 +1859,7 @@
         // moment.  If it were more refined, we might be able to do something better.)
         // It's worth noting though that this entire method is a hack, since what we really want to do is
         // suspend JS instead of doing a layout with inaccurate information.
-        HTMLElement* bodyElement = body();
+        HTMLElement* bodyElement = bodyOrFrameset();
         if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
             m_pendingSheetLayout = DidLayoutWithPendingSheets;
             styleResolverChanged(RecalcStyleImmediately);
@@ -2324,7 +2324,7 @@
     setReadyState(Loading);
 }
 
-HTMLElement* Document::body() const
+HTMLElement* Document::bodyOrFrameset() const
 {
     // If the document element contains both a frameset and a body, the frameset wins.
     auto element = documentElement();
@@ -2335,7 +2335,7 @@
     return childrenOfType<HTMLBodyElement>(*element).first();
 }
 
-void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionCode& ec)
+void Document::setBodyOrFrameset(PassRefPtr<HTMLElement> prpNewBody, ExceptionCode& ec)
 {
     RefPtr<HTMLElement> newBody = prpNewBody;
 
@@ -2353,7 +2353,7 @@
         newBody = downcast<HTMLElement>(node.get());
     }
 
-    HTMLElement* b = body();
+    HTMLElement* b = bodyOrFrameset();
     if (!b)
         documentElement()->appendChild(newBody.release(), ec);
     else
@@ -2541,7 +2541,7 @@
     //    (a) Only schedule a layout once the stylesheets are loaded.
     //    (b) Only schedule layout once we have a body element.
 
-    return (haveStylesheetsLoaded() && body())
+    return (haveStylesheetsLoaded() && bodyOrFrameset())
         || (documentElement() && !documentElement()->hasTagName(htmlTag));
 }
     
@@ -5962,7 +5962,7 @@
     if (!element && is<PluginDocument>(*document))
         element = downcast<PluginDocument>(*document).pluginElement();
     if (!element && is<HTMLDocument>(*document))
-        element = document->body();
+        element = document->bodyOrFrameset();
     if (!element)
         element = document->documentElement();
     return element;
@@ -6294,7 +6294,7 @@
 {
     if (Element* element = treeScope().focusedElement())
         return element;
-    return body();
+    return bodyOrFrameset();
 }
 
 bool Document::hasFocus() const

Modified: trunk/Source/WebCore/dom/Document.h (179156 => 179157)


--- trunk/Source/WebCore/dom/Document.h	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/dom/Document.h	2015-01-27 00:26:21 UTC (rev 179157)
@@ -937,8 +937,8 @@
     static bool hasValidNamespaceForElements(const QualifiedName&);
     static bool hasValidNamespaceForAttributes(const QualifiedName&);
 
-    WEBCORE_EXPORT HTMLElement* body() const;
-    void setBody(PassRefPtr<HTMLElement>, ExceptionCode&);
+    WEBCORE_EXPORT HTMLElement* bodyOrFrameset() const;
+    void setBodyOrFrameset(PassRefPtr<HTMLElement>, ExceptionCode&);
 
     WEBCORE_EXPORT HTMLHeadElement* head();
 

Modified: trunk/Source/WebCore/dom/Document.idl (179156 => 179157)


--- trunk/Source/WebCore/dom/Document.idl	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/dom/Document.idl	2015-01-27 00:26:21 UTC (rev 179157)
@@ -149,7 +149,7 @@
 
     [TreatNullAs=NullString, GetterRaisesException, SetterRaisesException] attribute DOMString cookie;
 
-    [SetterRaisesException] attribute HTMLElement body;
+    [SetterRaisesException, ImplementedAs=bodyOrFrameset] attribute HTMLElement body;
 
     readonly attribute HTMLHeadElement head;
     readonly attribute HTMLCollection images;

Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp (179156 => 179157)


--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -223,7 +223,7 @@
     // since styles outside of the body and head continue to be shunted into the head
     // (and thus can shift to end up before dynamically added DOM content that is also
     // outside the body).
-    if ((createdByParser && m_document.body()) || m_styleSheetCandidateNodes.isEmpty()) {
+    if ((createdByParser && m_document.bodyOrFrameset()) || m_styleSheetCandidateNodes.isEmpty()) {
         m_styleSheetCandidateNodes.add(&node);
         return;
     }
@@ -381,7 +381,7 @@
     styleResolverUpdateType = hasInsertions ? Reset : Additive;
 
     // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
-    if (!m_document.body() || m_document.hasNodesWithPlaceholderStyle())
+    if (!m_document.bodyOrFrameset() || m_document.hasNodesWithPlaceholderStyle())
         return;
     StyleInvalidationAnalysis invalidationAnalysis(addedSheets, styleResolver.mediaQueryEvaluator());
     if (invalidationAnalysis.dirtiesAllStyle())

Modified: trunk/Source/WebCore/dom/Element.cpp (179156 => 179157)


--- trunk/Source/WebCore/dom/Element.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/dom/Element.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -771,7 +771,7 @@
     // When in strict mode, clientWidth for the document element should return the width of the containing frame.
     // When in quirks mode, clientWidth for the body element should return the width of the containing frame.
     bool inQuirksMode = document().inQuirksMode();
-    if ((!inQuirksMode && document().documentElement() == this) || (inQuirksMode && isHTMLElement() && document().body() == this))
+    if ((!inQuirksMode && document().documentElement() == this) || (inQuirksMode && isHTMLElement() && document().bodyOrFrameset() == this))
         return adjustForAbsoluteZoom(renderView.frameView().layoutWidth(), renderView);
     
     if (RenderBox* renderer = renderBox()) {
@@ -792,7 +792,7 @@
     // When in strict mode, clientHeight for the document element should return the height of the containing frame.
     // When in quirks mode, clientHeight for the body element should return the height of the containing frame.
     bool inQuirksMode = document().inQuirksMode();
-    if ((!inQuirksMode && document().documentElement() == this) || (inQuirksMode && isHTMLElement() && document().body() == this))
+    if ((!inQuirksMode && document().documentElement() == this) || (inQuirksMode && isHTMLElement() && document().bodyOrFrameset() == this))
         return adjustForAbsoluteZoom(renderView.frameView().layoutHeight(), renderView);
 
     if (RenderBox* renderer = renderBox()) {

Modified: trunk/Source/WebCore/editing/Editor.cpp (179156 => 179157)


--- trunk/Source/WebCore/editing/Editor.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/editing/Editor.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -267,7 +267,7 @@
     if (!document.isImageDocument())
         return nullptr;
     
-    HTMLElement* body = document.body();
+    HTMLElement* body = document.bodyOrFrameset();
     if (!body)
         return nullptr;
     
@@ -871,9 +871,9 @@
 {
     Node* target = selection.start().element();
     if (!target)
-        target = document().body();
+        target = document().bodyOrFrameset();
     if (!target)
-        return 0;
+        return nullptr;
 
     return target;
 }

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (179156 => 179157)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1696,7 +1696,7 @@
             selectStartTarget = root->shadowHost();
         else {
             root = document->documentElement();
-            selectStartTarget = document->body();
+            selectStartTarget = document->bodyOrFrameset();
         }
     }
     if (!root)

Modified: trunk/Source/WebCore/editing/VisiblePosition.cpp (179156 => 179157)


--- trunk/Source/WebCore/editing/VisiblePosition.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/editing/VisiblePosition.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -536,7 +536,7 @@
 
     // The new position must be in the same editable element. Enforce that first.
     // Unless the descent is from a non-editable html element to an editable body.
-    if (node && node->hasTagName(htmlTag) && !node->hasEditableStyle() && node->document().body() && node->document().body()->hasEditableStyle())
+    if (node && node->hasTagName(htmlTag) && !node->hasEditableStyle() && node->document().bodyOrFrameset() && node->document().bodyOrFrameset()->hasEditableStyle())
         return next.isNotNull() ? next : prev;
 
     Node* editingRoot = editableRootForPosition(position);

Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (179156 => 179157)


--- trunk/Source/WebCore/editing/ios/EditorIOS.mm	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm	2015-01-27 00:26:21 UTC (rev 179157)
@@ -280,7 +280,7 @@
 {
     // This function removes styles that the user cannot modify by applying their default values.
     
-    RefPtr<EditingStyle> editingStyle = EditingStyle::create(m_frame.document()->body());
+    RefPtr<EditingStyle> editingStyle = EditingStyle::create(m_frame.document()->bodyOrFrameset());
     RefPtr<MutableStyleProperties> defaultStyle = editingStyle.get()->style()->mutableCopy();
     
     // Text widgets implement background color via the UIView property. Their body element will not have one.

Modified: trunk/Source/WebCore/html/FTPDirectoryDocument.cpp (179156 => 179157)


--- trunk/Source/WebCore/html/FTPDirectoryDocument.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/html/FTPDirectoryDocument.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -310,7 +310,7 @@
     // If we didn't find the table element, lets try to append our own to the body
     // If that fails for some reason, cram it on the end of the document as a last
     // ditch effort
-    if (Element* body = document()->body())
+    if (auto* body = document()->bodyOrFrameset())
         body->appendChild(m_tableElement, IGNORE_EXCEPTION);
     else
         document()->appendChild(m_tableElement, IGNORE_EXCEPTION);

Modified: trunk/Source/WebCore/html/HTMLDocument.cpp (179156 => 179157)


--- trunk/Source/WebCore/html/HTMLDocument.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/html/HTMLDocument.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -107,16 +107,15 @@
 
 String HTMLDocument::dir()
 {
-    if (auto* body = this->body())
+    if (auto* body = bodyOrFrameset())
         return body->fastGetAttribute(dirAttr);
     return String();
 }
 
 void HTMLDocument::setDir(const String& value)
 {
-    HTMLElement* b = body();
-    if (b)
-        b->setAttribute(dirAttr, value);
+    if (auto* body = bodyOrFrameset())
+        body->setAttribute(dirAttr, value);
 }
 
 String HTMLDocument::designMode() const
@@ -138,7 +137,7 @@
 
 const AtomicString& HTMLDocument::bgColor() const
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return emptyAtom;
     return bodyElement->fastGetAttribute(bgcolorAttr);
@@ -146,7 +145,7 @@
 
 void HTMLDocument::setBgColor(const String& value)
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return;
     bodyElement->setAttribute(bgcolorAttr, value);
@@ -154,7 +153,7 @@
 
 const AtomicString& HTMLDocument::fgColor() const
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return emptyAtom;
     return bodyElement->fastGetAttribute(textAttr);
@@ -162,7 +161,7 @@
 
 void HTMLDocument::setFgColor(const String& value)
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return;
     bodyElement->setAttribute(textAttr, value);
@@ -170,7 +169,7 @@
 
 const AtomicString& HTMLDocument::alinkColor() const
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return emptyAtom;
     return bodyElement->fastGetAttribute(alinkAttr);
@@ -178,7 +177,7 @@
 
 void HTMLDocument::setAlinkColor(const String& value)
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return;
     bodyElement->setAttribute(alinkAttr, value);
@@ -186,7 +185,7 @@
 
 const AtomicString& HTMLDocument::linkColor() const
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return emptyAtom;
     return bodyElement->fastGetAttribute(linkAttr);
@@ -194,7 +193,7 @@
 
 void HTMLDocument::setLinkColor(const String& value)
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return;
     return bodyElement->setAttribute(linkAttr, value);
@@ -202,7 +201,7 @@
 
 const AtomicString& HTMLDocument::vlinkColor() const
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return emptyAtom;
     return bodyElement->fastGetAttribute(vlinkAttr);
@@ -210,7 +209,7 @@
 
 void HTMLDocument::setVlinkColor(const String& value)
 {
-    HTMLElement* bodyElement = body();
+    HTMLElement* bodyElement = bodyOrFrameset();
     if (!is<HTMLBodyElement>(bodyElement))
         return;
     return bodyElement->setAttribute(vlinkAttr, value);
@@ -339,7 +338,7 @@
 
 bool HTMLDocument::isFrameSet() const
 {
-    return is<HTMLFrameSetElement>(body());
+    return is<HTMLFrameSetElement>(bodyOrFrameset());
 }
 
 Ref<Document> HTMLDocument::cloneDocumentWithoutChildren() const

Modified: trunk/Source/WebCore/html/MediaDocument.cpp (179156 => 179157)


--- trunk/Source/WebCore/html/MediaDocument.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/html/MediaDocument.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -233,7 +233,7 @@
 
 void MediaDocument::replaceMediaElementTimerFired()
 {
-    HTMLElement* htmlBody = body();
+    auto* htmlBody = bodyOrFrameset();
     if (!htmlBody)
         return;
 

Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (179156 => 179157)


--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -960,8 +960,8 @@
         // HEAD is absent in ImageDocuments, for example.
         if (document->head())
             targetNode = document->head();
-        else if (document->body())
-            targetNode = document->body();
+        else if (document->bodyOrFrameset())
+            targetNode = document->bodyOrFrameset();
         else
             return nullptr;
 

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (179156 => 179157)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -2829,7 +2829,7 @@
         return true;
 
     RefPtr<Document> document = m_frame.document();
-    if (!document->body())
+    if (!document->bodyOrFrameset())
         return true;
     
     RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create();

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (179156 => 179157)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -897,7 +897,7 @@
     // FIXME: We should consider adding a setting to toggle aggressive preloading behavior as opposed
     // to making this behavior specific to iOS.
 #if !PLATFORM(IOS)
-    bool hasRendering = m_document->body() && m_document->renderView();
+    bool hasRendering = m_document->bodyOrFrameset() && m_document->renderView();
     bool canBlockParser = type == CachedResource::Script || type == CachedResource::CSSStyleSheet;
     if (!hasRendering && !canBlockParser) {
         // Don't preload subresources that can't block the parser before we have something to draw.
@@ -912,7 +912,7 @@
 
 void CachedResourceLoader::checkForPendingPreloads() 
 {
-    if (m_pendingPreloads.isEmpty() || !m_document->body() || !m_document->body()->renderer())
+    if (m_pendingPreloads.isEmpty() || !m_document->bodyOrFrameset() || !m_document->bodyOrFrameset()->renderer())
         return;
 #if PLATFORM(IOS)
     // We always preload resources on iOS. See <https://bugs.webkit.org/show_bug.cgi?id=91276>.

Modified: trunk/Source/WebCore/page/FrameView.cpp (179156 => 179157)


--- trunk/Source/WebCore/page/FrameView.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/page/FrameView.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -539,7 +539,7 @@
     Document* doc = frame().document();
 
     // Try the <body> element first as a scrollbar source.
-    Element* body = doc ? doc->body() : 0;
+    Element* body = doc ? doc->bodyOrFrameset() : 0;
     if (body && body->renderer() && body->renderer()->style().hasPseudoStyle(SCROLLBAR))
         return RenderScrollbar::createCustomScrollbar(this, orientation, body);
     
@@ -670,7 +670,7 @@
     auto documentElement = document->documentElement();
     RenderElement* documentRenderer = documentElement ? documentElement->renderer() : nullptr;
     RenderElement* documentOrBodyRenderer = documentRenderer;
-    auto body = document->body();
+    auto body = document->bodyOrFrameset();
     if (body && body->renderer()) {
         if (body->hasTagName(bodyTag))
             documentOrBodyRenderer = documentRenderer->style().overflowX() == OVISIBLE && documentElement->hasTagName(htmlTag) ? body->renderer() : documentRenderer;
@@ -715,7 +715,7 @@
         Document* document = frame().document();
         auto documentElement = document->documentElement();
         RenderElement* rootRenderer = documentElement ? documentElement->renderer() : nullptr;
-        auto body = document->body();
+        auto body = document->bodyOrFrameset();
         if (body && body->renderer()) {
             if (body->hasTagName(framesetTag) && !frameFlatteningEnabled()) {
                 vMode = ScrollbarAlwaysOff;
@@ -884,7 +884,7 @@
         return;
 
     // FIXME: Should we allow specifying snap points through <html> tags too?
-    HTMLElement* body = frame().document()->body();
+    HTMLElement* body = frame().document()->bodyOrFrameset();
     if (!renderView() || !body || !body->renderer())
         return;
     
@@ -1229,7 +1229,7 @@
         TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
 
         if (!m_layoutRoot) {
-            HTMLElement* body = document.body();
+            HTMLElement* body = document.bodyOrFrameset();
             if (body && body->renderer()) {
                 if (body->hasTagName(framesetTag) && !frameFlatteningEnabled()) {
                     body->renderer()->setChildNeedsLayout();
@@ -1284,7 +1284,7 @@
                 m_needsFullRepaint = true;
                 if (!m_firstLayout) {
                     RenderBox* rootRenderer = document.documentElement() ? document.documentElement()->renderBox() : 0;
-                    RenderBox* bodyRenderer = rootRenderer && document.body() ? document.body()->renderBox() : 0;
+                    RenderBox* bodyRenderer = rootRenderer && document.bodyOrFrameset() ? document.bodyOrFrameset()->renderBox() : 0;
                     if (bodyRenderer && bodyRenderer->stretchesToViewport())
                         bodyRenderer->setChildNeedsLayout();
                     else if (rootRenderer && rootRenderer->stretchesToViewport())
@@ -3521,7 +3521,7 @@
     if (!cornerRect.isEmpty()) {
         // Try the <body> element first as a scroll corner source.
         Document* doc = frame().document();
-        Element* body = doc ? doc->body() : 0;
+        Element* body = doc ? doc->bodyOrFrameset() : 0;
         if (body && body->renderer()) {
             renderer = body->renderer();
             cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), &renderer->style());
@@ -3596,7 +3596,7 @@
         return Color();
 
     Element* htmlElement = frame().document()->documentElement();
-    Element* bodyElement = frame().document()->body();
+    Element* bodyElement = frame().document()->bodyOrFrameset();
 
     // Start with invalid colors.
     Color htmlBackgroundColor;

Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (179156 => 179157)


--- trunk/Source/WebCore/page/ios/FrameIOS.mm	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm	2015-01-27 00:26:21 UTC (rev 179157)
@@ -547,7 +547,7 @@
 
     document->updateLayout();
 
-    Node* body = document->body();
+    auto* body = document->bodyOrFrameset();
     if (!body)
         return 0;
 
@@ -744,7 +744,7 @@
     if (!document())
         return nil;
 
-    Element* root = selection().selection().selectionType() == VisibleSelection::NoSelection ? document()->body() : selection().selection().rootEditableElement();
+    auto* root = selection().selection().selectionType() == VisibleSelection::NoSelection ? document()->bodyOrFrameset() : selection().selection().rootEditableElement();
     unsigned rootChildCount = root->countChildNodes();
     RefPtr<Range> rangeOfRootContents = Range::create(*document(), createLegacyEditingPosition(root, 0), createLegacyEditingPosition(root, rootChildCount));
 

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (179156 => 179157)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -468,7 +468,7 @@
             // (2) We are the primary <body> (can be checked by looking at document.body).
             // (3) The root element has visible overflow.
             if (document().documentElement()->hasTagName(htmlTag)
-                && document().body() == element()
+                && document().bodyOrFrameset() == element()
                 && document().documentElement()->renderer()->style().overflowX() == OVISIBLE) {
                 boxHasOverflowClip = false;
             }

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (179156 => 179157)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -790,7 +790,7 @@
                     // to crawl around a render tree with potential :before/:after content and
                     // anonymous blocks created by inline <body> tags etc.  We can locate the <body>
                     // render object very easily via the DOM.
-                    HTMLElement* body = document().body();
+                    HTMLElement* body = document().bodyOrFrameset();
                     if (body) {
                         // Can't scroll a frameset document anyway.
                         isOpaqueRoot = body->hasTagName(framesetTag);

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (179156 => 179157)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1799,7 +1799,7 @@
             return false;
         
         // Now look at the body's renderer.
-        HTMLElement* body = renderer().document().body();
+        HTMLElement* body = renderer().document().bodyOrFrameset();
         RenderObject* bodyObject = (body && body->hasTagName(bodyTag)) ? body->renderer() : 0;
         if (!bodyObject)
             return false;

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (179156 => 179157)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -2296,7 +2296,7 @@
     
     // CSS regions specification says that region flows should return the body element as their offsetParent.
     if (is<RenderNamedFlowThread>(current))
-        current = document().body() ? document().body()->renderer() : nullptr;
+        current = document().bodyOrFrameset() ? document().bodyOrFrameset()->renderer() : nullptr;
     
     return is<RenderBoxModelObject>(current) ? downcast<RenderBoxModelObject>(current) : nullptr;
 }

Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (179156 => 179157)


--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -810,7 +810,7 @@
 {
     StringBuilder result;
 
-    Element* body = node->document().body();
+    Element* body = node->document().bodyOrFrameset();
     Node* parent;
     for (Node* n = node; n; n = parent) {
         parent = n->parentOrShadowHostNode();

Modified: trunk/Source/WebCore/style/StyleResolveForDocument.cpp (179156 => 179157)


--- trunk/Source/WebCore/style/StyleResolveForDocument.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebCore/style/StyleResolveForDocument.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -74,7 +74,7 @@
         // Use the direction and writing-mode of the body to set the
         // viewport's direction and writing-mode unless the property is set on the document element.
         // If there is no body, then use the document element.
-        RenderObject* bodyRenderer = document.body() ? document.body()->renderer() : 0;
+        RenderObject* bodyRenderer = document.bodyOrFrameset() ? document.bodyOrFrameset()->renderer() : 0;
         if (bodyRenderer && !document.writingModeSetOnDocumentElement())
             documentStyle.get().setWritingMode(bodyRenderer->style().writingMode());
         else

Modified: trunk/Source/WebKit/mac/ChangeLog (179156 => 179157)


--- trunk/Source/WebKit/mac/ChangeLog	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1,5 +1,21 @@
 2015-01-26  Chris Dumez  <[email protected]>
 
+        Rename Document::body() to Document::bodyOrFrameset() for clarity
+        https://bugs.webkit.org/show_bug.cgi?id=140902
+
+        Reviewed by Andreas Kling.
+
+        Rename Document::body() to Document::bodyOrFrameset() for clarity. This
+        method does not necessarily return an HTMLBodyElement, it can also
+        return a frameset as per the specification:
+        http://www.w3.org/TR/html5/dom.html#dom-tree-accessors
+
+        This method is often misused internally (the caller is only interested
+        in the <body> element). I will fix these instances in a follow-up patch,
+        this patch is only renaming mechanically.
+
+2015-01-26  Chris Dumez  <[email protected]>
+
         First argument to DOM traversal functions should be a reference
         https://bugs.webkit.org/show_bug.cgi?id=140895
 

Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (179156 => 179157)


--- trunk/Source/WebKit/mac/WebView/WebFrame.mm	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1043,7 +1043,7 @@
     Document* document = _private->coreFrame->document();
     if (!document)
         return nil;
-    HTMLElement* body = document->body();
+    auto* body = document->bodyOrFrameset();
     if (!body)
         return nil;
     RenderObject* bodyRenderer = body->renderer();
@@ -1754,11 +1754,11 @@
     NSMutableArray *ranges = [NSMutableArray array];
     NSMutableArray *metadatas = [NSMutableArray array];
     
-    Frame *frame = core(self);
-    Document *document = frame->document();
+    Frame* frame = core(self);
+    Document* document = frame->document();
 
     const VisibleSelection& selection = frame->selection().selection();
-    Element *root = selection.selectionType() == VisibleSelection::NoSelection ? frame->document()->body() : selection.rootEditableElement();
+    Element* root = selection.selectionType() == VisibleSelection::NoSelection ? frame->document()->bodyOrFrameset() : selection.rootEditableElement();
     
     DOMRange *previousDOMRange = nil;
     id previousMetadata = nil;
@@ -2333,7 +2333,7 @@
     Element* root;
     const VisibleSelection& selection = coreFrame->selection().selection();
     if (selection.isNone() || !selection.isContentEditable())
-        root = coreFrame->document()->body();
+        root = coreFrame->document()->bodyOrFrameset();
     else {
         // Can't use the focusedNode here because we want the root of the shadow tree for form elements.
         root = selection.rootEditableElement();

Modified: trunk/Source/WebKit/win/ChangeLog (179156 => 179157)


--- trunk/Source/WebKit/win/ChangeLog	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebKit/win/ChangeLog	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1,3 +1,19 @@
+2015-01-26  Chris Dumez  <[email protected]>
+
+        Rename Document::body() to Document::bodyOrFrameset() for clarity
+        https://bugs.webkit.org/show_bug.cgi?id=140902
+
+        Reviewed by Andreas Kling.
+
+        Rename Document::body() to Document::bodyOrFrameset() for clarity. This
+        method does not necessarily return an HTMLBodyElement, it can also
+        return a frameset as per the specification:
+        http://www.w3.org/TR/html5/dom.html#dom-tree-accessors
+
+        This method is often misused internally (the caller is only interested
+        in the <body> element). I will fix these instances in a follow-up patch,
+        this patch is only renaming mechanically.
+
 2015-01-25  [email protected]  <[email protected]>
 
         [Win] Add WebKit message loop interface.

Modified: trunk/Source/WebKit/win/DOMHTMLClasses.cpp (179156 => 179157)


--- trunk/Source/WebKit/win/DOMHTMLClasses.cpp	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebKit/win/DOMHTMLClasses.cpp	2015-01-27 00:26:21 UTC (rev 179157)
@@ -262,7 +262,7 @@
 
     HTMLDocument& htmlDoc = downcast<HTMLDocument>(*m_document);
     COMPtr<IDOMElement> domElement;
-    domElement.adoptRef(DOMHTMLElement::createInstance(htmlDoc.body()));
+    domElement.adoptRef(DOMHTMLElement::createInstance(htmlDoc.bodyOrFrameset()));
     if (domElement)
         return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) bodyElement);
     return E_FAIL;

Modified: trunk/Source/WebKit2/ChangeLog (179156 => 179157)


--- trunk/Source/WebKit2/ChangeLog	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebKit2/ChangeLog	2015-01-27 00:26:21 UTC (rev 179157)
@@ -1,3 +1,19 @@
+2015-01-26  Chris Dumez  <[email protected]>
+
+        Rename Document::body() to Document::bodyOrFrameset() for clarity
+        https://bugs.webkit.org/show_bug.cgi?id=140902
+
+        Reviewed by Andreas Kling.
+
+        Rename Document::body() to Document::bodyOrFrameset() for clarity. This
+        method does not necessarily return an HTMLBodyElement, it can also
+        return a frameset as per the specification:
+        http://www.w3.org/TR/html5/dom.html#dom-tree-accessors
+
+        This method is often misused internally (the caller is only interested
+        in the <body> element). I will fix these instances in a follow-up patch,
+        this patch is only renaming mechanically.
+
 2015-01-26  Antti Koivisto  <[email protected]>
 
         Add a user default for disabling network cache

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm (179156 => 179157)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm	2015-01-27 00:26:21 UTC (rev 179157)
@@ -49,7 +49,7 @@
 
 - (WKDOMElement *)body
 {
-    return WebKit::toWKDOMElement(downcast<WebCore::Document>(*_impl).body());
+    return WebKit::toWKDOMElement(downcast<WebCore::Document>(*_impl).bodyOrFrameset());
 }
 
 @end

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (179156 => 179157)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2015-01-27 00:19:21 UTC (rev 179156)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2015-01-27 00:26:21 UTC (rev 179157)
@@ -519,7 +519,7 @@
         m_annotationStyle->setTextContent(annotationStyle, ASSERT_NO_EXCEPTION);
 
         m_annotationContainer->appendChild(m_annotationStyle.get());
-        document->body()->appendChild(m_annotationContainer.get());
+        document->bodyOrFrameset()->appendChild(m_annotationContainer.get());
     }
 
     m_accessibilityObject = adoptNS([[WKPDFPluginAccessibilityObject alloc] initWithPDFPlugin:this]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to