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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 222 |
| 223 LayoutBox::willBeDestroyed(); | 223 LayoutBox::willBeDestroyed(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new Style) | 226 void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new Style) |
| 227 { | 227 { |
| 228 const ComputedStyle* oldStyle = style(); | 228 const ComputedStyle* oldStyle = style(); |
| 229 | 229 |
| 230 setReplaced(newStyle.isDisplayInlineType()); | 230 setReplaced(newStyle.isDisplayInlineType()); |
| 231 | 231 |
| 232 if (oldStyle && parent()) { | 232 if (oldStyle && parent() && !isLayoutView()) { |
|
chrishtr
2015/10/30 18:28:18
Why this change?
Xianzhu
2015/10/30 19:15:28
Added this because I thought layout view never cha
| |
| 233 bool oldHasTransformRelatedProperty = oldStyle->hasTransformRelatedPrope rty(); | 233 bool oldHasTransformRelatedProperty = oldStyle->hasTransformRelatedPrope rty(); |
| 234 bool newHasTransformRelatedProperty = newStyle.hasTransformRelatedProper ty(); | 234 bool newHasTransformRelatedProperty = newStyle.hasTransformRelatedProper ty(); |
| 235 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old HasTransformRelatedProperty; | 235 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old HasTransformRelatedProperty; |
| 236 | 236 |
| 237 if (oldStyleIsContainer && (newStyle.position() == StaticPosition || (ol dHasTransformRelatedProperty && !newHasTransformRelatedProperty))) { | 237 if (oldStyleIsContainer && (newStyle.position() == StaticPosition || (ol dHasTransformRelatedProperty && !newHasTransformRelatedProperty))) { |
| 238 // Clear our positioned objects list. Our absolutely positioned desc endants will be | 238 // Clear our positioned objects list. Our absolute and fixed positio ned descendants will be |
| 239 // inserted into our containing block's positioned objects list duri ng layout. | 239 // inserted into our containing block's positioned objects list duri ng layout. |
| 240 removePositionedObjects(0, NewContainingBlock); | 240 removePositionedObjects(nullptr, NewContainingBlock); |
| 241 } else if (!oldStyleIsContainer && (newStyle.position() != StaticPositio n || newHasTransformRelatedProperty)) { | 241 } else if (!oldStyleIsContainer && (newStyle.position() != StaticPositio n || newHasTransformRelatedProperty)) { |
| 242 // Remove our absolutely positioned descendants from their current c ontaining block. | 242 // Remove our absolutely positioned descendants from their current c ontaining block. |
| 243 // They will be inserted into our positioned objects list during lay out. | 243 // They will be inserted into our positioned objects list during lay out. |
| 244 if (LayoutBlock* cb = containingBlockForAbsolutePosition()) | 244 if (LayoutBlock* cb = containingBlockForAbsolutePosition()) |
| 245 cb->removePositionedObjects(this, NewContainingBlock); | 245 cb->removePositionedObjects(this, NewContainingBlock); |
| 246 } | 246 } |
| 247 if (!oldHasTransformRelatedProperty && newHasTransformRelatedProperty) { | |
| 248 // Remove our fixed positioned descendants from their current contai ning block. | |
| 249 // They will be inserted into our positioned objects list during lay out. | |
| 250 if (LayoutBlock* cb = containerForFixedPosition()) | |
| 251 cb->removePositionedObjects(this, NewContainingBlock); | |
| 252 } | |
| 247 } | 253 } |
| 248 | 254 |
| 249 LayoutBox::styleWillChange(diff, newStyle); | 255 LayoutBox::styleWillChange(diff, newStyle); |
| 250 } | 256 } |
| 251 | 257 |
| 252 static bool borderOrPaddingLogicalWidthChanged(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle) | 258 static bool borderOrPaddingLogicalWidthChanged(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle) |
| 253 { | 259 { |
| 254 if (newStyle.isHorizontalWritingMode()) { | 260 if (newStyle.isHorizontalWritingMode()) { |
| 255 return oldStyle.borderLeftWidth() != newStyle.borderLeftWidth() | 261 return oldStyle.borderLeftWidth() != newStyle.borderLeftWidth() |
| 256 || oldStyle.borderRightWidth() != newStyle.borderRightWidth() | 262 || oldStyle.borderRightWidth() != newStyle.borderRightWidth() |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 274 if (previousSibling() && previousSibling()->isAnonymousBlock()) | 280 if (previousSibling() && previousSibling()->isAnonymousBlock()) |
| 275 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(previousSibling() ), this, nullptr, false); | 281 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(previousSibling() ), this, nullptr, false); |
| 276 else if (nextSibling() && nextSibling()->isAnonymousBlock()) | 282 else if (nextSibling() && nextSibling()->isAnonymousBlock()) |
| 277 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(nextSibling()), t his, nextSibling()->slowFirstChild(), false); | 283 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(nextSibling()), t his, nextSibling()->slowFirstChild(), false); |
| 278 } | 284 } |
| 279 | 285 |
| 280 const ComputedStyle& newStyle = styleRef(); | 286 const ComputedStyle& newStyle = styleRef(); |
| 281 | 287 |
| 282 if (oldStyle && parent()) { | 288 if (oldStyle && parent()) { |
| 283 if (oldStyle->position() != newStyle.position() && newStyle.position() ! = StaticPosition) { | 289 if (oldStyle->position() != newStyle.position() && newStyle.position() ! = StaticPosition) { |
| 284 // Remove our absolutely positioned descendants from their new conta ining block, | 290 // Remove our absolute and fixed positioned descendants from their n ew containing block, |
| 285 // in case containingBlock() changes by the change to the position p roperty. | 291 // in case containingBlock() changes by the change to the position p roperty. |
| 286 // See styleWillChange() for other cases. | 292 // See styleWillChange() for other cases. |
| 287 if (LayoutBlock* cb = containingBlock()) | 293 if (LayoutBlock* cb = containingBlock()) |
| 288 cb->removePositionedObjects(this, NewContainingBlock); | 294 cb->removePositionedObjects(this, NewContainingBlock); |
| 289 } | 295 } |
| 290 } | 296 } |
| 291 | 297 |
| 292 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 298 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
| 293 textAutosizer->record(this); | 299 textAutosizer->record(this); |
| 294 | 300 |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1459 } | 1465 } |
| 1460 | 1466 |
| 1461 void LayoutBlock::removePositionedObjects(LayoutBlock* o, ContainingBlockState c ontainingBlockState) | 1467 void LayoutBlock::removePositionedObjects(LayoutBlock* o, ContainingBlockState c ontainingBlockState) |
| 1462 { | 1468 { |
| 1463 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); | 1469 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); |
| 1464 if (!positionedDescendants) | 1470 if (!positionedDescendants) |
| 1465 return; | 1471 return; |
| 1466 | 1472 |
| 1467 Vector<LayoutBox*, 16> deadObjects; | 1473 Vector<LayoutBox*, 16> deadObjects; |
| 1468 for (auto* positionedObject : *positionedDescendants) { | 1474 for (auto* positionedObject : *positionedDescendants) { |
| 1469 if (!o || positionedObject->isDescendantOf(o)) { | 1475 if (!o || (positionedObject->isDescendantOf(o) && o != positionedObject) ) { |
| 1470 if (containingBlockState == NewContainingBlock) { | 1476 if (containingBlockState == NewContainingBlock) { |
| 1471 positionedObject->setChildNeedsLayout(MarkOnlyThis); | 1477 positionedObject->setChildNeedsLayout(MarkOnlyThis); |
| 1472 if (positionedObject->needsPreferredWidthsRecalculation()) | 1478 if (positionedObject->needsPreferredWidthsRecalculation()) |
| 1473 positionedObject->setPreferredLogicalWidthsDirty(MarkOnlyThi s); | 1479 positionedObject->setPreferredLogicalWidthsDirty(MarkOnlyThi s); |
| 1480 | |
| 1481 // The positioned object changing containing block may change pa int invalidation container. | |
| 1482 // Invalidate it (including non-compositing descendants) on its original paint invalidation container. | |
| 1483 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
| 1484 // This valid because we need to invalidate based on the cur rent status. | |
| 1485 DisableCompositingQueryAsserts compositingDisabler; | |
| 1486 if (!positionedObject->isPaintInvalidationContainer()) | |
| 1487 positionedObject->invalidatePaintIncludingNonCompositing Descendants(); | |
| 1488 } | |
| 1474 } | 1489 } |
| 1475 | 1490 |
| 1476 // It is parent blocks job to add positioned child to positioned obj ects list of its containing block | 1491 // It is parent blocks job to add positioned child to positioned obj ects list of its containing block |
| 1477 // Parent layout needs to be invalidated to ensure this happens. | 1492 // Parent layout needs to be invalidated to ensure this happens. |
| 1478 LayoutObject* p = positionedObject->parent(); | 1493 LayoutObject* p = positionedObject->parent(); |
| 1479 while (p && !p->isLayoutBlock()) | 1494 while (p && !p->isLayoutBlock()) |
| 1480 p = p->parent(); | 1495 p = p->parent(); |
| 1481 if (p) | 1496 if (p) |
| 1482 p->setChildNeedsLayout(); | 1497 p->setChildNeedsLayout(); |
| 1483 | 1498 |
| (...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2873 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const | 2888 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const |
| 2874 { | 2889 { |
| 2875 showLayoutObject(); | 2890 showLayoutObject(); |
| 2876 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 2891 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
| 2877 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 2892 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
| 2878 } | 2893 } |
| 2879 | 2894 |
| 2880 #endif | 2895 #endif |
| 2881 | 2896 |
| 2882 } // namespace blink | 2897 } // namespace blink |
| OLD | NEW |