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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1406953003: Compute positioned elements width correctly when it has anonymous ancestors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 5 years, 1 month 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after
2845 if (FrameView* frameView = view->frameView()) { 2845 if (FrameView* frameView = view->frameView()) {
2846 // Don't use visibleContentRect since the PaintLayer's size has not been set yet. 2846 // Don't use visibleContentRect since the PaintLayer's size has not been set yet.
2847 IntSize viewportSize = frameView->layoutViewportScrollableArea()->ex cludeScrollbars(frameView->frameRect().size()); 2847 IntSize viewportSize = frameView->layoutViewportScrollableArea()->ex cludeScrollbars(frameView->frameRect().size());
2848 return containingBlock->isHorizontalWritingMode() ? viewportSize.wid th() : viewportSize.height(); 2848 return containingBlock->isHorizontalWritingMode() ? viewportSize.wid th() : viewportSize.height();
2849 } 2849 }
2850 } 2850 }
2851 2851
2852 if (hasOverrideContainingBlockLogicalWidth()) 2852 if (hasOverrideContainingBlockLogicalWidth())
2853 return overrideContainingBlockContentLogicalWidth(); 2853 return overrideContainingBlockContentLogicalWidth();
2854 2854
2855 if (containingBlock->isBox()) 2855 // Ensure we compute our width based on the width of our rel-pos inline cont ainer rather than any anonymous block
2856 // created to manage a block-flow ancestor of ours in the rel-pos inline's i nline flow.
2857 if (containingBlock->isAnonymousBlock() && containingBlock->isRelPositioned( ))
2858 containingBlock = toLayoutBox(containingBlock)->continuation();
2859 else if (containingBlock->isBox())
2856 return std::max(LayoutUnit(), toLayoutBox(containingBlock)->clientLogica lWidth()); 2860 return std::max(LayoutUnit(), toLayoutBox(containingBlock)->clientLogica lWidth());
2857 2861
2858 ASSERT(containingBlock->isLayoutInline() && containingBlock->isInFlowPositio ned()); 2862 ASSERT(containingBlock->isLayoutInline() && containingBlock->isInFlowPositio ned());
2859 2863
2860 const LayoutInline* flow = toLayoutInline(containingBlock); 2864 const LayoutInline* flow = toLayoutInline(containingBlock);
2861 InlineFlowBox* first = flow->firstLineBox(); 2865 InlineFlowBox* first = flow->firstLineBox();
2862 InlineFlowBox* last = flow->lastLineBox(); 2866 InlineFlowBox* last = flow->lastLineBox();
2863 2867
2864 // If the containing block is empty, return a width of 0. 2868 // If the containing block is empty, return a width of 0.
2865 if (!first || !last) 2869 if (!first || !last)
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
4848 StyleImage* borderImage = style()->borderImage().image(); 4852 StyleImage* borderImage = style()->borderImage().image();
4849 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4853 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4850 } 4854 }
4851 4855
4852 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4856 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4853 { 4857 {
4854 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4858 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4855 } 4859 }
4856 4860
4857 } // namespace blink 4861 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/block/positioning/positioned-child-inside-relative-positioned-anonymous-block-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698