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

Side by Side Diff: Source/WebCore/rendering/RenderObject.cpp

Issue 10763003: Merge 120761 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 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 | « LayoutTests/fast/block/positioning/insert-positioned-in-anonymous-crash-expected.txt ('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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 ASSERT(hasLayer()); 717 ASSERT(hasLayer());
718 toRenderBoxModelObject(this)->layer()->setRepaintStatus(NeedsFullRepaintForP ositionedMovementLayout); 718 toRenderBoxModelObject(this)->layer()->setRepaintStatus(NeedsFullRepaintForP ositionedMovementLayout);
719 } 719 }
720 720
721 RenderBlock* RenderObject::containingBlock() const 721 RenderBlock* RenderObject::containingBlock() const
722 { 722 {
723 RenderObject* o = parent(); 723 RenderObject* o = parent();
724 if (!o && isRenderScrollbarPart()) 724 if (!o && isRenderScrollbarPart())
725 o = toRenderScrollbarPart(this)->rendererOwningScrollbar(); 725 o = toRenderScrollbarPart(this)->rendererOwningScrollbar();
726 if (!isText() && m_style->position() == FixedPosition) { 726 if (!isText() && m_style->position() == FixedPosition) {
727 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc k())) { 727 while (o) {
728 if (o->isRenderView())
729 break;
730 if (o->hasTransform() && o->isRenderBlock())
731 break;
728 #if ENABLE(SVG) 732 #if ENABLE(SVG)
729 // foreignObject is the containing block for its contents. 733 // foreignObject is the containing block for its contents.
730 if (o->isSVGForeignObject()) 734 if (o->isSVGForeignObject())
731 break; 735 break;
732 #endif 736 #endif
733 o = o->parent(); 737 o = o->parent();
734 } 738 }
739 ASSERT(!o->isAnonymousBlock());
735 } else if (!isText() && m_style->position() == AbsolutePosition) { 740 } else if (!isText() && m_style->position() == AbsolutePosition) {
736 while (o && (o->style()->position() == StaticPosition || (o->isInline() && !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende rBlock())) { 741 while (o) {
737 // For relpositioned inlines, we return the nearest non-anonymous en closing block. We don't try 742 // For relpositioned inlines, we return the nearest non-anonymous en closing block. We don't try
738 // to return the inline itself. This allows us to avoid having a po sitioned objects 743 // to return the inline itself. This allows us to avoid having a po sitioned objects
739 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result 744 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result
740 // from this method. The container() method can actually be used to obtain the 745 // from this method. The container() method can actually be used to obtain the
741 // inline directly. 746 // inline directly.
747 if (!o->style()->position() == StaticPosition && !(o->isInline() && !o->isReplaced()))
748 break;
749 if (o->isRenderView())
750 break;
751 if (o->hasTransform() && o->isRenderBlock())
752 break;
753
742 if (o->style()->position() == RelativePosition && o->isInline() && ! o->isReplaced()) { 754 if (o->style()->position() == RelativePosition && o->isInline() && ! o->isReplaced()) {
743 RenderBlock* relPositionedInlineContainingBlock = o->containingB lock(); 755 o = o->containingBlock();
744 while (relPositionedInlineContainingBlock->isAnonymousBlock()) 756 break;
745 relPositionedInlineContainingBlock = relPositionedInlineCont ainingBlock->containingBlock();
746 return relPositionedInlineContainingBlock;
747 } 757 }
748 #if ENABLE(SVG) 758 #if ENABLE(SVG)
749 if (o->isSVGForeignObject()) //foreignObject is the containing block for contents inside it 759 if (o->isSVGForeignObject()) //foreignObject is the containing block for contents inside it
750 break; 760 break;
751 #endif 761 #endif
752 762
753 o = o->parent(); 763 o = o->parent();
754 } 764 }
765
766 while (o && o->isAnonymousBlock())
767 o = o->containingBlock();
755 } else { 768 } else {
756 while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock()) ) 769 while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock()) )
757 o = o->parent(); 770 o = o->parent();
758 } 771 }
759 772
760 if (!o || !o->isRenderBlock()) 773 if (!o || !o->isRenderBlock())
761 return 0; // This can still happen in case of an orphaned tree 774 return 0; // This can still happen in case of an orphaned tree
762 775
763 return toRenderBlock(o); 776 return toRenderBlock(o);
764 } 777 }
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2943 { 2956 {
2944 if (object1) { 2957 if (object1) {
2945 const WebCore::RenderObject* root = object1; 2958 const WebCore::RenderObject* root = object1;
2946 while (root->parent()) 2959 while (root->parent())
2947 root = root->parent(); 2960 root = root->parent();
2948 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 2961 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
2949 } 2962 }
2950 } 2963 }
2951 2964
2952 #endif 2965 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/block/positioning/insert-positioned-in-anonymous-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698