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

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: Updated change after Doug's review. Created 5 years, 10 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/page/TouchAdjustment.cpp ('k') | Source/core/rendering/RenderCombineText.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 522d1ed206d89d36b7da8d4c93a0235723b89056..5f40d57aec649d17028db83dd7541acffd14683b 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -276,7 +276,7 @@ void RenderBlock::willBeDestroyed()
void RenderBlock::styleWillChange(StyleDifference diff, const LayoutStyle& newStyle)
{
- LayoutStyle* oldStyle = style();
+ const LayoutStyle* oldStyle = style();
setReplaced(newStyle.isDisplayInlineType());
@@ -336,7 +336,7 @@ void RenderBlock::styleDidChange(StyleDifference diff, const LayoutStyle* oldSty
for (RenderBlock* currCont = blockElementContinuation(); currCont; currCont = currCont->blockElementContinuation()) {
RenderBoxModelObject* nextCont = currCont->continuation();
currCont->setContinuation(0);
- currCont->setStyle(style());
+ currCont->setStyle(mutableStyle());
currCont->setContinuation(nextCont);
}
}
@@ -588,7 +588,7 @@ RenderBlock* RenderBlock::clone() const
else {
LayoutObject* cloneRenderer = toElement(node())->createRenderer(styleRef());
cloneBlock = toRenderBlock(cloneRenderer);
- cloneBlock->setStyle(style());
+ cloneBlock->setStyle(mutableStyle());
// This takes care of setting the right value of childrenInline in case
// generated content is added to cloneBlock and 'this' does not have
@@ -3051,14 +3051,14 @@ void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
continue;
}
- RefPtr<LayoutStyle> childStyle = child->style();
+ const LayoutStyle& childStyle = child->styleRef();
if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) {
LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth;
- if (childStyle->clear() & CLEFT) {
+ if (childStyle.clear() & CLEFT) {
maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth);
floatLeftWidth = 0;
}
- if (childStyle->clear() & CRIGHT) {
+ if (childStyle.clear() & CRIGHT) {
maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth);
floatRightWidth = 0;
}
@@ -3067,8 +3067,8 @@ void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
// A margin basically has three types: fixed, percentage, and auto (variable).
// Auto and percentage margins simply become 0 when computing min/max width.
// Fixed margins can be added in as is.
- Length startMarginLength = childStyle->marginStartUsing(&styleToUse);
- Length endMarginLength = childStyle->marginEndUsing(&styleToUse);
+ Length startMarginLength = childStyle.marginStartUsing(&styleToUse);
+ Length endMarginLength = childStyle.marginEndUsing(&styleToUse);
LayoutUnit margin = 0;
LayoutUnit marginStart = 0;
LayoutUnit marginEnd = 0;
@@ -3117,7 +3117,7 @@ void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
}
if (child->isFloating()) {
- if (childStyle->floating() == LeftFloat)
+ if (childStyle.floating() == LeftFloat)
floatLeftWidth += w;
else
floatRightWidth += w;
« no previous file with comments | « Source/core/page/TouchAdjustment.cpp ('k') | Source/core/rendering/RenderCombineText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698