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

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 patch after splitting 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
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 6274358d39f05518cd868e37df71e76f383d0e50..55c3b68b40f023add258b20eb2c5d59c4372d742 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;

Powered by Google App Engine
This is Rietveld 408576698