|
Lines 1712-1718
void RenderBox::computeLogicalWidthInRegion(RenderRegion* region, LayoutUnit off
a/Source/WebCore/rendering/RenderBox.cpp_sec1
|
| 1712 |
LayoutUnit containerLogicalWidthForAutoMargins = containerLogicalWidth; |
1712 |
LayoutUnit containerLogicalWidthForAutoMargins = containerLogicalWidth; |
| 1713 |
if (avoidsFloats() && cb->containsFloats()) |
1713 |
if (avoidsFloats() && cb->containsFloats()) |
| 1714 |
containerLogicalWidthForAutoMargins = containingBlockAvailableLineWidthInRegion(region, offsetFromLogicalTopOfFirstPage); |
1714 |
containerLogicalWidthForAutoMargins = containingBlockAvailableLineWidthInRegion(region, offsetFromLogicalTopOfFirstPage); |
| 1715 |
computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, logicalWidth()); |
1715 |
ComputedMarginValues marginValues; |
|
|
1716 |
computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, logicalWidth(), |
| 1717 |
cb->style()->isLeftToRightDirection() == style()->isLeftToRightDirection() ? marginValues.m_start : marginValues.m_end, |
| 1718 |
cb->style()->isLeftToRightDirection() == style()->isLeftToRightDirection() ? marginValues.m_end : marginValues.m_start); |
| 1719 |
setMarginStart(marginValues.m_start); |
| 1720 |
setMarginEnd(marginValues.m_end); |
| 1716 |
} |
1721 |
} |
| 1717 |
|
1722 |
|
| 1718 |
if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLogicalWidth != (logicalWidth() + marginStart() + marginEnd()) |
1723 |
if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLogicalWidth != (logicalWidth() + marginStart() + marginEnd()) |
|
Lines 1820-1826
bool RenderBox::sizesLogicalWidthToFitContent(SizeType widthType) const
a/Source/WebCore/rendering/RenderBox.cpp_sec2
|
| 1820 |
return false; |
1825 |
return false; |
| 1821 |
} |
1826 |
} |
| 1822 |
|
1827 |
|
| 1823 |
void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth) |
1828 |
void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd) const |
| 1824 |
{ |
1829 |
{ |
| 1825 |
const RenderStyle* containingBlockStyle = containingBlock->style(); |
1830 |
const RenderStyle* containingBlockStyle = containingBlock->style(); |
| 1826 |
Length marginStartLength = style()->marginStartUsing(containingBlockStyle); |
1831 |
Length marginStartLength = style()->marginStartUsing(containingBlockStyle); |
|
Lines 1829-1836
void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo
a/Source/WebCore/rendering/RenderBox.cpp_sec3
|
| 1829 |
|
1834 |
|
| 1830 |
if (isFloating() || isInline()) { |
1835 |
if (isFloating() || isInline()) { |
| 1831 |
// Inline blocks/tables and floats don't have their margins increased. |
1836 |
// Inline blocks/tables and floats don't have their margins increased. |
| 1832 |
containingBlock->setMarginStartForChild(this, minimumValueForLength(marginStartLength, containerWidth, renderView)); |
1837 |
marginStart = minimumValueForLength(marginStartLength, containerWidth, renderView); |
| 1833 |
containingBlock->setMarginEndForChild(this, minimumValueForLength(marginEndLength, containerWidth, renderView)); |
1838 |
marginEnd = minimumValueForLength(marginEndLength, containerWidth, renderView); |
| 1834 |
return; |
1839 |
return; |
| 1835 |
} |
1840 |
} |
| 1836 |
|
1841 |
|
|
Lines 1841-1855
void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo
a/Source/WebCore/rendering/RenderBox.cpp_sec4
|
| 1841 |
LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, containerWidth, renderView); |
1846 |
LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, containerWidth, renderView); |
| 1842 |
LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, containerWidth, renderView); |
1847 |
LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, containerWidth, renderView); |
| 1843 |
LayoutUnit centeredMarginBoxStart = max<LayoutUnit>(0, (containerWidth - childWidth - marginStartWidth - marginEndWidth) / 2); |
1848 |
LayoutUnit centeredMarginBoxStart = max<LayoutUnit>(0, (containerWidth - childWidth - marginStartWidth - marginEndWidth) / 2); |
| 1844 |
containingBlock->setMarginStartForChild(this, centeredMarginBoxStart + marginStartWidth); |
1849 |
marginStart = centeredMarginBoxStart + marginStartWidth; |
| 1845 |
containingBlock->setMarginEndForChild(this, containerWidth - childWidth - containingBlock->marginStartForChild(this) + marginEndWidth); |
1850 |
marginEnd = containerWidth - childWidth - marginStart + marginEndWidth; |
| 1846 |
return; |
1851 |
return; |
| 1847 |
} |
1852 |
} |
| 1848 |
|
1853 |
|
| 1849 |
// Case Two: The object is being pushed to the start of the containing block's available logical width. |
1854 |
// Case Two: The object is being pushed to the start of the containing block's available logical width. |
| 1850 |
if (marginEndLength.isAuto() && childWidth < containerWidth) { |
1855 |
if (marginEndLength.isAuto() && childWidth < containerWidth) { |
| 1851 |
containingBlock->setMarginStartForChild(this, valueForLength(marginStartLength, containerWidth, renderView)); |
1856 |
marginStart = valueForLength(marginStartLength, containerWidth, renderView); |
| 1852 |
containingBlock->setMarginEndForChild(this, containerWidth - childWidth - containingBlock->marginStartForChild(this)); |
1857 |
marginEnd = containerWidth - childWidth - marginStart; |
| 1853 |
return; |
1858 |
return; |
| 1854 |
} |
1859 |
} |
| 1855 |
|
1860 |
|
|
Lines 1857-1871
void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo
a/Source/WebCore/rendering/RenderBox.cpp_sec5
|
| 1857 |
bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT) |
1862 |
bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT) |
| 1858 |
|| (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT)); |
1863 |
|| (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT)); |
| 1859 |
if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) { |
1864 |
if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) { |
| 1860 |
containingBlock->setMarginEndForChild(this, valueForLength(marginEndLength, containerWidth, renderView)); |
1865 |
marginEnd = valueForLength(marginEndLength, containerWidth, renderView); |
| 1861 |
containingBlock->setMarginStartForChild(this, containerWidth - childWidth - containingBlock->marginEndForChild(this)); |
1866 |
marginStart = containerWidth - childWidth - marginEnd; |
| 1862 |
return; |
1867 |
return; |
| 1863 |
} |
1868 |
} |
| 1864 |
|
1869 |
|
| 1865 |
// Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3). In that case |
1870 |
// Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3). In that case |
| 1866 |
// auto margins will just turn into 0. |
1871 |
// auto margins will just turn into 0. |
| 1867 |
containingBlock->setMarginStartForChild(this, minimumValueForLength(marginStartLength, containerWidth, renderView)); |
1872 |
marginStart = minimumValueForLength(marginStartLength, containerWidth, renderView); |
| 1868 |
containingBlock->setMarginEndForChild(this, minimumValueForLength(marginEndLength, containerWidth, renderView)); |
1873 |
marginEnd = minimumValueForLength(marginEndLength, containerWidth, renderView); |
| 1869 |
} |
1874 |
} |
| 1870 |
|
1875 |
|
| 1871 |
RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags cacheFlag) const |
1876 |
RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags cacheFlag) const |
|
Lines 1953-1958
RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, Layout
a/Source/WebCore/rendering/RenderBox.cpp_sec6
|
| 1953 |
return new RenderBoxRegionInfo(logicalLeftOffset, logicalWidthInRegion, isShifted); |
1958 |
return new RenderBoxRegionInfo(logicalLeftOffset, logicalWidthInRegion, isShifted); |
| 1954 |
} |
1959 |
} |
| 1955 |
|
1960 |
|
|
|
1961 |
static bool shouldFlipBeforeAfterMargins(WritingMode containingBlock, WritingMode child) |
| 1962 |
{ |
| 1963 |
if ((containingBlock == TopToBottomWritingMode && child == LeftToRightWritingMode) |
| 1964 |
|| (containingBlock == BottomToTopWritingMode && child == LeftToRightWritingMode) |
| 1965 |
|| (containingBlock == RightToLeftWritingMode && child == TopToBottomWritingMode) |
| 1966 |
|| (containingBlock == LeftToRightWritingMode && child == TopToBottomWritingMode)) |
| 1967 |
return false; |
| 1968 |
if ((containingBlock == TopToBottomWritingMode && child == RightToLeftWritingMode) |
| 1969 |
|| (containingBlock == BottomToTopWritingMode && child == RightToLeftWritingMode) |
| 1970 |
|| (containingBlock == RightToLeftWritingMode && child == BottomToTopWritingMode) |
| 1971 |
|| (containingBlock == LeftToRightWritingMode && child == BottomToTopWritingMode)) |
| 1972 |
return true; |
| 1973 |
ASSERT_NOT_REACHED(); // Writing modes should be perpendicular. |
| 1974 |
return false; |
| 1975 |
} |
| 1976 |
|
| 1956 |
void RenderBox::computeLogicalHeight() |
1977 |
void RenderBox::computeLogicalHeight() |
| 1957 |
{ |
1978 |
{ |
| 1958 |
// Cell height is managed by the table and inline non-replaced elements do not support a height property. |
1979 |
// Cell height is managed by the table and inline non-replaced elements do not support a height property. |
|
Lines 1977-1984
void RenderBox::computeLogicalHeight()
a/Source/WebCore/rendering/RenderBox.cpp_sec7
|
| 1977 |
|
1998 |
|
| 1978 |
// For tables, calculate margins only. |
1999 |
// For tables, calculate margins only. |
| 1979 |
if (isTable()) { |
2000 |
if (isTable()) { |
| 1980 |
if (hasPerpendicularContainingBlock) |
2001 |
if (hasPerpendicularContainingBlock) { |
| 1981 |
computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), logicalHeight()); |
2002 |
ComputedMarginValues marginValues; |
|
|
2003 |
computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), logicalHeight(), |
| 2004 |
shouldFlipBeforeAfterMargins(cb->style()->writingMode(), style()->writingMode()) ? marginValues.m_after : marginValues.m_before, |
| 2005 |
shouldFlipBeforeAfterMargins(cb->style()->writingMode(), style()->writingMode()) ? marginValues.m_before : marginValues.m_after); |
| 2006 |
setMarginBefore(marginValues.m_before); |
| 2007 |
setMarginAfter(marginValues.m_after); |
| 2008 |
} |
| 1982 |
return; |
2009 |
return; |
| 1983 |
} |
2010 |
} |
| 1984 |
|
2011 |
|
|
Lines 2026-2033
void RenderBox::computeLogicalHeight()
a/Source/WebCore/rendering/RenderBox.cpp_sec8
|
| 2026 |
|
2053 |
|
| 2027 |
setLogicalHeight(heightResult); |
2054 |
setLogicalHeight(heightResult); |
| 2028 |
|
2055 |
|
| 2029 |
if (hasPerpendicularContainingBlock) |
2056 |
if (hasPerpendicularContainingBlock) { |
| 2030 |
computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), heightResult); |
2057 |
ComputedMarginValues marginValues; |
|
|
2058 |
computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), heightResult, |
| 2059 |
shouldFlipBeforeAfterMargins(cb->style()->writingMode(), style()->writingMode()) ? marginValues.m_after : marginValues.m_before, |
| 2060 |
shouldFlipBeforeAfterMargins(cb->style()->writingMode(), style()->writingMode()) ? marginValues.m_before : marginValues.m_after); |
| 2061 |
setMarginBefore(marginValues.m_before); |
| 2062 |
setMarginAfter(marginValues.m_after); |
| 2063 |
} |
| 2031 |
} |
2064 |
} |
| 2032 |
|
2065 |
|
| 2033 |
// WinIE quirk: The <html> block always fills the entire canvas in quirks mode. The <body> always fills the |
2066 |
// WinIE quirk: The <html> block always fills the entire canvas in quirks mode. The <body> always fills the |