Diff
Modified: trunk/Source/WebCore/ChangeLog (179171 => 179172)
--- trunk/Source/WebCore/ChangeLog 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/ChangeLog 2015-01-27 07:05:08 UTC (rev 179172)
@@ -1,3 +1,20 @@
+2015-01-26 Chris Dumez <[email protected]>
+
+ Introduce Document::body() for call sites interested in the <body> element
+ https://bugs.webkit.org/show_bug.cgi?id=140920
+
+ Reviewed by Darin Adler.
+
+ Introduce Document::body() method for call sites interested only in the
+ document's <body> element (not the <frameset>). Also clean up the call
+ sites of Document::bodyOrFrameset() to cache the return value when
+ suitable as this method does a tree traversal.
+
+ This patch does not change behavior, it merely ports calls sites that
+ were calling Document::bodyOrFrameset() then checking if the tag was
+ <body>, to call Document::body() instead. Doing so is more efficient
+ and clearer.
+
2015-01-26 Brent Fulgham <[email protected]>
[Win] ASSERTION FAILED !m_ptr under AccessibilityController::winAddNotificationListener
Modified: trunk/Source/WebCore/dom/Document.cpp (179171 => 179172)
--- trunk/Source/WebCore/dom/Document.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/dom/Document.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -2324,13 +2324,21 @@
setReadyState(Loading);
}
+HTMLBodyElement* Document::body() const
+{
+ auto* element = documentElement();
+ if (!element)
+ return nullptr;
+ return childrenOfType<HTMLBodyElement>(*element).first();
+}
+
HTMLElement* Document::bodyOrFrameset() const
{
// If the document element contains both a frameset and a body, the frameset wins.
- auto element = documentElement();
+ auto* element = documentElement();
if (!element)
return nullptr;
- if (auto frameset = childrenOfType<HTMLFrameSetElement>(*element).first())
+ if (auto* frameset = childrenOfType<HTMLFrameSetElement>(*element).first())
return frameset;
return childrenOfType<HTMLBodyElement>(*element).first();
}
@@ -2339,6 +2347,9 @@
{
RefPtr<HTMLElement> newBody = prpNewBody;
+ // FIXME: This does not support setting a <frameset> Element, only a <body>. This does
+ // not match the HTML specification:
+ // https://html.spec.whatwg.org/multipage/dom.html#dom-document-body
if (!newBody || !documentElement() || !newBody->hasTagName(bodyTag)) {
ec = HIERARCHY_REQUEST_ERR;
return;
@@ -2542,7 +2553,7 @@
// (b) Only schedule layout once we have a body element.
return (haveStylesheetsLoaded() && bodyOrFrameset())
- || (documentElement() && !documentElement()->hasTagName(htmlTag));
+ || (documentElement() && !is<HTMLHtmlElement>(*documentElement()));
}
bool Document::isLayoutTimerActive()
Modified: trunk/Source/WebCore/dom/Document.h (179171 => 179172)
--- trunk/Source/WebCore/dom/Document.h 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/dom/Document.h 2015-01-27 07:05:08 UTC (rev 179172)
@@ -101,9 +101,10 @@
class FormController;
class Frame;
class FrameView;
+class HTMLAllCollection;
+class HTMLBodyElement;
class HTMLCanvasElement;
class HTMLCollection;
-class HTMLAllCollection;
class HTMLDocument;
class HTMLElement;
class HTMLFrameOwnerElement;
@@ -937,6 +938,7 @@
static bool hasValidNamespaceForElements(const QualifiedName&);
static bool hasValidNamespaceForAttributes(const QualifiedName&);
+ HTMLBodyElement* body() const;
WEBCORE_EXPORT HTMLElement* bodyOrFrameset() const;
void setBodyOrFrameset(PassRefPtr<HTMLElement>, ExceptionCode&);
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (179171 => 179172)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -2108,10 +2108,7 @@
return;
#endif
- auto* documentElement = document->documentElement();
- if (!documentElement)
- return;
- if (auto body = childrenOfType<HTMLBodyElement>(*documentElement).first())
+ if (auto* body = document->body())
setSelection(VisibleSelection(firstPositionInOrBeforeNode(body), DOWNSTREAM));
}
Modified: trunk/Source/WebCore/editing/VisiblePosition.cpp (179171 => 179172)
--- trunk/Source/WebCore/editing/VisiblePosition.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/editing/VisiblePosition.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -536,8 +536,11 @@
// 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().bodyOrFrameset() && node->document().bodyOrFrameset()->hasEditableStyle())
- return next.isNotNull() ? next : prev;
+ if (is<HTMLHtmlElement>(node) && !node->hasEditableStyle()) {
+ auto* body = node->document().bodyOrFrameset();
+ if (body && body->hasEditableStyle())
+ return next.isNotNull() ? next : prev;
+ }
Node* editingRoot = editableRootForPosition(position);
Modified: trunk/Source/WebCore/html/HTMLDocument.cpp (179171 => 179172)
--- trunk/Source/WebCore/html/HTMLDocument.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/html/HTMLDocument.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -57,6 +57,7 @@
#include "CookieJar.h"
#include "DocumentLoader.h"
#include "DocumentType.h"
+#include "ElementChildIterator.h"
#include "ExceptionCode.h"
#include "FocusController.h"
#include "Frame.h"
@@ -139,82 +140,72 @@
const AtomicString& HTMLDocument::bgColor() const
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
+ auto* bodyElement = body();
+ if (!bodyElement)
return emptyAtom;
return bodyElement->fastGetAttribute(bgcolorAttr);
}
void HTMLDocument::setBgColor(const String& value)
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
- return;
- bodyElement->setAttribute(bgcolorAttr, value);
+ if (auto* bodyElement = body())
+ bodyElement->setAttribute(bgcolorAttr, value);
}
const AtomicString& HTMLDocument::fgColor() const
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
+ auto* bodyElement = body();
+ if (!bodyElement)
return emptyAtom;
return bodyElement->fastGetAttribute(textAttr);
}
void HTMLDocument::setFgColor(const String& value)
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
- return;
- bodyElement->setAttribute(textAttr, value);
+ if (auto* bodyElement = body())
+ bodyElement->setAttribute(textAttr, value);
}
const AtomicString& HTMLDocument::alinkColor() const
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
+ auto* bodyElement = body();
+ if (!bodyElement)
return emptyAtom;
return bodyElement->fastGetAttribute(alinkAttr);
}
void HTMLDocument::setAlinkColor(const String& value)
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
- return;
- bodyElement->setAttribute(alinkAttr, value);
+ if (auto* bodyElement = body())
+ bodyElement->setAttribute(alinkAttr, value);
}
const AtomicString& HTMLDocument::linkColor() const
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
+ auto* bodyElement = body();
+ if (!bodyElement)
return emptyAtom;
return bodyElement->fastGetAttribute(linkAttr);
}
void HTMLDocument::setLinkColor(const String& value)
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
- return;
- return bodyElement->setAttribute(linkAttr, value);
+ if (auto* bodyElement = body())
+ bodyElement->setAttribute(linkAttr, value);
}
const AtomicString& HTMLDocument::vlinkColor() const
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
+ auto* bodyElement = body();
+ if (!bodyElement)
return emptyAtom;
return bodyElement->fastGetAttribute(vlinkAttr);
}
void HTMLDocument::setVlinkColor(const String& value)
{
- HTMLElement* bodyElement = bodyOrFrameset();
- if (!is<HTMLBodyElement>(bodyElement))
- return;
- return bodyElement->setAttribute(vlinkAttr, value);
+ if (auto* bodyElement = body())
+ bodyElement->setAttribute(vlinkAttr, value);
}
void HTMLDocument::captureEvents()
@@ -340,7 +331,9 @@
bool HTMLDocument::isFrameSet() const
{
- return is<HTMLFrameSetElement>(bodyOrFrameset());
+ if (!documentElement())
+ return false;
+ return !!childrenOfType<HTMLFrameSetElement>(*documentElement()).first();
}
Ref<Document> HTMLDocument::cloneDocumentWithoutChildren() const
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (179171 => 179172)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -958,10 +958,10 @@
if (!ec) {
ContainerNode* targetNode;
// HEAD is absent in ImageDocuments, for example.
- if (document->head())
- targetNode = document->head();
- else if (document->bodyOrFrameset())
- targetNode = document->bodyOrFrameset();
+ if (auto* head = document->head())
+ targetNode = head;
+ else if (auto* body = document->bodyOrFrameset())
+ targetNode = body;
else
return nullptr;
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (179171 => 179172)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -912,8 +912,11 @@
void CachedResourceLoader::checkForPendingPreloads()
{
- if (m_pendingPreloads.isEmpty() || !m_document->bodyOrFrameset() || !m_document->bodyOrFrameset()->renderer())
+ if (m_pendingPreloads.isEmpty())
return;
+ auto* body = m_document->bodyOrFrameset();
+ if (!body || !body->renderer())
+ return;
#if PLATFORM(IOS)
// We always preload resources on iOS. See <https://bugs.webkit.org/show_bug.cgi?id=91276>.
// So, we should never have any pending preloads.
Modified: trunk/Source/WebCore/page/FrameView.cpp (179171 => 179172)
--- trunk/Source/WebCore/page/FrameView.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/page/FrameView.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -46,6 +46,7 @@
#include "FrameSelection.h"
#include "FrameTree.h"
#include "GraphicsContext.h"
+#include "HTMLBodyElement.h"
#include "HTMLDocument.h"
#include "HTMLFrameElement.h"
#include "HTMLFrameSetElement.h"
@@ -539,12 +540,12 @@
Document* doc = frame().document();
// Try the <body> element first as a scrollbar source.
- Element* body = doc ? doc->bodyOrFrameset() : 0;
+ HTMLElement* body = doc ? doc->bodyOrFrameset() : nullptr;
if (body && body->renderer() && body->renderer()->style().hasPseudoStyle(SCROLLBAR))
return RenderScrollbar::createCustomScrollbar(this, orientation, body);
// If the <body> didn't have a custom style, then the root element might.
- Element* docElement = doc ? doc->documentElement() : 0;
+ Element* docElement = doc ? doc->documentElement() : nullptr;
if (docElement && docElement->renderer() && docElement->renderer()->style().hasPseudoStyle(SCROLLBAR))
return RenderScrollbar::createCustomScrollbar(this, orientation, docElement);
@@ -670,11 +671,9 @@
auto documentElement = document->documentElement();
RenderElement* documentRenderer = documentElement ? documentElement->renderer() : nullptr;
RenderElement* documentOrBodyRenderer = documentRenderer;
- auto body = document->bodyOrFrameset();
- if (body && body->renderer()) {
- if (body->hasTagName(bodyTag))
- documentOrBodyRenderer = documentRenderer->style().overflowX() == OVISIBLE && documentElement->hasTagName(htmlTag) ? body->renderer() : documentRenderer;
- }
+ auto* body = document->body();
+ if (body && body->renderer())
+ documentOrBodyRenderer = documentRenderer->style().overflowX() == OVISIBLE && is<HTMLHtmlElement>(*documentElement) ? body->renderer() : documentRenderer;
Pagination pagination;
@@ -715,15 +714,15 @@
Document* document = frame().document();
auto documentElement = document->documentElement();
RenderElement* rootRenderer = documentElement ? documentElement->renderer() : nullptr;
- auto body = document->bodyOrFrameset();
+ auto* body = document->bodyOrFrameset();
if (body && body->renderer()) {
- if (body->hasTagName(framesetTag) && !frameFlatteningEnabled()) {
+ if (is<HTMLFrameSetElement>(*body) && !frameFlatteningEnabled()) {
vMode = ScrollbarAlwaysOff;
hMode = ScrollbarAlwaysOff;
- } else if (body->hasTagName(bodyTag)) {
+ } else if (is<HTMLBodyElement>(*body)) {
// It's sufficient to just check the X overflow,
// since it's illegal to have visible in only one direction.
- RenderElement* o = rootRenderer->style().overflowX() == OVISIBLE && document->documentElement()->hasTagName(htmlTag) ? body->renderer() : rootRenderer;
+ RenderElement* o = rootRenderer->style().overflowX() == OVISIBLE && is<HTMLHtmlElement>(*document->documentElement()) ? body->renderer() : rootRenderer;
applyOverflowToViewport(o, hMode, vMode);
}
} else if (rootRenderer)
@@ -1229,11 +1228,11 @@
TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
if (!m_layoutRoot) {
- HTMLElement* body = document.bodyOrFrameset();
+ auto* body = document.bodyOrFrameset();
if (body && body->renderer()) {
- if (body->hasTagName(framesetTag) && !frameFlatteningEnabled()) {
+ if (is<HTMLFrameSetElement>(*body) && !frameFlatteningEnabled()) {
body->renderer()->setChildNeedsLayout();
- } else if (body->hasTagName(bodyTag)) {
+ } else if (is<HTMLBodyElement>(*body)) {
if (!m_firstLayout && m_size.height() != layoutHeight() && body->renderer()->enclosingBox().stretchesToViewport())
body->renderer()->setChildNeedsLayout();
}
@@ -1283,8 +1282,9 @@
if (oldSize != m_size) {
m_needsFullRepaint = true;
if (!m_firstLayout) {
- RenderBox* rootRenderer = document.documentElement() ? document.documentElement()->renderBox() : 0;
- RenderBox* bodyRenderer = rootRenderer && document.bodyOrFrameset() ? document.bodyOrFrameset()->renderBox() : 0;
+ RenderBox* rootRenderer = document.documentElement() ? document.documentElement()->renderBox() : nullptr;
+ auto* body = document.bodyOrFrameset();
+ RenderBox* bodyRenderer = rootRenderer && body ? body->renderBox() : nullptr;
if (bodyRenderer && bodyRenderer->stretchesToViewport())
bodyRenderer->setChildNeedsLayout();
else if (rootRenderer && rootRenderer->stretchesToViewport())
@@ -3514,14 +3514,14 @@
void FrameView::updateScrollCorner()
{
- RenderElement* renderer = 0;
+ RenderElement* renderer = nullptr;
RefPtr<RenderStyle> cornerStyle;
IntRect cornerRect = scrollCornerRect();
if (!cornerRect.isEmpty()) {
// Try the <body> element first as a scroll corner source.
Document* doc = frame().document();
- Element* body = doc ? doc->bodyOrFrameset() : 0;
+ Element* body = doc ? doc->bodyOrFrameset() : nullptr;
if (body && body->renderer()) {
renderer = body->renderer();
cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), &renderer->style());
@@ -3529,7 +3529,7 @@
if (!cornerStyle) {
// If the <body> didn't have a custom style, then the root element might.
- Element* docElement = doc ? doc->documentElement() : 0;
+ Element* docElement = doc ? doc->documentElement() : nullptr;
if (docElement && docElement->renderer()) {
renderer = docElement->renderer();
cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), &renderer->style());
@@ -3595,8 +3595,8 @@
if (!frame().document())
return Color();
- Element* htmlElement = frame().document()->documentElement();
- Element* bodyElement = frame().document()->bodyOrFrameset();
+ auto* htmlElement = frame().document()->documentElement();
+ auto* bodyElement = frame().document()->bodyOrFrameset();
// Start with invalid colors.
Color htmlBackgroundColor;
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (179171 => 179172)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -34,6 +34,7 @@
#include "Frame.h"
#include "FrameView.h"
#include "GraphicsContext.h"
+#include "HTMLBodyElement.h"
#include "HTMLButtonElement.h"
#include "HTMLElement.h"
#include "HTMLFrameOwnerElement.h"
@@ -467,8 +468,8 @@
// (1) The root element is <html>.
// (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().bodyOrFrameset() == element()
+ if (is<HTMLHtmlElement>(*document().documentElement())
+ && document().body() == element()
&& document().documentElement()->renderer()->style().overflowX() == OVISIBLE) {
boxHasOverflowClip = false;
}
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (179171 => 179172)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -790,10 +790,9 @@
// 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().bodyOrFrameset();
- if (body) {
+ if (HTMLElement* body = document().bodyOrFrameset()) {
// Can't scroll a frameset document anyway.
- isOpaqueRoot = body->hasTagName(framesetTag);
+ isOpaqueRoot = is<HTMLFrameSetElement>(*body);
} else {
// SVG documents and XML documents with SVG root nodes are transparent.
isOpaqueRoot = !document().hasSVGRootNode();
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (179171 => 179172)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -1120,7 +1120,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.
- if (auto* body = childrenOfType<HTMLBodyElement>(*element()).first()) {
+ if (auto* body = document().body()) {
if (auto* renderer = body->renderer())
return *renderer;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (179171 => 179172)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -36,6 +36,7 @@
#include "FrameView.h"
#include "GraphicsContext.h"
#include "GraphicsLayer.h"
+#include "HTMLBodyElement.h"
#include "HTMLCanvasElement.h"
#include "HTMLIFrameElement.h"
#include "HTMLMediaElement.h"
@@ -1789,7 +1790,7 @@
if (renderer().isRenderView()) {
// Look to see if the root object has a non-simple background
- RenderObject* rootObject = renderer().document().documentElement() ? renderer().document().documentElement()->renderer() : 0;
+ auto* rootObject = renderer().document().documentElement() ? renderer().document().documentElement()->renderer() : nullptr;
if (!rootObject)
return false;
@@ -1799,12 +1800,14 @@
return false;
// Now look at the body's renderer.
- HTMLElement* body = renderer().document().bodyOrFrameset();
- RenderObject* bodyObject = (body && body->hasTagName(bodyTag)) ? body->renderer() : 0;
- if (!bodyObject)
+ auto* body = renderer().document().body();
+ if (!body)
return false;
+ auto* bodyRenderer = body->renderer();
+ if (!bodyRenderer)
+ return false;
- if (hasBoxDecorationsOrBackgroundImage(bodyObject->style()))
+ if (hasBoxDecorationsOrBackgroundImage(bodyRenderer->style()))
return false;
}
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (179171 => 179172)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -2295,8 +2295,10 @@
}
// CSS regions specification says that region flows should return the body element as their offsetParent.
- if (is<RenderNamedFlowThread>(current))
- current = document().bodyOrFrameset() ? document().bodyOrFrameset()->renderer() : nullptr;
+ if (is<RenderNamedFlowThread>(current)) {
+ auto* body = document().bodyOrFrameset();
+ current = body ? body->renderer() : nullptr;
+ }
return is<RenderBoxModelObject>(current) ? downcast<RenderBoxModelObject>(current) : nullptr;
}
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (179171 => 179172)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -810,7 +810,7 @@
{
StringBuilder result;
- Element* body = node->document().bodyOrFrameset();
+ auto* body = node->document().bodyOrFrameset();
Node* parent;
for (Node* n = node; n; n = parent) {
parent = n->parentOrShadowHostNode();
Modified: trunk/Source/WebCore/style/StyleResolveForDocument.cpp (179171 => 179172)
--- trunk/Source/WebCore/style/StyleResolveForDocument.cpp 2015-01-27 06:32:03 UTC (rev 179171)
+++ trunk/Source/WebCore/style/StyleResolveForDocument.cpp 2015-01-27 07:05:08 UTC (rev 179172)
@@ -69,12 +69,13 @@
#endif
Element* docElement = document.documentElement();
- RenderObject* docElementRenderer = docElement ? docElement->renderer() : 0;
+ RenderObject* docElementRenderer = docElement ? docElement->renderer() : nullptr;
if (docElementRenderer) {
// 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.bodyOrFrameset() ? document.bodyOrFrameset()->renderer() : 0;
+ auto* body = document.bodyOrFrameset();
+ RenderObject* bodyRenderer = body ? body->renderer() : nullptr;
if (bodyRenderer && !document.writingModeSetOnDocumentElement())
documentStyle.get().setWritingMode(bodyRenderer->style().writingMode());
else