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

Side by Side Diff: Source/core/layout/LayoutBlock.cpp

Issue 1218023004: Fix a regression when position:static with absolute child changed to relative (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add ASSERT(gPositionedContainerMap->get(o)->size() == 1) Created 5 years, 5 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
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 bool newHasTransformRelatedProperty = newStyle.hasTransformRelatedProper ty(); 280 bool newHasTransformRelatedProperty = newStyle.hasTransformRelatedProper ty();
281 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old HasTransformRelatedProperty; 281 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old HasTransformRelatedProperty;
282 282
283 if (oldStyleIsContainer && (newStyle.position() == StaticPosition || (ol dHasTransformRelatedProperty && !newHasTransformRelatedProperty))) { 283 if (oldStyleIsContainer && (newStyle.position() == StaticPosition || (ol dHasTransformRelatedProperty && !newHasTransformRelatedProperty))) {
284 // Clear our positioned objects list. Our absolutely positioned desc endants will be 284 // Clear our positioned objects list. Our absolutely positioned desc endants will be
285 // inserted into our containing block's positioned objects list duri ng layout. 285 // inserted into our containing block's positioned objects list duri ng layout.
286 removePositionedObjects(0, NewContainingBlock); 286 removePositionedObjects(0, NewContainingBlock);
287 } else if (!oldStyleIsContainer && (newStyle.position() != StaticPositio n || newHasTransformRelatedProperty)) { 287 } else if (!oldStyleIsContainer && (newStyle.position() != StaticPositio n || newHasTransformRelatedProperty)) {
288 // Remove our absolutely positioned descendants from their current c ontaining block. 288 // Remove our absolutely positioned descendants from their current c ontaining block.
289 // They will be inserted into our positioned objects list during lay out. 289 // They will be inserted into our positioned objects list during lay out.
290 if (LayoutBlock* cb = containingBlock()) 290 if (LayoutBlock* cb = containerForAbsolutePosition())
291 cb->removePositionedObjects(this, NewContainingBlock); 291 cb->removePositionedObjects(this, NewContainingBlock);
292 } 292 }
293 } 293 }
294 294
295 LayoutBox::styleWillChange(diff, newStyle); 295 LayoutBox::styleWillChange(diff, newStyle);
296 } 296 }
297 297
298 static bool borderOrPaddingLogicalWidthChanged(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle) 298 static bool borderOrPaddingLogicalWidthChanged(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle)
299 { 299 {
300 if (newStyle.isHorizontalWritingMode()) { 300 if (newStyle.isHorizontalWritingMode()) {
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 { 1505 {
1506 if (gPositionedDescendantsMap) 1506 if (gPositionedDescendantsMap)
1507 return gPositionedDescendantsMap->get(this); 1507 return gPositionedDescendantsMap->get(this);
1508 return nullptr; 1508 return nullptr;
1509 } 1509 }
1510 1510
1511 void LayoutBlock::insertPositionedObject(LayoutBox* o) 1511 void LayoutBlock::insertPositionedObject(LayoutBox* o)
1512 { 1512 {
1513 ASSERT(!isAnonymousBlock()); 1513 ASSERT(!isAnonymousBlock());
1514 insertIntoTrackedLayoutBoxMaps(o, gPositionedDescendantsMap, gPositionedCont ainerMap); 1514 insertIntoTrackedLayoutBoxMaps(o, gPositionedDescendantsMap, gPositionedCont ainerMap);
1515 ASSERT(gPositionedContainerMap->get(o)->size() == 1);
1515 } 1516 }
1516 1517
1517 void LayoutBlock::removePositionedObject(LayoutBox* o) 1518 void LayoutBlock::removePositionedObject(LayoutBox* o)
1518 { 1519 {
1519 removeFromTrackedLayoutBoxMaps(o, gPositionedDescendantsMap, gPositionedCont ainerMap); 1520 removeFromTrackedLayoutBoxMaps(o, gPositionedDescendantsMap, gPositionedCont ainerMap);
1520 } 1521 }
1521 1522
1522 void LayoutBlock::removePositionedObjects(LayoutBlock* o, ContainingBlockState c ontainingBlockState) 1523 void LayoutBlock::removePositionedObjects(LayoutBlock* o, ContainingBlockState c ontainingBlockState)
1523 { 1524 {
1524 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); 1525 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects();
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2935 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2936 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2936 { 2937 {
2937 showLayoutObject(); 2938 showLayoutObject();
2938 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2939 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2939 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2940 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2940 } 2941 }
2941 2942
2942 #endif 2943 #endif
2943 2944
2944 } // namespace blink 2945 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698