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

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

Issue 1876123002: Absolute positioned child with percent should include containing block padding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add commit message Created 4 years, 8 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
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 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 // We need to see if margins on either the start side or the end side can co ntain the floats in question. If they can, 1599 // We need to see if margins on either the start side or the end side can co ntain the floats in question. If they can,
1600 // then just using the line width is inaccurate. In the case where a float c ompletely fits, we don't need to use the line 1600 // then just using the line width is inaccurate. In the case where a float c ompletely fits, we don't need to use the line
1601 // offset at all, but can instead push all the way to the content edge of th e containing block. In the case where the float 1601 // offset at all, but can instead push all the way to the content edge of th e containing block. In the case where the float
1602 // doesn't fit, we can use the line offset, but we need to grow it by the ma rgin to reflect the fact that the margin was 1602 // doesn't fit, we can use the line offset, but we need to grow it by the ma rgin to reflect the fact that the margin was
1603 // "consumed" by the float. Negative margins aren't consumed by the float, a nd so we ignore them. 1603 // "consumed" by the float. Negative margins aren't consumed by the float, a nd so we ignore them.
1604 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine); 1604 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine);
1605 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine); 1605 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine);
1606 return width; 1606 return width;
1607 } 1607 }
1608 1608
1609 LayoutUnit LayoutBox::containingBlockLogicalWidthForGetComputedStyle() const
1610 {
1611 if (hasOverrideContainingBlockLogicalWidth())
1612 return overrideContainingBlockContentLogicalWidth();
1613
1614 if (!isPositioned())
1615 return containingBlockLogicalWidthForContent();
1616
1617 LayoutBoxModelObject* cb = toLayoutBoxModelObject(container());
esprehn 2016/04/14 18:43:09 why is container correct vs containingBlock?
Deokjin Kim 2016/04/20 13:42:09 I think this issue is caused by the difference bet
1618 LayoutUnit width = containingBlockLogicalWidthForPositioned(cb);
1619 if (styleRef().position() != AbsolutePosition)
1620 width -= cb->paddingLogicalWidth();
1621 return width;
1622 }
1623
1609 LayoutUnit LayoutBox::containingBlockLogicalHeightForGetComputedStyle() const 1624 LayoutUnit LayoutBox::containingBlockLogicalHeightForGetComputedStyle() const
1610 { 1625 {
1611 if (hasOverrideContainingBlockLogicalHeight()) 1626 if (hasOverrideContainingBlockLogicalHeight())
1612 return overrideContainingBlockContentLogicalHeight(); 1627 return overrideContainingBlockContentLogicalHeight();
1613 1628
1614 if (!isPositioned()) 1629 if (!isPositioned())
1615 return containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding ); 1630 return containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding );
1616 1631
1617 LayoutBoxModelObject* cb = toLayoutBoxModelObject(container()); 1632 LayoutBoxModelObject* cb = toLayoutBoxModelObject(container());
1618 LayoutUnit height = containingBlockLogicalHeightForPositioned(cb); 1633 LayoutUnit height = containingBlockLogicalHeightForPositioned(cb);
(...skipping 3118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4737 4752
4738 void LayoutBox::clearPercentHeightDescendants() 4753 void LayoutBox::clearPercentHeightDescendants()
4739 { 4754 {
4740 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4755 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4741 if (curr->isBox()) 4756 if (curr->isBox())
4742 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4757 toLayoutBox(curr)->removeFromPercentHeightContainer();
4743 } 4758 }
4744 } 4759 }
4745 4760
4746 } // namespace blink 4761 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698