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

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

Issue 1007623003: Fix incorrect percentage top for positioned elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments Created 5 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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 // 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, 1514 // 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,
1515 // 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 1515 // 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
1516 // 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 1516 // 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
1517 // 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 1517 // 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
1518 // "consumed" by the float. Negative margins aren't consumed by the float, a nd so we ignore them. 1518 // "consumed" by the float. Negative margins aren't consumed by the float, a nd so we ignore them.
1519 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine); 1519 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine);
1520 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine); 1520 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine);
1521 return width; 1521 return width;
1522 } 1522 }
1523 1523
1524 LayoutUnit LayoutBox::containingBlockLogicalHeightForComputedStyle() const
1525 {
1526 if (hasOverrideContainingBlockLogicalHeight())
1527 return overrideContainingBlockContentLogicalHeight();
1528
1529 LayoutUnit height;
1530 if (isPositioned()) {
1531 LayoutBoxModelObject* cb = toLayoutBoxModelObject(container());
1532 height = containingBlockLogicalHeightForPositioned(cb);
1533 if (styleRef().position() != AbsolutePosition)
1534 height -= cb->paddingLogicalHeight();
1535 } else {
1536 height = containingBlockLogicalHeightForContent(ExcludeMarginBorderPaddi ng);
mstensho (USE GERRIT) 2015/04/13 21:40:04 Blink coding style prefers early returns. You coul
changseok 2015/04/14 06:27:21 Done.
1537 }
1538
1539 return height;
1540 }
1541
1524 LayoutUnit LayoutBox::containingBlockLogicalWidthForContent() const 1542 LayoutUnit LayoutBox::containingBlockLogicalWidthForContent() const
1525 { 1543 {
1526 if (hasOverrideContainingBlockLogicalWidth()) 1544 if (hasOverrideContainingBlockLogicalWidth())
1527 return overrideContainingBlockContentLogicalWidth(); 1545 return overrideContainingBlockContentLogicalWidth();
1528 1546
1529 LayoutBlock* cb = containingBlock(); 1547 LayoutBlock* cb = containingBlock();
1530 return cb->availableLogicalWidth(); 1548 return cb->availableLogicalWidth();
1531 } 1549 }
1532 1550
1533 LayoutUnit LayoutBox::containingBlockLogicalHeightForContent(AvailableLogicalHei ghtType heightType) const 1551 LayoutUnit LayoutBox::containingBlockLogicalHeightForContent(AvailableLogicalHei ghtType heightType) const
(...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after
4641 computedValues.m_margins.m_end = marginEnd(); 4659 computedValues.m_margins.m_end = marginEnd();
4642 4660
4643 setLogicalTop(oldLogicalTop); 4661 setLogicalTop(oldLogicalTop);
4644 setLogicalWidth(oldLogicalWidth); 4662 setLogicalWidth(oldLogicalWidth);
4645 setLogicalLeft(oldLogicalLeft); 4663 setLogicalLeft(oldLogicalLeft);
4646 setMarginLeft(oldMarginLeft); 4664 setMarginLeft(oldMarginLeft);
4647 setMarginRight(oldMarginRight); 4665 setMarginRight(oldMarginRight);
4648 } 4666 }
4649 4667
4650 } // namespace blink 4668 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698