| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 LayoutBox::willBeDestroyed(); | 138 LayoutBox::willBeDestroyed(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new
Style) | 141 void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new
Style) |
| 142 { | 142 { |
| 143 const ComputedStyle* oldStyle = style(); | 143 const ComputedStyle* oldStyle = style(); |
| 144 | 144 |
| 145 setIsAtomicInlineLevel(newStyle.isDisplayInlineType()); | 145 setIsAtomicInlineLevel(newStyle.isDisplayInlineType()); |
| 146 | 146 |
| 147 if (oldStyle && parent()) { | 147 if (oldStyle && parent()) { |
| 148 bool oldHasTransformRelatedProperty = oldStyle->hasTransformRelatedPrope
rty(); | 148 bool oldStyleContainsFixedPosition = oldStyle->canContainFixedPositionOb
jects(); |
| 149 bool newHasTransformRelatedProperty = newStyle.hasTransformRelatedProper
ty(); | 149 bool oldStyleContainsAbsolutePosition = oldStyleContainsFixedPosition ||
oldStyle->canContainAbsolutePositionObjects(); |
| 150 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old
HasTransformRelatedProperty; | 150 bool newStyleContainsFixedPosition = newStyle.canContainFixedPositionObj
ects(); |
| 151 bool newStyleContainsAbsolutePosition = newStyleContainsFixedPosition ||
newStyle.canContainAbsolutePositionObjects(); |
| 151 | 152 |
| 152 if (oldStyleIsContainer && (newStyle.position() == StaticPosition || (ol
dHasTransformRelatedProperty && !newHasTransformRelatedProperty))) { | 153 if ((oldStyleContainsFixedPosition && !newStyleContainsFixedPosition) |
| 154 || (oldStyleContainsAbsolutePosition && !newStyleContainsAbsolutePos
ition)) { |
| 153 // Clear our positioned objects list. Our absolute and fixed positio
ned descendants will be | 155 // Clear our positioned objects list. Our absolute and fixed positio
ned descendants will be |
| 154 // inserted into our containing block's positioned objects list duri
ng layout. | 156 // inserted into our containing block's positioned objects list duri
ng layout. |
| 155 removePositionedObjects(nullptr, NewContainingBlock); | 157 removePositionedObjects(nullptr, NewContainingBlock); |
| 156 } else if (!oldStyleIsContainer && (newStyle.position() != StaticPositio
n || newHasTransformRelatedProperty)) { | 158 } |
| 159 if (!oldStyleContainsAbsolutePosition && newStyleContainsAbsolutePositio
n) { |
| 157 // Remove our absolutely positioned descendants from their current c
ontaining block. | 160 // Remove our absolutely positioned descendants from their current c
ontaining block. |
| 158 // They will be inserted into our positioned objects list during lay
out. | 161 // They will be inserted into our positioned objects list during lay
out. |
| 159 if (LayoutBlock* cb = containingBlockForAbsolutePosition()) | 162 if (LayoutBlock* cb = containingBlockForAbsolutePosition()) |
| 160 cb->removePositionedObjects(this, NewContainingBlock); | 163 cb->removePositionedObjects(this, NewContainingBlock); |
| 161 } | 164 } |
| 162 if (!oldHasTransformRelatedProperty && newHasTransformRelatedProperty) { | 165 if (!oldStyleContainsFixedPosition && newStyleContainsFixedPosition) { |
| 163 // Remove our fixed positioned descendants from their current contai
ning block. | 166 // Remove our fixed positioned descendants from their current contai
ning block. |
| 164 // They will be inserted into our positioned objects list during lay
out. | 167 // They will be inserted into our positioned objects list during lay
out. |
| 165 if (LayoutBlock* cb = containerForFixedPosition()) | 168 if (LayoutBlock* cb = containerForFixedPosition()) |
| 166 cb->removePositionedObjects(this, NewContainingBlock); | 169 cb->removePositionedObjects(this, NewContainingBlock); |
| 167 } | 170 } |
| 168 } | 171 } |
| 169 | 172 |
| 170 LayoutBox::styleWillChange(diff, newStyle); | 173 LayoutBox::styleWillChange(diff, newStyle); |
| 171 } | 174 } |
| 172 | 175 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 187 } | 190 } |
| 188 | 191 |
| 189 void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
tyle) | 192 void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
tyle) |
| 190 { | 193 { |
| 191 LayoutBox::styleDidChange(diff, oldStyle); | 194 LayoutBox::styleDidChange(diff, oldStyle); |
| 192 | 195 |
| 193 const ComputedStyle& newStyle = styleRef(); | 196 const ComputedStyle& newStyle = styleRef(); |
| 194 | 197 |
| 195 if (oldStyle && parent()) { | 198 if (oldStyle && parent()) { |
| 196 if (oldStyle->position() != newStyle.position() && newStyle.position() !
= StaticPosition) { | 199 if (oldStyle->position() != newStyle.position() && newStyle.position() !
= StaticPosition) { |
| 197 // Remove our absolute and fixed positioned descendants from their n
ew containing block, | 200 // In LayoutObject::styleWillChange() we already removed ourself fro
m our old containing |
| 198 // in case containingBlock() changes by the change to the position p
roperty. | 201 // block's positioned descendant list, and we will be inserted to th
e new containing |
| 199 // See styleWillChange() for other cases. | 202 // block's list during layout. However the positioned descendant lay
out logic assumes |
| 203 // layout objects to obey parent-child order in the list. Remove our
descendants here |
| 204 // so they will be re-inserted after us. |
| 200 if (LayoutBlock* cb = containingBlock()) | 205 if (LayoutBlock* cb = containingBlock()) |
| 201 cb->removePositionedObjects(this, NewContainingBlock); | 206 cb->removePositionedObjects(this, NewContainingBlock); |
| 202 } | 207 } |
| 203 } | 208 } |
| 204 | 209 |
| 205 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 210 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
| 206 textAutosizer->record(this); | 211 textAutosizer->record(this); |
| 207 | 212 |
| 208 propagateStyleToAnonymousChildren(); | 213 propagateStyleToAnonymousChildren(); |
| 209 | 214 |
| (...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { | 1848 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { |
| 1844 LayoutBox* currBox = *it; | 1849 LayoutBox* currBox = *it; |
| 1845 ASSERT(!currBox->needsLayout()); | 1850 ASSERT(!currBox->needsLayout()); |
| 1846 } | 1851 } |
| 1847 } | 1852 } |
| 1848 } | 1853 } |
| 1849 | 1854 |
| 1850 #endif | 1855 #endif |
| 1851 | 1856 |
| 1852 } // namespace blink | 1857 } // namespace blink |
| OLD | NEW |