OLD | NEW |
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 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb); | 1885 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb); |
1886 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); | 1886 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); |
1887 } | 1887 } |
1888 | 1888 |
1889 // Margin calculations. | 1889 // Margin calculations. |
1890 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, | 1890 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, |
1891 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE
nd()); | 1891 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE
nd()); |
1892 | 1892 |
1893 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo
gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp
utedValues.m_margins.m_end) | 1893 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo
gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp
utedValues.m_margins.m_end) |
1894 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated
() && !cb->isRenderGrid()) { | 1894 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated
() && !cb->isRenderGrid()) { |
1895 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent -
cb->marginStartForChild(this); | 1895 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent -
cb->marginStartForChild(*this); |
1896 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty
le()->isLeftToRightDirection(); | 1896 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty
le()->isLeftToRightDirection(); |
1897 if (hasInvertedDirection) | 1897 if (hasInvertedDirection) |
1898 computedValues.m_margins.m_start = newMargin; | 1898 computedValues.m_margins.m_start = newMargin; |
1899 else | 1899 else |
1900 computedValues.m_margins.m_end = newMargin; | 1900 computedValues.m_margins.m_end = newMargin; |
1901 } | 1901 } |
1902 | 1902 |
1903 if (styleToUse->textAutosizingMultiplier() != 1 && styleToUse->marginStart()
.type() == Fixed) { | 1903 if (styleToUse->textAutosizingMultiplier() != 1 && styleToUse->marginStart()
.type() == Fixed) { |
1904 Node* parentNode = generatingNode(); | 1904 Node* parentNode = generatingNode(); |
1905 if (parentNode && (isHTMLOListElement(*parentNode) || isHTMLUListElement
(*parentNode))) { | 1905 if (parentNode && (isHTMLOListElement(*parentNode) || isHTMLUListElement
(*parentNode))) { |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 | 2586 |
2587 void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containing
Block) | 2587 void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containing
Block) |
2588 { | 2588 { |
2589 LayoutUnit marginBefore; | 2589 LayoutUnit marginBefore; |
2590 LayoutUnit marginAfter; | 2590 LayoutUnit marginAfter; |
2591 computeMarginsForDirection(BlockDirection, containingBlock, containingBlockL
ogicalWidthForContent(), logicalHeight(), marginBefore, marginAfter, | 2591 computeMarginsForDirection(BlockDirection, containingBlock, containingBlockL
ogicalWidthForContent(), logicalHeight(), marginBefore, marginAfter, |
2592 style()->marginBeforeUsing(containingBlock->style()), | 2592 style()->marginBeforeUsing(containingBlock->style()), |
2593 style()->marginAfterUsing(containingBlock->style())); | 2593 style()->marginAfterUsing(containingBlock->style())); |
2594 // Note that in this 'positioning phase' of the layout we are using the cont
aining block's writing mode rather than our own when calculating margins. | 2594 // Note that in this 'positioning phase' of the layout we are using the cont
aining block's writing mode rather than our own when calculating margins. |
2595 // See http://www.w3.org/TR/2014/CR-css-writing-modes-3-20140320/#orthogonal
-flows | 2595 // See http://www.w3.org/TR/2014/CR-css-writing-modes-3-20140320/#orthogonal
-flows |
2596 containingBlock->setMarginBeforeForChild(this, marginBefore); | 2596 containingBlock->setMarginBeforeForChild(*this, marginBefore); |
2597 containingBlock->setMarginAfterForChild(this, marginAfter); | 2597 containingBlock->setMarginAfterForChild(*this, marginAfter); |
2598 } | 2598 } |
2599 | 2599 |
2600 LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo
delObject* containingBlock, bool checkForPerpendicularWritingMode) const | 2600 LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo
delObject* containingBlock, bool checkForPerpendicularWritingMode) const |
2601 { | 2601 { |
2602 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting
Mode() != isHorizontalWritingMode()) | 2602 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting
Mode() != isHorizontalWritingMode()) |
2603 return containingBlockLogicalHeightForPositioned(containingBlock, false)
; | 2603 return containingBlockLogicalHeightForPositioned(containingBlock, false)
; |
2604 | 2604 |
2605 // Use viewport as container for top-level fixed-position elements. | 2605 // Use viewport as container for top-level fixed-position elements. |
2606 if (style()->position() == FixedPosition && containingBlock->isRenderView())
{ | 2606 if (style()->position() == FixedPosition && containingBlock->isRenderView())
{ |
2607 const RenderView* view = toRenderView(containingBlock); | 2607 const RenderView* view = toRenderView(containingBlock); |
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4434 | 4434 |
4435 setLogicalTop(oldLogicalTop); | 4435 setLogicalTop(oldLogicalTop); |
4436 setLogicalWidth(oldLogicalWidth); | 4436 setLogicalWidth(oldLogicalWidth); |
4437 setMarginLeft(oldMarginLeft); | 4437 setMarginLeft(oldMarginLeft); |
4438 setMarginRight(oldMarginRight); | 4438 setMarginRight(oldMarginRight); |
4439 | 4439 |
4440 return borderBox; | 4440 return borderBox; |
4441 } | 4441 } |
4442 | 4442 |
4443 } // namespace blink | 4443 } // namespace blink |
OLD | NEW |