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

Side by Side Diff: Source/core/layout/LayoutObject.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
« no previous file with comments | « Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 LayoutObject* ancestor = parent(); 858 LayoutObject* ancestor = parent();
859 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) { 859 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) {
860 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer) 860 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer)
861 *paintInvalidationContainerSkipped = true; 861 *paintInvalidationContainerSkipped = true;
862 } 862 }
863 863
864 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); 864 ASSERT(!ancestor || !ancestor->isAnonymousBlock());
865 return toLayoutBlock(ancestor); 865 return toLayoutBlock(ancestor);
866 } 866 }
867 867
868 LayoutBlock* LayoutObject::containerForAbsolutePosition() const
869 {
870 LayoutObject* o = parent();
871 while (o) {
872 if (o->style()->position() != StaticPosition && (!o->isInline() || o->is Replaced()))
873 break;
874
875 if (o->canContainFixedPositionObjects())
876 break;
877
878 o = o->parent();
879 }
880
881 if (o && !o->isLayoutBlock())
882 o = o->containingBlock();
883
884 while (o && o->isAnonymousBlock())
885 o = o->containingBlock();
886
887 if (!o || !o->isLayoutBlock())
888 return nullptr; // This can still happen in case of an orphaned tree
889
890 return toLayoutBlock(o);
891 }
892
868 LayoutBlock* LayoutObject::containingBlock() const 893 LayoutBlock* LayoutObject::containingBlock() const
869 { 894 {
870 LayoutObject* o = parent(); 895 LayoutObject* o = parent();
871 if (!o && isLayoutScrollbarPart()) 896 if (!o && isLayoutScrollbarPart())
872 o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar(); 897 o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar();
873 if (!isTextOrSVGChild() && m_style->position() == FixedPosition) 898 if (!isTextOrSVGChild() && m_style->position() == FixedPosition)
874 return containerForFixedPosition(); 899 return containerForFixedPosition();
875 if (!isTextOrSVGChild() && m_style->position() == AbsolutePosition) { 900 if (!isTextOrSVGChild() && m_style->position() == AbsolutePosition)
mstensho (USE GERRIT) 2015/07/06 09:46:24 Kind of silly to call isTextOrSVGChild() all day l
kojii 2015/07/07 08:40:38 Done.
876 while (o) { 901 return containerForAbsolutePosition();
mstensho (USE GERRIT) 2015/07/06 09:46:24 containingBlockForAbsolutePosition() is a better n
kojii 2015/07/07 08:40:38 Done.
877 if (o->style()->position() != StaticPosition && (!o->isInline() || o ->isReplaced())) 902 if (isColumnSpanAll()) {
878 break;
879
880 if (o->canContainFixedPositionObjects())
881 break;
882
883 o = o->parent();
884 }
885
886 if (o && !o->isLayoutBlock())
887 o = o->containingBlock();
888
889 while (o && o->isAnonymousBlock())
890 o = o->containingBlock();
891 } else if (isColumnSpanAll()) {
892 o = spannerPlaceholder()->containingBlock(); 903 o = spannerPlaceholder()->containingBlock();
893 } else { 904 } else {
894 while (o && ((o->isInline() && !o->isReplaced()) || !o->isLayoutBlock()) ) 905 while (o && ((o->isInline() && !o->isReplaced()) || !o->isLayoutBlock()) )
895 o = o->parent(); 906 o = o->parent();
896 } 907 }
897 908
898 if (!o || !o->isLayoutBlock()) 909 if (!o || !o->isLayoutBlock())
899 return nullptr; // This can still happen in case of an orphaned tree 910 return nullptr; // This can still happen in case of an orphaned tree
900 911
901 return toLayoutBlock(o); 912 return toLayoutBlock(o);
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after
3276 const blink::LayoutObject* root = object1; 3287 const blink::LayoutObject* root = object1;
3277 while (root->parent()) 3288 while (root->parent())
3278 root = root->parent(); 3289 root = root->parent();
3279 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3290 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3280 } else { 3291 } else {
3281 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3292 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3282 } 3293 }
3283 } 3294 }
3284 3295
3285 #endif 3296 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698