Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 return oldStyle->borderTopWidth() != newStyle->borderTopWidth() | 324 return oldStyle->borderTopWidth() != newStyle->borderTopWidth() |
| 325 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth() | 325 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth() |
| 326 || oldStyle->paddingTop() != newStyle->paddingTop() | 326 || oldStyle->paddingTop() != newStyle->paddingTop() |
| 327 || oldStyle->paddingBottom() != newStyle->paddingBottom(); | 327 || oldStyle->paddingBottom() != newStyle->paddingBottom(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty le) | 330 void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty le) |
| 331 { | 331 { |
| 332 RenderBox::styleDidChange(diff, oldStyle); | 332 RenderBox::styleDidChange(diff, oldStyle); |
| 333 | 333 |
| 334 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating() && !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isRenderBlockFlow ()) | |
| 335 toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); | |
| 336 | |
| 334 RenderStyle* newStyle = style(); | 337 RenderStyle* newStyle = style(); |
| 335 | 338 |
| 336 if (!isAnonymousBlock()) { | 339 if (!isAnonymousBlock()) { |
| 337 // Ensure that all of our continuation blocks pick up the new style. | 340 // Ensure that all of our continuation blocks pick up the new style. |
| 338 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC ont = currCont->blockElementContinuation()) { | 341 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC ont = currCont->blockElementContinuation()) { |
| 339 RenderBoxModelObject* nextCont = currCont->continuation(); | 342 RenderBoxModelObject* nextCont = currCont->continuation(); |
| 340 currCont->setContinuation(0); | 343 currCont->setContinuation(0); |
| 341 currCont->setStyle(newStyle); | 344 currCont->setStyle(newStyle); |
| 342 currCont->setContinuation(nextCont); | 345 currCont->setContinuation(nextCont); |
| 343 } | 346 } |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1073 return false; | 1076 return false; |
| 1074 | 1077 |
| 1075 if (!prev || !next) | 1078 if (!prev || !next) |
| 1076 return true; | 1079 return true; |
| 1077 | 1080 |
| 1078 // Make sure the types of the anonymous blocks match up. | 1081 // Make sure the types of the anonymous blocks match up. |
| 1079 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() | 1082 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() |
| 1080 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB lock(); | 1083 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB lock(); |
| 1081 } | 1084 } |
| 1082 | 1085 |
| 1086 void RenderBlock::removeAnonymousWrappersIfRequired() | |
| 1087 { | |
| 1088 Vector<RenderBox*, 16> blocksToRemove; | |
|
esprehn
2014/05/27 21:44:43
I would ASSERT(isRenderBlockFlow()) here if you ex
| |
| 1089 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { | |
| 1090 // There are still block children in the container, so any anonymous wra ppers are still needed. | |
| 1091 if (!child->isAnonymousBlock() && !child->isFloatingOrOutOfFlowPositione d()) | |
| 1092 return; | |
| 1093 // We can't remove anonymous wrappers if they contain continuations as t his means there are block children present. | |
| 1094 if (child->isRenderBlock() && toRenderBlock(child)->continuation()) | |
| 1095 return; | |
| 1096 if (child->isAnonymousBlock()) | |
| 1097 blocksToRemove.append(child); | |
| 1098 } | |
| 1099 | |
| 1100 for (size_t i = 0; i < blocksToRemove.size(); i++) | |
| 1101 collapseAnonymousBlockChild(this, toRenderBlock(blocksToRemove[i])); | |
| 1102 } | |
| 1103 | |
| 1083 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) | 1104 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) |
| 1084 { | 1105 { |
| 1085 // It's possible that this block's destruction may have been triggered by th e | 1106 // It's possible that this block's destruction may have been triggered by th e |
| 1086 // child's removal. Just bail if the anonymous child block is already being | 1107 // child's removal. Just bail if the anonymous child block is already being |
| 1087 // destroyed. See crbug.com/282088 | 1108 // destroyed. See crbug.com/282088 |
| 1088 if (child->beingDestroyed()) | 1109 if (child->beingDestroyed()) |
| 1089 return; | 1110 return; |
| 1090 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); | 1111 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
| 1091 parent->setChildrenInline(child->childrenInline()); | 1112 parent->setChildrenInline(child->childrenInline()); |
| 1092 RenderObject* nextSibling = child->nextSibling(); | 1113 RenderObject* nextSibling = child->nextSibling(); |
| (...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5017 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 5038 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
| 5018 { | 5039 { |
| 5019 showRenderObject(); | 5040 showRenderObject(); |
| 5020 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 5041 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
| 5021 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 5042 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
| 5022 } | 5043 } |
| 5023 | 5044 |
| 5024 #endif | 5045 #endif |
| 5025 | 5046 |
| 5026 } // namespace WebCore | 5047 } // namespace WebCore |
| OLD | NEW |