| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 child = child->nextSibling(); | 200 child = child->nextSibling(); |
| 201 } | 201 } |
| 202 invalidateBackgroundObscurationStatus(); | 202 invalidateBackgroundObscurationStatus(); |
| 203 clearNeedsLayout(); | 203 clearNeedsLayout(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 // More IE extensions. clientWidth and clientHeight represent the interior of a
n object | 206 // More IE extensions. clientWidth and clientHeight represent the interior of a
n object |
| 207 // excluding border and scrollbar. | 207 // excluding border and scrollbar. |
| 208 LayoutUnit RenderBox::clientWidth() const | 208 LayoutUnit RenderBox::clientWidth() const |
| 209 { | 209 { |
| 210 return width() - borderLeft() - borderRight() - verticalScrollbarWidth(); | 210 return width() - borderLeft() - borderRight(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 LayoutUnit RenderBox::clientHeight() const | 213 LayoutUnit RenderBox::clientHeight() const |
| 214 { | 214 { |
| 215 return height() - borderTop() - borderBottom() - horizontalScrollbarHeight()
; | 215 return height() - borderTop() - borderBottom(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 int RenderBox::pixelSnappedClientWidth() const | 218 int RenderBox::pixelSnappedClientWidth() const |
| 219 { | 219 { |
| 220 return snapSizeToPixel(clientWidth(), x() + clientLeft()); | 220 return snapSizeToPixel(clientWidth(), x() + clientLeft()); |
| 221 } | 221 } |
| 222 | 222 |
| 223 int RenderBox::pixelSnappedClientHeight() const | 223 int RenderBox::pixelSnappedClientHeight() const |
| 224 { | 224 { |
| 225 return snapSizeToPixel(clientHeight(), y() + clientTop()); | 225 return snapSizeToPixel(clientHeight(), y() + clientTop()); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 LayoutPoint adjustedLayerOffset = layerOffset + locationOffset(); | 408 LayoutPoint adjustedLayerOffset = layerOffset + locationOffset(); |
| 409 RenderBoxModelObject::addLayerHitTestRects(layerRects, currentLayer, adjuste
dLayerOffset, containerRect); | 409 RenderBoxModelObject::addLayerHitTestRects(layerRects, currentLayer, adjuste
dLayerOffset, containerRect); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void RenderBox::computeSelfHitTestRects(Vector<LayoutRect>& rects, const LayoutP
oint& layerOffset) const | 412 void RenderBox::computeSelfHitTestRects(Vector<LayoutRect>& rects, const LayoutP
oint& layerOffset) const |
| 413 { | 413 { |
| 414 if (!size().isEmpty()) | 414 if (!size().isEmpty()) |
| 415 rects.append(LayoutRect(layerOffset, size())); | 415 rects.append(LayoutRect(layerOffset, size())); |
| 416 } | 416 } |
| 417 | 417 |
| 418 int RenderBox::verticalScrollbarWidth() const | |
| 419 { | |
| 420 if (!hasOverflowClip() || style()->overflowY() == OOVERLAY) | |
| 421 return 0; | |
| 422 | |
| 423 return layer()->scrollableArea()->verticalScrollbarWidth(); | |
| 424 } | |
| 425 | |
| 426 int RenderBox::horizontalScrollbarHeight() const | |
| 427 { | |
| 428 if (!hasOverflowClip() || style()->overflowX() == OOVERLAY) | |
| 429 return 0; | |
| 430 | |
| 431 return layer()->scrollableArea()->horizontalScrollbarHeight(); | |
| 432 } | |
| 433 | |
| 434 int RenderBox::instrinsicScrollbarLogicalWidth() const | |
| 435 { | |
| 436 if (!hasOverflowClip()) | |
| 437 return 0; | |
| 438 | |
| 439 if (style()->overflowY() == OSCROLL) { | |
| 440 ASSERT(layer()->scrollableArea() && layer()->scrollableArea()->hasVertic
alScrollbar()); | |
| 441 return verticalScrollbarWidth(); | |
| 442 } | |
| 443 | |
| 444 return 0; | |
| 445 } | |
| 446 | |
| 447 bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity,
float delta) | 418 bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity,
float delta) |
| 448 { | 419 { |
| 449 // Presumably the same issue as in setScrollTop. See crbug.com/343132. | 420 // Presumably the same issue as in setScrollTop. See crbug.com/343132. |
| 450 DisableCompositingQueryAsserts disabler; | 421 DisableCompositingQueryAsserts disabler; |
| 451 if (!layer() || !layer()->scrollableArea()) | 422 if (!layer() || !layer()->scrollableArea()) |
| 452 return false; | 423 return false; |
| 453 return layer()->scrollableArea()->scroll(direction, granularity, delta); | 424 return layer()->scrollableArea()->scroll(direction, granularity, delta); |
| 454 } | 425 } |
| 455 | 426 |
| 456 bool RenderBox::canBeScrolledAndHasScrollableArea() const | 427 bool RenderBox::canBeScrolledAndHasScrollableArea() const |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 if (originalPhase == PaintPhaseOutline) { | 1266 if (originalPhase == PaintPhaseOutline) { |
| 1296 paintInfo.phase = PaintPhaseSelfOutline; | 1267 paintInfo.phase = PaintPhaseSelfOutline; |
| 1297 paintObject(paintInfo, accumulatedOffset); | 1268 paintObject(paintInfo, accumulatedOffset); |
| 1298 paintInfo.phase = originalPhase; | 1269 paintInfo.phase = originalPhase; |
| 1299 } else if (originalPhase == PaintPhaseChildBlockBackground) | 1270 } else if (originalPhase == PaintPhaseChildBlockBackground) |
| 1300 paintInfo.phase = originalPhase; | 1271 paintInfo.phase = originalPhase; |
| 1301 } | 1272 } |
| 1302 | 1273 |
| 1303 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, OverlayScrol
lbarSizeRelevancy relevancy) | 1274 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, OverlayScrol
lbarSizeRelevancy relevancy) |
| 1304 { | 1275 { |
| 1305 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert
y | |
| 1306 // here. | |
| 1307 LayoutRect clipRect = borderBoxRect(); | 1276 LayoutRect clipRect = borderBoxRect(); |
| 1308 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(
), borderTop())); | 1277 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(
), borderTop())); |
| 1309 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
borderTop() + borderBottom())); | 1278 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
borderTop() + borderBottom())); |
| 1310 | |
| 1311 if (!hasOverflowClip()) | |
| 1312 return clipRect; | |
| 1313 | |
| 1314 // Subtract out scrollbars if we have them. | |
| 1315 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | |
| 1316 clipRect.move(layer()->scrollableArea()->verticalScrollbarWidth(relevanc
y), 0); | |
| 1317 clipRect.contract(layer()->scrollableArea()->verticalScrollbarWidth(relevanc
y), layer()->scrollableArea()->horizontalScrollbarHeight(relevancy)); | |
| 1318 | |
| 1319 return clipRect; | 1279 return clipRect; |
| 1320 } | 1280 } |
| 1321 | 1281 |
| 1322 LayoutRect RenderBox::clipRect(const LayoutPoint& location) | 1282 LayoutRect RenderBox::clipRect(const LayoutPoint& location) |
| 1323 { | 1283 { |
| 1324 LayoutRect borderBoxRect = this->borderBoxRect(); | 1284 LayoutRect borderBoxRect = this->borderBoxRect(); |
| 1325 LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, border
BoxRect.size()); | 1285 LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, border
BoxRect.size()); |
| 1326 | 1286 |
| 1327 if (!style()->clipLeft().isAuto()) { | 1287 if (!style()->clipLeft().isAuto()) { |
| 1328 LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width()
); | 1288 LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width()
); |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 } | 1901 } |
| 1942 | 1902 |
| 1943 computedValues.m_extent = heightResult; | 1903 computedValues.m_extent = heightResult; |
| 1944 computeMarginsForDirection(flowDirection, cb, containingBlockLogicalWidt
hForContent(), computedValues.m_extent, computedValues.m_margins.m_before, | 1904 computeMarginsForDirection(flowDirection, cb, containingBlockLogicalWidt
hForContent(), computedValues.m_extent, computedValues.m_margins.m_before, |
| 1945 computedValues.m_margins.m_after, style()->marginBefore(), style()->
marginAfter()); | 1905 computedValues.m_margins.m_after, style()->marginBefore(), style()->
marginAfter()); |
| 1946 } | 1906 } |
| 1947 } | 1907 } |
| 1948 | 1908 |
| 1949 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit
intrinsicContentHeight) const | 1909 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit
intrinsicContentHeight) const |
| 1950 { | 1910 { |
| 1951 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
ht, intrinsicContentHeight); | 1911 LayoutUnit logicalHeight = computeContentLogicalHeightUsing(height, intrinsi
cContentHeight); |
| 1952 if (logicalHeight != -1) | 1912 if (logicalHeight != -1) |
| 1953 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); | 1913 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); |
| 1954 return logicalHeight; | 1914 return logicalHeight; |
| 1955 } | 1915 } |
| 1956 | 1916 |
| 1957 LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height, LayoutUn
it intrinsicContentHeight) const | 1917 LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height, LayoutUn
it intrinsicContentHeight) const |
| 1958 { | 1918 { |
| 1959 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(height, intrinsicContentHeight); | 1919 LayoutUnit heightIncludingScrollbar = computeContentLogicalHeightUsing(heigh
t, intrinsicContentHeight); |
| 1960 if (heightIncludingScrollbar == -1) | 1920 if (heightIncludingScrollbar == -1) |
| 1961 return -1; | 1921 return -1; |
| 1962 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(hei
ghtIncludingScrollbar) - scrollbarLogicalHeight()); | 1922 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(hei
ghtIncludingScrollbar)); |
| 1963 } | 1923 } |
| 1964 | 1924 |
| 1965 LayoutUnit RenderBox::computeIntrinsicLogicalContentHeightUsing(const Length& lo
gicalHeightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPaddin
g) const | 1925 LayoutUnit RenderBox::computeIntrinsicLogicalContentHeightUsing(const Length& lo
gicalHeightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPaddin
g) const |
| 1966 { | 1926 { |
| 1967 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. | 1927 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. |
| 1968 // If that happens, this code will have to change. | 1928 // If that happens, this code will have to change. |
| 1969 if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent()
|| logicalHeightLength.isFitContent()) { | 1929 if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent()
|| logicalHeightLength.isFitContent()) { |
| 1970 if (isReplaced()) | 1930 if (isReplaced()) |
| 1971 return intrinsicSize().height(); | 1931 return intrinsicSize().height(); |
| 1972 if (m_intrinsicContentLogicalHeight != -1) | 1932 if (m_intrinsicContentLogicalHeight != -1) |
| 1973 return m_intrinsicContentLogicalHeight; | 1933 return m_intrinsicContentLogicalHeight; |
| 1974 return intrinsicContentHeight; | 1934 return intrinsicContentHeight; |
| 1975 } | 1935 } |
| 1976 if (logicalHeightLength.isFillAvailable()) | 1936 if (logicalHeightLength.isFillAvailable()) |
| 1977 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd
ing) - borderAndPadding; | 1937 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd
ing) - borderAndPadding; |
| 1978 ASSERT_NOT_REACHED(); | 1938 ASSERT_NOT_REACHED(); |
| 1979 return 0; | 1939 return 0; |
| 1980 } | 1940 } |
| 1981 | 1941 |
| 1982 LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length&
height, LayoutUnit intrinsicContentHeight) const | 1942 LayoutUnit RenderBox::computeContentLogicalHeightUsing(const Length& height, Lay
outUnit intrinsicContentHeight) const |
| 1983 { | 1943 { |
| 1984 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. | 1944 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. |
| 1985 // If that happens, this code will have to change. | 1945 // If that happens, this code will have to change. |
| 1986 if (height.isIntrinsic()) { | 1946 if (height.isIntrinsic()) { |
| 1987 if (intrinsicContentHeight == -1) | 1947 if (intrinsicContentHeight == -1) |
| 1988 return -1; // Intrinsic height isn't available. | 1948 return -1; // Intrinsic height isn't available. |
| 1989 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten
tHeight, borderAndPaddingLogicalHeight()); | 1949 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten
tHeight, borderAndPaddingLogicalHeight()); |
| 1990 } | 1950 } |
| 1991 if (height.isFixed()) | 1951 if (height.isFixed()) |
| 1992 return height.value(); | 1952 return height.value(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2022 RenderStyle* cbstyle = cb->style(); | 1982 RenderStyle* cbstyle = cb->style(); |
| 2023 | 1983 |
| 2024 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height | 1984 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height |
| 2025 // explicitly specified that can be used for any percentage computations. | 1985 // explicitly specified that can be used for any percentage computations. |
| 2026 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned()
&& (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c
bstyle->logicalBottom().isAuto())); | 1986 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned()
&& (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c
bstyle->logicalBottom().isAuto())); |
| 2027 | 1987 |
| 2028 if (hasOverrideContainingBlockLogicalHeight()) | 1988 if (hasOverrideContainingBlockLogicalHeight()) |
| 2029 availableHeight = overrideContainingBlockContentLogicalHeight(); | 1989 availableHeight = overrideContainingBlockContentLogicalHeight(); |
| 2030 else if (cbstyle->logicalHeight().isFixed()) { | 1990 else if (cbstyle->logicalHeight().isFixed()) { |
| 2031 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz
ing(cbstyle->logicalHeight().value()); | 1991 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz
ing(cbstyle->logicalHeight().value()); |
| 2032 availableHeight = std::max<LayoutUnit>(0, cb->constrainContentBoxLogical
HeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1)); | 1992 availableHeight = std::max<LayoutUnit>(0, cb->constrainContentBoxLogical
HeightByMinMax(contentBoxHeight, -1)); |
| 2033 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit
hSpecifiedHeight) { | 1993 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit
hSpecifiedHeight) { |
| 2034 // We need to recur and compute the percentage height for our containing
block. | 1994 // We need to recur and compute the percentage height for our containing
block. |
| 2035 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst
yle->logicalHeight()); | 1995 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst
yle->logicalHeight()); |
| 2036 if (heightWithScrollbar != -1) { | 1996 if (heightWithScrollbar != -1) { |
| 2037 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic
alHeightForBoxSizing(heightWithScrollbar); | 1997 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic
alHeightForBoxSizing(heightWithScrollbar); |
| 2038 // We need to adjust for min/max height because this method does not | 1998 // We need to adjust for min/max height because this method does not |
| 2039 // handle the min/max of the current block, its caller does. So the | 1999 // handle the min/max of the current block, its caller does. So the |
| 2040 // return value from the recursive call will not have been adjusted | 2000 // return value from the recursive call will not have been adjusted |
| 2041 // yet. | 2001 // yet. |
| 2042 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy
MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1); | 2002 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy
MinMax(contentBoxHeightWithScrollbar, -1); |
| 2043 availableHeight = std::max<LayoutUnit>(0, contentBoxHeight); | 2003 availableHeight = std::max<LayoutUnit>(0, contentBoxHeight); |
| 2044 } | 2004 } |
| 2045 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { | 2005 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { |
| 2046 // Don't allow this to affect the block' height() member variable, since
this | 2006 // Don't allow this to affect the block' height() member variable, since
this |
| 2047 // can get called while the block is still laying out its kids. | 2007 // can get called while the block is still laying out its kids. |
| 2048 LogicalExtentComputedValues computedValues; | 2008 LogicalExtentComputedValues computedValues; |
| 2049 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); | 2009 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); |
| 2050 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH
eight() - cb->scrollbarLogicalHeight(); | 2010 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH
eight(); |
| 2051 } else if (cb->isRenderView()) | 2011 } else if (cb->isRenderView()) |
| 2052 availableHeight = view()->viewLogicalHeightForPercentages(); | 2012 availableHeight = view()->viewLogicalHeightForPercentages(); |
| 2053 | 2013 |
| 2054 if (availableHeight == -1) | 2014 if (availableHeight == -1) |
| 2055 return availableHeight; | 2015 return availableHeight; |
| 2056 | 2016 |
| 2057 availableHeight -= rootMarginBorderPaddingHeight; | 2017 availableHeight -= rootMarginBorderPaddingHeight; |
| 2058 | 2018 |
| 2059 LayoutUnit result = valueForLength(height, availableHeight); | 2019 LayoutUnit result = valueForLength(height, availableHeight); |
| 2060 return result; | 2020 return result; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 if (cb->isRenderBlock()) | 2128 if (cb->isRenderBlock()) |
| 2169 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB
ox*>(this)); | 2129 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB
ox*>(this)); |
| 2170 | 2130 |
| 2171 // FIXME: This calculation is not patched for block-flow yet. | 2131 // FIXME: This calculation is not patched for block-flow yet. |
| 2172 // https://bugs.webkit.org/show_bug.cgi?id=46500 | 2132 // https://bugs.webkit.org/show_bug.cgi?id=46500 |
| 2173 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() &&
!(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) { | 2133 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() &&
!(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) { |
| 2174 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock()); | 2134 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock()); |
| 2175 RenderBlock* block = toRenderBlock(cb); | 2135 RenderBlock* block = toRenderBlock(cb); |
| 2176 LogicalExtentComputedValues computedValues; | 2136 LogicalExtentComputedValues computedValues; |
| 2177 block->computeLogicalHeight(block->logicalHeight(), 0, computedV
alues); | 2137 block->computeLogicalHeight(block->logicalHeight(), 0, computedV
alues); |
| 2178 LayoutUnit newContentHeight = computedValues.m_extent - block->b
orderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight(); | 2138 LayoutUnit newContentHeight = computedValues.m_extent - block->b
orderAndPaddingLogicalHeight(); |
| 2179 LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBo
xSizing(newContentHeight); | 2139 LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBo
xSizing(newContentHeight); |
| 2180 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(
logicalHeight, newHeight)); | 2140 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(
logicalHeight, newHeight)); |
| 2181 } | 2141 } |
| 2182 | 2142 |
| 2183 // FIXME: availableLogicalHeight() is wrong if the replaced element'
s block-flow is perpendicular to the | 2143 // FIXME: availableLogicalHeight() is wrong if the replaced element'
s block-flow is perpendicular to the |
| 2184 // containing block's block-flow. | 2144 // containing block's block-flow. |
| 2185 // https://bugs.webkit.org/show_bug.cgi?id=46496 | 2145 // https://bugs.webkit.org/show_bug.cgi?id=46496 |
| 2186 LayoutUnit availableHeight; | 2146 LayoutUnit availableHeight; |
| 2187 if (isOutOfFlowPositioned()) | 2147 if (isOutOfFlowPositioned()) |
| 2188 availableHeight = containingBlockLogicalHeightForPositioned(toRe
nderBoxModelObject(cb)); | 2148 availableHeight = containingBlockLogicalHeightForPositioned(toRe
nderBoxModelObject(cb)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 { | 2180 { |
| 2221 if (isRenderView()) | 2181 if (isRenderView()) |
| 2222 return toRenderView(this)->frameView()->unscaledVisibleContentSize().hei
ght(); | 2182 return toRenderView(this)->frameView()->unscaledVisibleContentSize().hei
ght(); |
| 2223 | 2183 |
| 2224 if (h.isPercent() && isOutOfFlowPositioned()) { | 2184 if (h.isPercent() && isOutOfFlowPositioned()) { |
| 2225 // FIXME: This is wrong if the containingBlock has a perpendicular writi
ng mode. | 2185 // FIXME: This is wrong if the containingBlock has a perpendicular writi
ng mode. |
| 2226 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c
ontainingBlock()); | 2186 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c
ontainingBlock()); |
| 2227 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail
ableHeight)); | 2187 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail
ableHeight)); |
| 2228 } | 2188 } |
| 2229 | 2189 |
| 2230 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(h, -1); | 2190 LayoutUnit heightIncludingScrollbar = computeContentLogicalHeightUsing(h, -1
); |
| 2231 if (heightIncludingScrollbar != -1) | 2191 if (heightIncludingScrollbar != -1) |
| 2232 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing
(heightIncludingScrollbar) - scrollbarLogicalHeight()); | 2192 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing
(heightIncludingScrollbar)); |
| 2233 | 2193 |
| 2234 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical w
riting-mode. | 2194 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical w
riting-mode. |
| 2235 // https://bugs.webkit.org/show_bug.cgi?id=46500 | 2195 // https://bugs.webkit.org/show_bug.cgi?id=46500 |
| 2236 if (isRenderBlock() && isOutOfFlowPositioned() && style()->height().isAuto()
&& !(style()->top().isAuto() || style()->bottom().isAuto())) { | 2196 if (isRenderBlock() && isOutOfFlowPositioned() && style()->height().isAuto()
&& !(style()->top().isAuto() || style()->bottom().isAuto())) { |
| 2237 RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this)); | 2197 RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this)); |
| 2238 LogicalExtentComputedValues computedValues; | 2198 LogicalExtentComputedValues computedValues; |
| 2239 block->computeLogicalHeight(block->logicalHeight(), 0, computedValues); | 2199 block->computeLogicalHeight(block->logicalHeight(), 0, computedValues); |
| 2240 LayoutUnit newContentHeight = computedValues.m_extent - block->borderAnd
PaddingLogicalHeight() - block->scrollbarLogicalHeight(); | 2200 LayoutUnit newContentHeight = computedValues.m_extent - block->borderAnd
PaddingLogicalHeight(); |
| 2241 return adjustContentBoxLogicalHeightForBoxSizing(newContentHeight); | 2201 return adjustContentBoxLogicalHeightForBoxSizing(newContentHeight); |
| 2242 } | 2202 } |
| 2243 | 2203 |
| 2244 // FIXME: This is wrong if the containingBlock has a perpendicular writing m
ode. | 2204 // FIXME: This is wrong if the containingBlock has a perpendicular writing m
ode. |
| 2245 LayoutUnit availableHeight = containingBlockLogicalHeightForContent(heightTy
pe); | 2205 LayoutUnit availableHeight = containingBlockLogicalHeightForContent(heightTy
pe); |
| 2246 if (heightType == ExcludeMarginBorderPadding) { | 2206 if (heightType == ExcludeMarginBorderPadding) { |
| 2247 // FIXME: Margin collapsing hasn't happened yet, so this incorrectly rem
oves collapsed margins. | 2207 // FIXME: Margin collapsing hasn't happened yet, so this incorrectly rem
oves collapsed margins. |
| 2248 availableHeight -= marginBefore() + marginAfter() + borderAndPaddingLogi
calHeight(); | 2208 availableHeight -= marginBefore() + marginAfter() + borderAndPaddingLogi
calHeight(); |
| 2249 } | 2209 } |
| 2250 return availableHeight; | 2210 return availableHeight; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 if (containerBlock->isRenderInline() && !containerBlock->style()->isLeftToRi
ghtDirection()) { | 2618 if (containerBlock->isRenderInline() && !containerBlock->style()->isLeftToRi
ghtDirection()) { |
| 2659 const RenderInline* flow = toRenderInline(containerBlock); | 2619 const RenderInline* flow = toRenderInline(containerBlock); |
| 2660 InlineFlowBox* firstLine = flow->firstLineBox(); | 2620 InlineFlowBox* firstLine = flow->firstLineBox(); |
| 2661 InlineFlowBox* lastLine = flow->lastLineBox(); | 2621 InlineFlowBox* lastLine = flow->lastLineBox(); |
| 2662 if (firstLine && lastLine && firstLine != lastLine) { | 2622 if (firstLine && lastLine && firstLine != lastLine) { |
| 2663 computedValues.m_position = logicalLeftValue + marginLogicalLeftValu
e + lastLine->borderLogicalLeft() + (lastLine->logicalLeft() - firstLine->logica
lLeft()); | 2623 computedValues.m_position = logicalLeftValue + marginLogicalLeftValu
e + lastLine->borderLogicalLeft() + (lastLine->logicalLeft() - firstLine->logica
lLeft()); |
| 2664 return; | 2624 return; |
| 2665 } | 2625 } |
| 2666 } | 2626 } |
| 2667 | 2627 |
| 2668 if (containerBlock->isBox() && toRenderBox(containerBlock)->scrollsOverflowY
() && containerBlock->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()
) { | |
| 2669 logicalLeftValue = logicalLeftValue + toRenderBox(containerBlock)->verti
calScrollbarWidth(); | |
| 2670 } | |
| 2671 | |
| 2672 computedValues.m_position = logicalLeftValue + marginLogicalLeftValue; | 2628 computedValues.m_position = logicalLeftValue + marginLogicalLeftValue; |
| 2673 computeLogicalLeftPositionedOffset(computedValues.m_position, this, computed
Values.m_extent, containerBlock, containerLogicalWidth); | 2629 computeLogicalLeftPositionedOffset(computedValues.m_position, this, computed
Values.m_extent, containerBlock, containerLogicalWidth); |
| 2674 } | 2630 } |
| 2675 | 2631 |
| 2676 static void computeBlockStaticDistance(Length& logicalTop, Length& logicalBottom
, const RenderBox* child, const RenderBoxModelObject* containerBlock) | 2632 static void computeBlockStaticDistance(Length& logicalTop, Length& logicalBottom
, const RenderBox* child, const RenderBoxModelObject* containerBlock) |
| 2677 { | 2633 { |
| 2678 if (!logicalTop.isAuto() || !logicalBottom.isAuto()) | 2634 if (!logicalTop.isAuto() || !logicalBottom.isAuto()) |
| 2679 return; | 2635 return; |
| 2680 | 2636 |
| 2681 // FIXME: The static distance computation has not been patched for mixed wri
ting modes. | 2637 // FIXME: The static distance computation has not been patched for mixed wri
ting modes. |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3675 | 3631 |
| 3676 if (isRelPositioned()) | 3632 if (isRelPositioned()) |
| 3677 rect.move(offsetForInFlowPosition()); | 3633 rect.move(offsetForInFlowPosition()); |
| 3678 } | 3634 } |
| 3679 | 3635 |
| 3680 return rect; | 3636 return rect; |
| 3681 } | 3637 } |
| 3682 | 3638 |
| 3683 LayoutRect RenderBox::noOverflowRect() const | 3639 LayoutRect RenderBox::noOverflowRect() const |
| 3684 { | 3640 { |
| 3685 // Because of the special coordinate system used for overflow rectangles and
many other | 3641 // FIXME(sky): Replace with borderBoxRect? |
| 3686 // rectangles (not quite logical, not quite physical), we need to flip the b
lock progression | 3642 LayoutUnit left = borderLeft(); |
| 3687 // coordinate in vertical-rl and horizontal-bt writing modes. In other words
, the rectangle | |
| 3688 // returned is physical, except for the block direction progression coordina
te (y in horizontal | |
| 3689 // writing modes, x in vertical writing modes), which is always "logical top
". Apart from the | |
| 3690 // flipping, this method does the same as clientBoxRect(). | |
| 3691 | |
| 3692 const int scrollBarWidth = verticalScrollbarWidth(); | |
| 3693 const int scrollBarHeight = horizontalScrollbarHeight(); | |
| 3694 LayoutUnit left = borderLeft() + (style()->shouldPlaceBlockDirectionScrollba
rOnLogicalLeft() ? scrollBarWidth : 0); | |
| 3695 LayoutUnit top = borderTop(); | 3643 LayoutUnit top = borderTop(); |
| 3696 LayoutUnit right = borderRight(); | 3644 LayoutUnit right = borderRight(); |
| 3697 LayoutUnit bottom = borderBottom(); | 3645 LayoutUnit bottom = borderBottom(); |
| 3698 LayoutRect rect(left, top, width() - left - right, height() - top - bottom); | 3646 LayoutRect rect(left, top, width() - left - right, height() - top - bottom); |
| 3699 // Subtract space occupied by scrollbars. Order is important here: first fli
p, then subtract | |
| 3700 // scrollbars. This may seem backwards and weird, since one would think that
a horizontal | |
| 3701 // scrollbar at the physical bottom in horizontal-bt ought to be at the logi
cal top (physical | |
| 3702 // bottom), between the logical top (physical bottom) border and the logical
top (physical | |
| 3703 // bottom) padding. But this is how the rest of the code expects us to behav
e. This is highly | |
| 3704 // related to https://bugs.webkit.org/show_bug.cgi?id=76129 | |
| 3705 // FIXME: when the above mentioned bug is fixed, it should hopefully be poss
ible to call | |
| 3706 // clientBoxRect() or paddingBoxRect() in this method, rather than fiddling
with the edges on | |
| 3707 // our own. | |
| 3708 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | |
| 3709 rect.contract(0, scrollBarHeight); | |
| 3710 else | |
| 3711 rect.contract(scrollBarWidth, scrollBarHeight); | |
| 3712 return rect; | 3647 return rect; |
| 3713 } | 3648 } |
| 3714 | 3649 |
| 3715 LayoutUnit RenderBox::offsetLeft() const | 3650 LayoutUnit RenderBox::offsetLeft() const |
| 3716 { | 3651 { |
| 3717 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x(); | 3652 return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x(); |
| 3718 } | 3653 } |
| 3719 | 3654 |
| 3720 LayoutUnit RenderBox::offsetTop() const | 3655 LayoutUnit RenderBox::offsetTop() const |
| 3721 { | 3656 { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3820 | 3755 |
| 3821 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3756 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 3822 { | 3757 { |
| 3823 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3758 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 3824 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3759 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 3825 ASSERT(hasBackground == style.hasBackground()); | 3760 ASSERT(hasBackground == style.hasBackground()); |
| 3826 hasBorder = style.hasBorder(); | 3761 hasBorder = style.hasBorder(); |
| 3827 } | 3762 } |
| 3828 | 3763 |
| 3829 } // namespace blink | 3764 } // namespace blink |
| OLD | NEW |