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

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

Issue 1182133002: Remove unneeded loop from LayoutObject::containingBlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 871
872 LayoutBlock* LayoutObject::containingBlock() const 872 LayoutBlock* LayoutObject::containingBlock() const
873 { 873 {
874 LayoutObject* o = parent(); 874 LayoutObject* o = parent();
875 if (!o && isLayoutScrollbarPart()) 875 if (!o && isLayoutScrollbarPart())
876 o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar(); 876 o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar();
877 if (!isTextOrSVGChild() && m_style->position() == FixedPosition) 877 if (!isTextOrSVGChild() && m_style->position() == FixedPosition)
878 return containerForFixedPosition(); 878 return containerForFixedPosition();
879 if (!isTextOrSVGChild() && m_style->position() == AbsolutePosition) { 879 if (!isTextOrSVGChild() && m_style->position() == AbsolutePosition) {
880 while (o) { 880 while (o) {
881 // For relpositioned inlines, we return the nearest non-anonymous en closing block. We don't try
882 // to return the inline itself. This allows us to avoid having a po sitioned objects
883 // list in all LayoutInlines and lets us return a strongly-typed Lay outBlock* result
884 // from this method. The container() method can actually be used to obtain the
885 // inline directly.
886 if (o->style()->position() != StaticPosition && (!o->isInline() || o ->isReplaced())) 881 if (o->style()->position() != StaticPosition && (!o->isInline() || o ->isReplaced()))
887 break; 882 break;
888 883
889 if (o->canContainFixedPositionObjects()) 884 if (o->canContainFixedPositionObjects())
890 break; 885 break;
891 886
892 if (o->style()->hasInFlowPosition() && o->isInline() && !o->isReplac ed()) {
893 o = o->containingBlock();
894 break;
895 }
896
897 o = o->parent(); 887 o = o->parent();
898 } 888 }
899 889
900 if (o && !o->isLayoutBlock()) 890 if (o && !o->isLayoutBlock())
901 o = o->containingBlock(); 891 o = o->containingBlock();
902 892
903 while (o && o->isAnonymousBlock()) 893 while (o && o->isAnonymousBlock())
904 o = o->containingBlock(); 894 o = o->containingBlock();
905 } else if (isColumnSpanAll()) { 895 } else if (isColumnSpanAll()) {
906 o = spannerPlaceholder()->containingBlock(); 896 o = spannerPlaceholder()->containingBlock();
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
3309 const blink::LayoutObject* root = object1; 3299 const blink::LayoutObject* root = object1;
3310 while (root->parent()) 3300 while (root->parent())
3311 root = root->parent(); 3301 root = root->parent();
3312 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3302 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3313 } else { 3303 } else {
3314 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3304 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3315 } 3305 }
3316 } 3306 }
3317 3307
3318 #endif 3308 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698