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

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

Issue 9232034: Merge 104183 - Source/WebCore: Crash due to reparenting of relpositioned object under anonymous b... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 8 years, 11 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/WebCore/rendering/RenderBlock.cpp ('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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 } 710 }
711 711
712 RenderBlock* RenderObject::containingBlock() const 712 RenderBlock* RenderObject::containingBlock() const
713 { 713 {
714 RenderObject* o = parent(); 714 RenderObject* o = parent();
715 if (!isText() && m_style->position() == FixedPosition) { 715 if (!isText() && m_style->position() == FixedPosition) {
716 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc k())) 716 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc k()))
717 o = o->parent(); 717 o = o->parent();
718 } else if (!isText() && m_style->position() == AbsolutePosition) { 718 } else if (!isText() && m_style->position() == AbsolutePosition) {
719 while (o && (o->style()->position() == StaticPosition || (o->isInline() && !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende rBlock())) { 719 while (o && (o->style()->position() == StaticPosition || (o->isInline() && !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende rBlock())) {
720 // For relpositioned inlines, we return the nearest enclosing block. We don't try 720 // For relpositioned inlines, we return the nearest non-anonymous en closing block. We don't try
721 // to return the inline itself. This allows us to avoid having a po sitioned objects 721 // to return the inline itself. This allows us to avoid having a po sitioned objects
722 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result 722 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result
723 // from this method. The container() method can actually be used to obtain the 723 // from this method. The container() method can actually be used to obtain the
724 // inline directly. 724 // inline directly.
725 if (o->style()->position() == RelativePosition && o->isInline() && ! o->isReplaced()) 725 if (o->style()->position() == RelativePosition && o->isInline() && ! o->isReplaced()) {
726 return o->containingBlock(); 726 RenderBlock* relPositionedInlineContainingBlock = o->containingB lock();
727 while (relPositionedInlineContainingBlock->isAnonymousBlock())
728 relPositionedInlineContainingBlock = relPositionedInlineCont ainingBlock->containingBlock();
729 return relPositionedInlineContainingBlock;
730 }
727 #if ENABLE(SVG) 731 #if ENABLE(SVG)
728 if (o->isSVGForeignObject()) //foreignObject is the containing block for contents inside it 732 if (o->isSVGForeignObject()) //foreignObject is the containing block for contents inside it
729 break; 733 break;
730 #endif 734 #endif
731 735
732 o = o->parent(); 736 o = o->parent();
733 } 737 }
734 } else { 738 } else {
735 while (o && ((o->isInline() && !o->isReplaced()) || o->isTableRow() || o ->isTableSection() 739 while (o && ((o->isInline() && !o->isReplaced()) || o->isTableRow() || o ->isTableSection()
736 || o->isTableCol() || o->isFrameSet() || o->isMedia() 740 || o->isTableCol() || o->isFrameSet() || o->isMedia()
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 { 2797 {
2794 if (object1) { 2798 if (object1) {
2795 const WebCore::RenderObject* root = object1; 2799 const WebCore::RenderObject* root = object1;
2796 while (root->parent()) 2800 while (root->parent())
2797 root = root->parent(); 2801 root = root->parent();
2798 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 2802 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
2799 } 2803 }
2800 } 2804 }
2801 2805
2802 #endif 2806 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698