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

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 349103002: Revert of Strip anonymous blocks when change in style removes need for them (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return oldStyle->borderTopWidth() != newStyle->borderTopWidth() 323 return oldStyle->borderTopWidth() != newStyle->borderTopWidth()
324 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth() 324 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth()
325 || oldStyle->paddingTop() != newStyle->paddingTop() 325 || oldStyle->paddingTop() != newStyle->paddingTop()
326 || oldStyle->paddingBottom() != newStyle->paddingBottom(); 326 || oldStyle->paddingBottom() != newStyle->paddingBottom();
327 } 327 }
328 328
329 void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty le) 329 void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty le)
330 { 330 {
331 RenderBox::styleDidChange(diff, oldStyle); 331 RenderBox::styleDidChange(diff, oldStyle);
332 332
333 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating() && !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isRenderBlockFlow ())
334 toRenderBlock(parent())->removeAnonymousWrappersIfRequired();
335
336 RenderStyle* newStyle = style(); 333 RenderStyle* newStyle = style();
337 334
338 if (!isAnonymousBlock()) { 335 if (!isAnonymousBlock()) {
339 // Ensure that all of our continuation blocks pick up the new style. 336 // Ensure that all of our continuation blocks pick up the new style.
340 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC ont = currCont->blockElementContinuation()) { 337 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC ont = currCont->blockElementContinuation()) {
341 RenderBoxModelObject* nextCont = currCont->continuation(); 338 RenderBoxModelObject* nextCont = currCont->continuation();
342 currCont->setContinuation(0); 339 currCont->setContinuation(0);
343 currCont->setStyle(newStyle); 340 currCont->setStyle(newStyle);
344 currCont->setContinuation(nextCont); 341 currCont->setContinuation(nextCont);
345 } 342 }
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 return false; 1077 return false;
1081 1078
1082 if (!prev || !next) 1079 if (!prev || !next)
1083 return true; 1080 return true;
1084 1081
1085 // Make sure the types of the anonymous blocks match up. 1082 // Make sure the types of the anonymous blocks match up.
1086 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() 1083 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock()
1087 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB lock(); 1084 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB lock();
1088 } 1085 }
1089 1086
1090 void RenderBlock::removeAnonymousWrappersIfRequired()
1091 {
1092 ASSERT(isRenderBlockFlow());
1093 Vector<RenderBox*, 16> blocksToRemove;
1094 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
1095 // There are still block children in the container, so any anonymous wra ppers are still needed.
1096 if (!child->isAnonymousBlock() && !child->isFloatingOrOutOfFlowPositione d())
1097 return;
1098 // We can't remove anonymous wrappers if they contain continuations as t his means there are block children present.
1099 if (child->isRenderBlock() && toRenderBlock(child)->continuation())
1100 return;
1101 if (child->isAnonymousBlock())
1102 blocksToRemove.append(child);
1103 }
1104
1105 for (size_t i = 0; i < blocksToRemove.size(); i++)
1106 collapseAnonymousBlockChild(this, toRenderBlock(blocksToRemove[i]));
1107 }
1108
1109 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) 1087 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child)
1110 { 1088 {
1111 // It's possible that this block's destruction may have been triggered by th e 1089 // It's possible that this block's destruction may have been triggered by th e
1112 // child's removal. Just bail if the anonymous child block is already being 1090 // child's removal. Just bail if the anonymous child block is already being
1113 // destroyed. See crbug.com/282088 1091 // destroyed. See crbug.com/282088
1114 if (child->beingDestroyed()) 1092 if (child->beingDestroyed())
1115 return; 1093 return;
1116 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 1094 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
1117 parent->setChildrenInline(child->childrenInline()); 1095 parent->setChildrenInline(child->childrenInline());
1118 RenderObject* nextSibling = child->nextSibling(); 1096 RenderObject* nextSibling = child->nextSibling();
(...skipping 3906 matching lines...) Expand 10 before | Expand all | Expand 10 after
5025 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5003 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5026 { 5004 {
5027 showRenderObject(); 5005 showRenderObject();
5028 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5006 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5029 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5007 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5030 } 5008 }
5031 5009
5032 #endif 5010 #endif
5033 5011
5034 } // namespace WebCore 5012 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698