Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1248)

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index 167899f293777acafec007f3c4c205797f7cedb8..59888ae33e06a2262190d48a6d4941a4fed62967 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -85,7 +85,7 @@ static bool skipBodyBackground(const RenderBox* bodyElementRenderer)
ASSERT(bodyElementRenderer->isBody());
// The <body> only paints its background if the root element has defined a background independent of the body,
// or if the <body>'s parent is not the document element's renderer (e.g. inside SVG foreignObject).
- RenderObject* documentElementRenderer = bodyElementRenderer->document()->documentElement()->renderer();
+ RenderObject* documentElementRenderer = bodyElementRenderer->document().documentElement()->renderer();
return documentElementRenderer
&& !documentElementRenderer->hasBackground()
&& (documentElementRenderer == bodyElementRenderer->parent());
@@ -283,20 +283,20 @@ void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
// Propagate the new writing mode and direction up to the RenderView.
RenderView* viewRenderer = view();
RenderStyle* viewStyle = viewRenderer->style();
- if (viewStyle->direction() != newStyle->direction() && (isRootRenderer || !document()->directionSetOnDocumentElement())) {
+ if (viewStyle->direction() != newStyle->direction() && (isRootRenderer || !document().directionSetOnDocumentElement())) {
viewStyle->setDirection(newStyle->direction());
if (isBodyRenderer)
- document()->documentElement()->renderer()->style()->setDirection(newStyle->direction());
+ document().documentElement()->renderer()->style()->setDirection(newStyle->direction());
setNeedsLayoutAndPrefWidthsRecalc();
}
- if (viewStyle->writingMode() != newStyle->writingMode() && (isRootRenderer || !document()->writingModeSetOnDocumentElement())) {
+ if (viewStyle->writingMode() != newStyle->writingMode() && (isRootRenderer || !document().writingModeSetOnDocumentElement())) {
viewStyle->setWritingMode(newStyle->writingMode());
viewRenderer->setHorizontalWritingMode(newStyle->isHorizontalWritingMode());
viewRenderer->markAllDescendantsWithFloatsForLayout();
if (isBodyRenderer) {
- document()->documentElement()->renderer()->style()->setWritingMode(newStyle->writingMode());
- document()->documentElement()->renderer()->setHorizontalWritingMode(newStyle->isHorizontalWritingMode());
+ document().documentElement()->renderer()->style()->setWritingMode(newStyle->writingMode());
+ document().documentElement()->renderer()->setHorizontalWritingMode(newStyle->isHorizontalWritingMode());
}
setNeedsLayoutAndPrefWidthsRecalc();
}
@@ -361,9 +361,9 @@ void RenderBox::updateFromStyle()
// (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 (isHTMLHtmlElement(document()->documentElement())
- && document()->body() == node()
- && document()->documentElement()->renderer()->style()->overflowX() == OVISIBLE)
+ if (isHTMLHtmlElement(document().documentElement())
+ && document().body() == node()
+ && document().documentElement()->renderer()->style()->overflowX() == OVISIBLE)
boxHasOverflowClip = false;
}
@@ -782,7 +782,7 @@ bool RenderBox::canAutoscroll() const
return true;
// Check for a box that represents the top level of a web page.
- if (node() != document())
+ if (node() != &document())
return false;
Frame* frame = this->frame();
if (!frame)
@@ -823,8 +823,8 @@ IntSize RenderBox::calculateAutoscrollDirection(const IntPoint& windowPoint) con
RenderBox* RenderBox::findAutoscrollable(RenderObject* renderer)
{
while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscroll())) {
- if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement())
- renderer = renderer->document()->ownerElement()->renderer();
+ if (!renderer->parent() && renderer->node() == &renderer->document() && renderer->document().ownerElement())
+ renderer = renderer->document().ownerElement()->renderer();
else
renderer = renderer->parent();
}
@@ -1482,7 +1482,7 @@ bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer
// Now that we know this image is being used, compute the renderer and the rect
// if we haven't already
if (!layerRenderer) {
- bool drawingRootBackground = drawingBackground && (isRoot() || (isBody() && !document()->documentElement()->renderer()->hasBackground()));
+ bool drawingRootBackground = drawingBackground && (isRoot() || (isBody() && !document().documentElement()->renderer()->hasBackground()));
if (drawingRootBackground) {
layerRenderer = view();
@@ -2596,8 +2596,8 @@ void RenderBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logica
// is specified. When we're printing, we also need this quirk if the body or root has a percentage
// height since we don't set a height in RenderView when we're printing. So without this quirk, the
// height has nothing to be a percentage of, and it ends up being 0. That is bad.
- bool paginatedContentNeedsBaseHeight = document()->printing() && h.isPercent()
- && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->logicalHeight().isPercent())) && !isInline();
+ bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercent()
+ && (isRoot() || (isBody() && document().documentElement()->renderer()->style()->logicalHeight().isPercent())) && !isInline();
if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
LayoutUnit visibleHeight = viewLogicalHeightForPercentages();
@@ -2612,7 +2612,7 @@ void RenderBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logica
LayoutUnit RenderBox::viewLogicalHeightForPercentages() const
{
- if (document()->printing())
+ if (document().printing())
return static_cast<LayoutUnit>(view()->pageLogicalHeight());
return view()->viewLogicalHeight();
}
@@ -2672,7 +2672,7 @@ bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox*
{
// For quirks mode and anonymous blocks, we skip auto-height containingBlocks when computing percentages.
// For standards mode, we treat the percentage as auto if it has an auto-height containing block.
- if (!document()->inQuirksMode() && !containingBlock->isAnonymousBlock())
+ if (!document().inQuirksMode() && !containingBlock->isAnonymousBlock())
return false;
return !containingBlock->isTableCell() && !containingBlock->isOutOfFlowPositioned() && containingBlock->style()->logicalHeight().isAuto() && isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode();
}
@@ -4372,7 +4372,7 @@ bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock*
// block has an auto height. We still skip anonymous containing blocks in both modes, though, and look
// only at explicit containers.
const RenderBlock* cb = containingBlock;
- bool inQuirksMode = cb->document()->inQuirksMode();
+ bool inQuirksMode = cb->document().inQuirksMode();
while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) {
if (!inQuirksMode && !cb->isAnonymousBlock())
break;
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698