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

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

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blind fix for Mac. Created 5 years, 11 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
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index e4db4b8cda56117b561922587fb7436335018bf9..89b99eb5f6531ca610369a506ae7d78e776d07bb 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -197,7 +197,7 @@ static void appendLayers(Vector<ImageResource*>& images, const FillLayer& styleL
appendImageIfNotNull(images, layer->image());
}
-static void appendImagesFromStyle(Vector<ImageResource*>& images, RenderStyle& blockStyle)
+static void appendImagesFromStyle(Vector<ImageResource*>& images, const RenderStyle& blockStyle)
{
appendLayers(images, blockStyle.backgroundLayers());
appendLayers(images, blockStyle.maskLayers());
@@ -293,7 +293,7 @@ void RenderBlock::willBeDestroyed()
void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle& newStyle)
{
- RenderStyle* oldStyle = style();
+ const RenderStyle* oldStyle = style();
setReplaced(newStyle.isDisplayInlineType());
@@ -346,7 +346,7 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating() && !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isRenderBlockFlow())
toRenderBlock(parent())->removeAnonymousWrappersIfRequired();
- RenderStyle* newStyle = style();
+ RenderStyle* newStyle = deprecatedMutableStyle();
if (!isAnonymousBlock()) {
// Ensure that all of our continuation blocks pick up the new style.
@@ -591,7 +591,7 @@ RenderBlock* RenderBlock::clone() const
else {
RenderObject* cloneRenderer = toElement(node())->createRenderer(style());
cloneBlock = toRenderBlock(cloneRenderer);
- cloneBlock->setStyle(style());
+ cloneBlock->setStyle(deprecatedMutableStyle());
// This takes care of setting the right value of childrenInline in case
// generated content is added to cloneBlock and 'this' does not have
@@ -2982,7 +2982,7 @@ void RenderBlock::computePreferredLogicalWidths()
// FIXME: The isFixed() calls here should probably be checking for isSpecified since you
// should be able to use percentage, calc or viewport relative values for width.
- RenderStyle* styleToUse = style();
+ const RenderStyle* styleToUse = style();
if (!isTableCell() && styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() >= 0
&& !(isDeprecatedFlexItem() && !styleToUse->logicalWidth().intValue()))
m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalWidth().value());
@@ -3039,7 +3039,7 @@ void RenderBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalW
void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
- RenderStyle* styleToUse = style();
+ const RenderStyle* styleToUse = style();
bool nowrap = styleToUse->whiteSpace() == NOWRAP;
RenderObject* child = firstChild();
@@ -3053,7 +3053,7 @@ void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
continue;
}
- RefPtr<RenderStyle> childStyle = child->style();
+ const RenderStyle* childStyle = child->style();
if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) {
LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth;
if (childStyle->clear() & CLEFT) {
@@ -3160,7 +3160,7 @@ LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
if (isReplaced() && linePositionMode == PositionOnContainingLine)
return RenderBox::lineHeight(firstLine, direction, linePositionMode);
- RenderStyle* s = style(firstLine && document().styleEngine()->usesFirstLineRules());
+ const RenderStyle* s = style(firstLine && document().styleEngine()->usesFirstLineRules());
return s->computedLineHeight();
}
@@ -3788,7 +3788,7 @@ RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
RenderBlockFlow* RenderBlock::createAnonymousColumnsWithParentRenderer(const RenderObject* parent)
{
RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), BLOCK);
- newStyle->inheritColumnPropertiesFrom(parent->style());
+ newStyle->inheritColumnPropertiesFrom(*parent->style());
RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&parent->document());
parent->updateAnonymousChildStyle(newBox, newStyle.get());

Powered by Google App Engine
This is Rietveld 408576698