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 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 static TrackedContainerMap* gPercentHeightContainerMap = 0; | 103 static TrackedContainerMap* gPercentHeightContainerMap = 0; |
104 | 104 |
105 typedef WTF::HashMap<RenderBlock*, OwnPtr<ListHashSet<RenderInline*> > > Continu ationOutlineTableMap; | 105 typedef WTF::HashMap<RenderBlock*, OwnPtr<ListHashSet<RenderInline*> > > Continu ationOutlineTableMap; |
106 | 106 |
107 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; | 107 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; |
108 static int gDelayUpdateScrollInfo = 0; | 108 static int gDelayUpdateScrollInfo = 0; |
109 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; | 109 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; |
110 | 110 |
111 static bool gColumnFlowSplitEnabled = true; | 111 static bool gColumnFlowSplitEnabled = true; |
112 | 112 |
113 static bool s_noLongerAffectsParentBlock = false; | |
esprehn
2014/05/06 18:55:44
This should be a member of RenderBlock like the ot
| |
114 | |
113 // This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code | 115 // This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code |
114 // only works on RenderBlocks. If this changes, this class should be shared with other RenderBoxes. | 116 // only works on RenderBlocks. If this changes, this class should be shared with other RenderBoxes. |
115 class OverflowEventDispatcher { | 117 class OverflowEventDispatcher { |
116 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); | 118 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); |
117 public: | 119 public: |
118 OverflowEventDispatcher(const RenderBlock* block) | 120 OverflowEventDispatcher(const RenderBlock* block) |
119 : m_block(block) | 121 : m_block(block) |
120 , m_hadHorizontalLayoutOverflow(false) | 122 , m_hadHorizontalLayoutOverflow(false) |
121 , m_hadVerticalLayoutOverflow(false) | 123 , m_hadVerticalLayoutOverflow(false) |
122 { | 124 { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 break; | 303 break; |
302 } | 304 } |
303 cb = cb->parent(); | 305 cb = cb->parent(); |
304 } | 306 } |
305 | 307 |
306 if (cb->isRenderBlock()) | 308 if (cb->isRenderBlock()) |
307 toRenderBlock(cb)->removePositionedObjects(this, NewContainingBl ock); | 309 toRenderBlock(cb)->removePositionedObjects(this, NewContainingBl ock); |
308 } | 310 } |
309 } | 311 } |
310 | 312 |
313 s_noLongerAffectsParentBlock = !isFloatingOrOutOfFlowPositioned() | |
Julien - ping for review
2014/05/07 01:38:46
RenderObject has a static boolean called s_affects
| |
314 && (newStyle.isFloating() || newStyle.hasOutOfFlowPosition()) | |
315 && parent() && parent()->isRenderBlockFlow(); | |
316 | |
311 RenderBox::styleWillChange(diff, newStyle); | 317 RenderBox::styleWillChange(diff, newStyle); |
312 } | 318 } |
313 | 319 |
314 static bool borderOrPaddingLogicalWidthChanged(const RenderStyle* oldStyle, cons t RenderStyle* newStyle) | 320 static bool borderOrPaddingLogicalWidthChanged(const RenderStyle* oldStyle, cons t RenderStyle* newStyle) |
315 { | 321 { |
316 if (newStyle->isHorizontalWritingMode()) | 322 if (newStyle->isHorizontalWritingMode()) |
317 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() | 323 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() |
318 || oldStyle->borderRightWidth() != newStyle->borderRightWidth() | 324 || oldStyle->borderRightWidth() != newStyle->borderRightWidth() |
319 || oldStyle->paddingLeft() != newStyle->paddingLeft() | 325 || oldStyle->paddingLeft() != newStyle->paddingLeft() |
320 || oldStyle->paddingRight() != newStyle->paddingRight(); | 326 || oldStyle->paddingRight() != newStyle->paddingRight(); |
321 | 327 |
322 return oldStyle->borderTopWidth() != newStyle->borderTopWidth() | 328 return oldStyle->borderTopWidth() != newStyle->borderTopWidth() |
323 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth() | 329 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth() |
324 || oldStyle->paddingTop() != newStyle->paddingTop() | 330 || oldStyle->paddingTop() != newStyle->paddingTop() |
325 || oldStyle->paddingBottom() != newStyle->paddingBottom(); | 331 || oldStyle->paddingBottom() != newStyle->paddingBottom(); |
326 } | 332 } |
327 | 333 |
328 void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty le) | 334 void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty le) |
329 { | 335 { |
330 RenderBox::styleDidChange(diff, oldStyle); | 336 RenderBox::styleDidChange(diff, oldStyle); |
331 | 337 |
338 if (s_noLongerAffectsParentBlock) | |
ojan
2014/05/06 18:43:02
Why do you need the static? Can't you do the check
| |
339 toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); | |
340 | |
332 RenderStyle* newStyle = style(); | 341 RenderStyle* newStyle = style(); |
333 | 342 |
334 if (!isAnonymousBlock()) { | 343 if (!isAnonymousBlock()) { |
335 // Ensure that all of our continuation blocks pick up the new style. | 344 // Ensure that all of our continuation blocks pick up the new style. |
336 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC ont = currCont->blockElementContinuation()) { | 345 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC ont = currCont->blockElementContinuation()) { |
337 RenderBoxModelObject* nextCont = currCont->continuation(); | 346 RenderBoxModelObject* nextCont = currCont->continuation(); |
338 currCont->setContinuation(0); | 347 currCont->setContinuation(0); |
339 currCont->setStyle(newStyle); | 348 currCont->setStyle(newStyle); |
340 currCont->setContinuation(nextCont); | 349 currCont->setContinuation(nextCont); |
341 } | 350 } |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1045 return false; | 1054 return false; |
1046 | 1055 |
1047 if (!prev || !next) | 1056 if (!prev || !next) |
1048 return true; | 1057 return true; |
1049 | 1058 |
1050 // Make sure the types of the anonymous blocks match up. | 1059 // Make sure the types of the anonymous blocks match up. |
1051 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() | 1060 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() |
1052 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB lock(); | 1061 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB lock(); |
1053 } | 1062 } |
1054 | 1063 |
1064 bool RenderBlock::canRemoveAnonymousWrappers() | |
1065 { | |
1066 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) { | |
Julien - ping for review
2014/05/07 01:38:46
You seem to care only about blocks so we should pr
| |
1067 if (!child->isAnonymousBlock() && !child->isFloatingOrOutOfFlowPositione d()) | |
1068 return false; | |
1069 if (child->isRenderBlock() && toRenderBlock(child)->continuation()) | |
1070 return false; | |
1071 } | |
1072 return true; | |
1073 } | |
1074 | |
1075 void RenderBlock::removeAnonymousWrappersIfRequired() | |
1076 { | |
1077 if (!canRemoveAnonymousWrappers()) | |
1078 return; | |
1079 | |
1080 RenderObject* child = firstChild(); | |
1081 while (child) { | |
Julien - ping for review
2014/05/07 01:38:46
Same comment about walking boxes (ideally blocks b
| |
1082 RenderObject* next = child->nextSibling(); | |
1083 if (child->isAnonymousBlock()) | |
1084 collapseAnonymousBlockChild(this, toRenderBlock(child)); | |
1085 child = next; | |
Julien - ping for review
2014/05/07 01:38:46
I would put a comment here as this is important:
| |
1086 } | |
1087 } | |
1088 | |
1055 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) | 1089 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock* child) |
1056 { | 1090 { |
1057 // It's possible that this block's destruction may have been triggered by th e | 1091 // It's possible that this block's destruction may have been triggered by th e |
1058 // child's removal. Just bail if the anonymous child block is already being | 1092 // child's removal. Just bail if the anonymous child block is already being |
1059 // destroyed. See crbug.com/282088 | 1093 // destroyed. See crbug.com/282088 |
1060 if (child->beingDestroyed()) | 1094 if (child->beingDestroyed()) |
1061 return; | 1095 return; |
1062 parent->setNeedsLayoutAndPrefWidthsRecalc(); | 1096 parent->setNeedsLayoutAndPrefWidthsRecalc(); |
1063 parent->setChildrenInline(child->childrenInline()); | 1097 parent->setChildrenInline(child->childrenInline()); |
1064 RenderObject* nextSibling = child->nextSibling(); | 1098 RenderObject* nextSibling = child->nextSibling(); |
(...skipping 3955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5020 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 5054 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
5021 { | 5055 { |
5022 showRenderObject(); | 5056 showRenderObject(); |
5023 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 5057 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
5024 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 5058 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
5025 } | 5059 } |
5026 | 5060 |
5027 #endif | 5061 #endif |
5028 | 5062 |
5029 } // namespace WebCore | 5063 } // namespace WebCore |
OLD | NEW |