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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 parentBlockFlow->markAllDescendantsWithFloatsForLayout(this, false); | 163 parentBlockFlow->markAllDescendantsWithFloatsForLayout(this, false); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 if (isOutOfFlowPositioned()) | 167 if (isOutOfFlowPositioned()) |
168 RenderBlock::removePositionedObject(this); | 168 RenderBlock::removePositionedObject(this); |
169 } | 169 } |
170 | 170 |
171 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl
e) | 171 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl
e) |
172 { | 172 { |
173 RenderStyle* oldStyle = style(); | 173 const RenderStyle* oldStyle = style(); |
174 if (oldStyle) { | 174 if (oldStyle) { |
175 // The background of the root element or the body element could propagat
e up to | 175 // The background of the root element or the body element could propagat
e up to |
176 // the canvas. Just dirty the entire canvas when our style changes subst
antially. | 176 // the canvas. Just dirty the entire canvas when our style changes subst
antially. |
177 if ((diff.needsPaintInvalidation() || diff.needsLayout()) && node() | 177 if ((diff.needsPaintInvalidation() || diff.needsLayout()) && node() |
178 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { | 178 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { |
179 view()->setShouldDoFullPaintInvalidation(); | 179 view()->setShouldDoFullPaintInvalidation(); |
180 | 180 |
181 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi
xedBackground()) | 181 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi
xedBackground()) |
182 view()->compositor()->setNeedsUpdateFixedBackground(); | 182 view()->compositor()->setNeedsUpdateFixedBackground(); |
183 } | 183 } |
(...skipping 20 matching lines...) Expand all Loading... |
204 | 204 |
205 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
) | 205 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
) |
206 { | 206 { |
207 // Horizontal writing mode definition is updated in RenderBoxModelObject::up
dateFromStyle, | 207 // Horizontal writing mode definition is updated in RenderBoxModelObject::up
dateFromStyle, |
208 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we
can safely cache the horizontal | 208 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we
can safely cache the horizontal |
209 // writing mode value before style change here. | 209 // writing mode value before style change here. |
210 bool oldHorizontalWritingMode = isHorizontalWritingMode(); | 210 bool oldHorizontalWritingMode = isHorizontalWritingMode(); |
211 | 211 |
212 RenderBoxModelObject::styleDidChange(diff, oldStyle); | 212 RenderBoxModelObject::styleDidChange(diff, oldStyle); |
213 | 213 |
214 RenderStyle* newStyle = style(); | 214 const RenderStyle* newStyle = style(); |
215 if (needsLayout() && oldStyle) | 215 if (needsLayout() && oldStyle) |
216 RenderBlock::removePercentHeightDescendantIfNeeded(this); | 216 RenderBlock::removePercentHeightDescendantIfNeeded(this); |
217 | 217 |
218 if (RenderBlock::hasPercentHeightContainerMap() && slowFirstChild() | 218 if (RenderBlock::hasPercentHeightContainerMap() && slowFirstChild() |
219 && oldHorizontalWritingMode != isHorizontalWritingMode()) | 219 && oldHorizontalWritingMode != isHorizontalWritingMode()) |
220 RenderBlock::clearPercentHeightDescendantsFrom(this); | 220 RenderBlock::clearPercentHeightDescendantsFrom(this); |
221 | 221 |
222 // If our zoom factor changes and we have a defined scrollLeft/Top, we need
to adjust that value into the | 222 // If our zoom factor changes and we have a defined scrollLeft/Top, we need
to adjust that value into the |
223 // new zoomed coordinate space. | 223 // new zoomed coordinate space. |
224 if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() !
= newStyle->effectiveZoom() && layer()) { | 224 if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() !
= newStyle->effectiveZoom() && layer()) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 // It should be possible to not dirty the grid in some cases (like moving an
explicitly placed grid item). | 292 // It should be possible to not dirty the grid in some cases (like moving an
explicitly placed grid item). |
293 // For now, it's more simple to just always recompute the grid. | 293 // For now, it's more simple to just always recompute the grid. |
294 toRenderGrid(parent())->dirtyGrid(); | 294 toRenderGrid(parent())->dirtyGrid(); |
295 } | 295 } |
296 | 296 |
297 void RenderBox::updateFromStyle() | 297 void RenderBox::updateFromStyle() |
298 { | 298 { |
299 RenderBoxModelObject::updateFromStyle(); | 299 RenderBoxModelObject::updateFromStyle(); |
300 | 300 |
301 RenderStyle* styleToUse = style(); | 301 const RenderStyle* styleToUse = style(); |
302 bool isRootObject = isDocumentElement(); | 302 bool isRootObject = isDocumentElement(); |
303 bool isViewObject = isRenderView(); | 303 bool isViewObject = isRenderView(); |
304 bool rootLayerScrolls = document().settings() && document().settings()->root
LayerScrolls(); | 304 bool rootLayerScrolls = document().settings() && document().settings()->root
LayerScrolls(); |
305 | 305 |
306 // The root and the RenderView always paint their backgrounds/borders. | 306 // The root and the RenderView always paint their backgrounds/borders. |
307 if (isRootObject || isViewObject) | 307 if (isRootObject || isViewObject) |
308 setHasBoxDecorationBackground(true); | 308 setHasBoxDecorationBackground(true); |
309 | 309 |
310 setFloating(!isOutOfFlowPositioned() && styleToUse->isFloating()); | 310 setFloating(!isOutOfFlowPositioned() && styleToUse->isFloating()); |
311 | 311 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 563 |
564 void RenderBox::updateLayerTransformAfterLayout() | 564 void RenderBox::updateLayerTransformAfterLayout() |
565 { | 565 { |
566 // Transform-origin depends on box size, so we need to update the layer tran
sform after layout. | 566 // Transform-origin depends on box size, so we need to update the layer tran
sform after layout. |
567 if (hasLayer()) | 567 if (hasLayer()) |
568 layer()->updateTransformationMatrix(); | 568 layer()->updateTransformationMatrix(); |
569 } | 569 } |
570 | 570 |
571 LayoutUnit RenderBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, Lay
outUnit availableWidth, RenderBlock* cb) const | 571 LayoutUnit RenderBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, Lay
outUnit availableWidth, RenderBlock* cb) const |
572 { | 572 { |
573 RenderStyle* styleToUse = style(); | 573 const RenderStyle* styleToUse = style(); |
574 if (!styleToUse->logicalMaxWidth().isMaxSizeNone()) | 574 if (!styleToUse->logicalMaxWidth().isMaxSizeNone()) |
575 logicalWidth = std::min(logicalWidth, computeLogicalWidthUsing(MaxSize,
styleToUse->logicalMaxWidth(), availableWidth, cb)); | 575 logicalWidth = std::min(logicalWidth, computeLogicalWidthUsing(MaxSize,
styleToUse->logicalMaxWidth(), availableWidth, cb)); |
576 return std::max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse->
logicalMinWidth(), availableWidth, cb)); | 576 return std::max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse->
logicalMinWidth(), availableWidth, cb)); |
577 } | 577 } |
578 | 578 |
579 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L
ayoutUnit intrinsicContentHeight) const | 579 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L
ayoutUnit intrinsicContentHeight) const |
580 { | 580 { |
581 RenderStyle* styleToUse = style(); | 581 const RenderStyle* styleToUse = style(); |
582 if (!styleToUse->logicalMaxHeight().isMaxSizeNone()) { | 582 if (!styleToUse->logicalMaxHeight().isMaxSizeNone()) { |
583 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight
(), intrinsicContentHeight); | 583 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight
(), intrinsicContentHeight); |
584 if (maxH != -1) | 584 if (maxH != -1) |
585 logicalHeight = std::min(logicalHeight, maxH); | 585 logicalHeight = std::min(logicalHeight, maxH); |
586 } | 586 } |
587 return std::max(logicalHeight, computeLogicalHeightUsing(styleToUse->logical
MinHeight(), intrinsicContentHeight)); | 587 return std::max(logicalHeight, computeLogicalHeightUsing(styleToUse->logical
MinHeight(), intrinsicContentHeight)); |
588 } | 588 } |
589 | 589 |
590 LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
lHeight, LayoutUnit intrinsicContentHeight) const | 590 LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
lHeight, LayoutUnit intrinsicContentHeight) const |
591 { | 591 { |
592 RenderStyle* styleToUse = style(); | 592 const RenderStyle* styleToUse = style(); |
593 if (!styleToUse->logicalMaxHeight().isMaxSizeNone()) { | 593 if (!styleToUse->logicalMaxHeight().isMaxSizeNone()) { |
594 LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeig
ht(), intrinsicContentHeight); | 594 LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeig
ht(), intrinsicContentHeight); |
595 if (maxH != -1) | 595 if (maxH != -1) |
596 logicalHeight = std::min(logicalHeight, maxH); | 596 logicalHeight = std::min(logicalHeight, maxH); |
597 } | 597 } |
598 return std::max(logicalHeight, computeContentLogicalHeight(styleToUse->logic
alMinHeight(), intrinsicContentHeight)); | 598 return std::max(logicalHeight, computeContentLogicalHeight(styleToUse->logic
alMinHeight(), intrinsicContentHeight)); |
599 } | 599 } |
600 | 600 |
601 IntRect RenderBox::absoluteContentBox() const | 601 IntRect RenderBox::absoluteContentBox() const |
602 { | 602 { |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 backgroundRect = contentBoxRect(); | 1224 backgroundRect = contentBoxRect(); |
1225 break; | 1225 break; |
1226 default: | 1226 default: |
1227 break; | 1227 break; |
1228 } | 1228 } |
1229 return backgroundRect.contains(localRect); | 1229 return backgroundRect.contains(localRect); |
1230 } | 1230 } |
1231 | 1231 |
1232 static bool isCandidateForOpaquenessTest(RenderBox* childBox) | 1232 static bool isCandidateForOpaquenessTest(RenderBox* childBox) |
1233 { | 1233 { |
1234 RenderStyle* childStyle = childBox->style(); | 1234 const RenderStyle* childStyle = childBox->style(); |
1235 if (childStyle->position() != StaticPosition && childBox->containingBlock()
!= childBox->parent()) | 1235 if (childStyle->position() != StaticPosition && childBox->containingBlock()
!= childBox->parent()) |
1236 return false; | 1236 return false; |
1237 if (childStyle->visibility() != VISIBLE || childStyle->shapeOutside()) | 1237 if (childStyle->visibility() != VISIBLE || childStyle->shapeOutside()) |
1238 return false; | 1238 return false; |
1239 if (childBox->size().isZero()) | 1239 if (childBox->size().isZero()) |
1240 return false; | 1240 return false; |
1241 if (RenderLayer* childLayer = childBox->layer()) { | 1241 if (RenderLayer* childLayer = childBox->layer()) { |
1242 // FIXME: perhaps this could be less conservative? | 1242 // FIXME: perhaps this could be less conservative? |
1243 if (childLayer->compositingState() != NotComposited) | 1243 if (childLayer->compositingState() != NotComposited) |
1244 return false; | 1244 return false; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 | 1536 |
1537 LayoutUnit RenderBox::perpendicularContainingBlockLogicalHeight() const | 1537 LayoutUnit RenderBox::perpendicularContainingBlockLogicalHeight() const |
1538 { | 1538 { |
1539 if (hasOverrideContainingBlockLogicalHeight()) | 1539 if (hasOverrideContainingBlockLogicalHeight()) |
1540 return overrideContainingBlockContentLogicalHeight(); | 1540 return overrideContainingBlockContentLogicalHeight(); |
1541 | 1541 |
1542 RenderBlock* cb = containingBlock(); | 1542 RenderBlock* cb = containingBlock(); |
1543 if (cb->hasOverrideHeight()) | 1543 if (cb->hasOverrideHeight()) |
1544 return cb->overrideLogicalContentHeight(); | 1544 return cb->overrideLogicalContentHeight(); |
1545 | 1545 |
1546 RenderStyle* containingBlockStyle = cb->style(); | 1546 const RenderStyle* containingBlockStyle = cb->style(); |
1547 Length logicalHeightLength = containingBlockStyle->logicalHeight(); | 1547 Length logicalHeightLength = containingBlockStyle->logicalHeight(); |
1548 | 1548 |
1549 // FIXME: For now just support fixed heights. Eventually should support per
centage heights as well. | 1549 // FIXME: For now just support fixed heights. Eventually should support per
centage heights as well. |
1550 if (!logicalHeightLength.isFixed()) { | 1550 if (!logicalHeightLength.isFixed()) { |
1551 LayoutUnit fillFallbackExtent = containingBlockStyle->isHorizontalWritin
gMode() | 1551 LayoutUnit fillFallbackExtent = containingBlockStyle->isHorizontalWritin
gMode() |
1552 ? view()->frameView()->unscaledVisibleContentSize().height() | 1552 ? view()->frameView()->unscaledVisibleContentSize().height() |
1553 : view()->frameView()->unscaledVisibleContentSize().width(); | 1553 : view()->frameView()->unscaledVisibleContentSize().width(); |
1554 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 1554 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
1555 return std::min(fillAvailableExtent, fillFallbackExtent); | 1555 return std::min(fillAvailableExtent, fillFallbackExtent); |
1556 } | 1556 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* pain
tInvalidationState) const | 1783 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* pain
tInvalidationState) const |
1784 { | 1784 { |
1785 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. | 1785 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. |
1786 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate | 1786 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate |
1787 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations | 1787 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations |
1788 // properly even during layout, since the rect remains flipped all the way u
ntil the end. | 1788 // properly even during layout, since the rect remains flipped all the way u
ntil the end. |
1789 // | 1789 // |
1790 // RenderView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to | 1790 // RenderView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to |
1791 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the | 1791 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the |
1792 // physical coordinate space of the paintInvalidationContainer. | 1792 // physical coordinate space of the paintInvalidationContainer. |
1793 RenderStyle* styleToUse = style(); | 1793 const RenderStyle* styleToUse = style(); |
1794 | 1794 |
1795 EPosition position = styleToUse->position(); | 1795 EPosition position = styleToUse->position(); |
1796 | 1796 |
1797 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, | 1797 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, |
1798 // else we would forget to inflate it for the current renderer. FIXME: If th
ese were | 1798 // else we would forget to inflate it for the current renderer. FIXME: If th
ese were |
1799 // included into the visual overflow for repaint, we wouldn't have this issu
e. | 1799 // included into the visual overflow for repaint, we wouldn't have this issu
e. |
1800 inflatePaintInvalidationRectForReflectionAndFilter(rect); | 1800 inflatePaintInvalidationRectForReflectionAndFilter(rect); |
1801 | 1801 |
1802 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer) && position != FixedPosition) { | 1802 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer) && position != FixedPosition) { |
1803 if (layer() && layer()->transform()) | 1803 if (layer() && layer()->transform()) |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 computedValues.m_extent = overrideLogicalContentWidth() + borderAndPaddi
ngLogicalWidth(); | 1959 computedValues.m_extent = overrideLogicalContentWidth() + borderAndPaddi
ngLogicalWidth(); |
1960 return; | 1960 return; |
1961 } | 1961 } |
1962 | 1962 |
1963 // FIXME: Account for writing-mode in flexible boxes. | 1963 // FIXME: Account for writing-mode in flexible boxes. |
1964 // https://bugs.webkit.org/show_bug.cgi?id=46418 | 1964 // https://bugs.webkit.org/show_bug.cgi?id=46418 |
1965 bool inVerticalBox = parent()->isDeprecatedFlexibleBox() && (parent()->style
()->boxOrient() == VERTICAL); | 1965 bool inVerticalBox = parent()->isDeprecatedFlexibleBox() && (parent()->style
()->boxOrient() == VERTICAL); |
1966 bool stretching = (parent()->style()->boxAlign() == BSTRETCH); | 1966 bool stretching = (parent()->style()->boxAlign() == BSTRETCH); |
1967 bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !
stretching); | 1967 bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !
stretching); |
1968 | 1968 |
1969 RenderStyle* styleToUse = style(); | 1969 const RenderStyle* styleToUse = style(); |
1970 Length logicalWidthLength = treatAsReplaced ? Length(computeReplacedLogicalW
idth(), Fixed) : styleToUse->logicalWidth(); | 1970 Length logicalWidthLength = treatAsReplaced ? Length(computeReplacedLogicalW
idth(), Fixed) : styleToUse->logicalWidth(); |
1971 | 1971 |
1972 RenderBlock* cb = containingBlock(); | 1972 RenderBlock* cb = containingBlock(); |
1973 LayoutUnit containerLogicalWidth = std::max(LayoutUnit(), containingBlockLog
icalWidthForContent()); | 1973 LayoutUnit containerLogicalWidth = std::max(LayoutUnit(), containingBlockLog
icalWidthForContent()); |
1974 bool hasPerpendicularContainingBlock = cb->isHorizontalWritingMode() != isHo
rizontalWritingMode(); | 1974 bool hasPerpendicularContainingBlock = cb->isHorizontalWritingMode() != isHo
rizontalWritingMode(); |
1975 | 1975 |
1976 if (isInline() && !isInlineBlockOrInlineTable()) { | 1976 if (isInline() && !isInlineBlockOrInlineTable()) { |
1977 // just calculate margins | 1977 // just calculate margins |
1978 computedValues.m_margins.m_start = minimumValueForLength(styleToUse->mar
ginStart(), containerLogicalWidth); | 1978 computedValues.m_margins.m_start = minimumValueForLength(styleToUse->mar
ginStart(), containerLogicalWidth); |
1979 computedValues.m_margins.m_end = minimumValueForLength(styleToUse->margi
nEnd(), containerLogicalWidth); | 1979 computedValues.m_margins.m_end = minimumValueForLength(styleToUse->margi
nEnd(), containerLogicalWidth); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2427 LayoutUnit rootMarginBorderPaddingHeight = 0; | 2427 LayoutUnit rootMarginBorderPaddingHeight = 0; |
2428 while (!cb->isRenderView() && skipContainingBlockForPercentHeightCalculation
(cb)) { | 2428 while (!cb->isRenderView() && skipContainingBlockForPercentHeightCalculation
(cb)) { |
2429 if (cb->isBody() || cb->isDocumentElement()) | 2429 if (cb->isBody() || cb->isDocumentElement()) |
2430 rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfte
r() + cb->borderAndPaddingLogicalHeight(); | 2430 rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfte
r() + cb->borderAndPaddingLogicalHeight(); |
2431 skippedAutoHeightContainingBlock = true; | 2431 skippedAutoHeightContainingBlock = true; |
2432 containingBlockChild = cb; | 2432 containingBlockChild = cb; |
2433 cb = cb->containingBlock(); | 2433 cb = cb->containingBlock(); |
2434 } | 2434 } |
2435 cb->addPercentHeightDescendant(const_cast<RenderBox*>(this)); | 2435 cb->addPercentHeightDescendant(const_cast<RenderBox*>(this)); |
2436 | 2436 |
2437 RenderStyle* cbstyle = cb->style(); | 2437 const RenderStyle* cbstyle = cb->style(); |
2438 | 2438 |
2439 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height | 2439 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height |
2440 // explicitly specified that can be used for any percentage computations. | 2440 // explicitly specified that can be used for any percentage computations. |
2441 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned()
&& (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c
bstyle->logicalBottom().isAuto())); | 2441 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned()
&& (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c
bstyle->logicalBottom().isAuto())); |
2442 | 2442 |
2443 bool includeBorderPadding = isTable(); | 2443 bool includeBorderPadding = isTable(); |
2444 | 2444 |
2445 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) | 2445 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) |
2446 availableHeight = containingBlockChild->containingBlockLogicalWidthForCo
ntent(); | 2446 availableHeight = containingBlockChild->containingBlockLogicalWidthForCo
ntent(); |
2447 else if (hasOverrideContainingBlockLogicalHeight()) | 2447 else if (hasOverrideContainingBlockLogicalHeight()) |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3192 // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-non-replace
d-height> | 3192 // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-non-replace
d-height> |
3193 // (block-style-comments in this function and in computePositionedLogicalHei
ghtUsing() | 3193 // (block-style-comments in this function and in computePositionedLogicalHei
ghtUsing() |
3194 // correspond to text from the spec) | 3194 // correspond to text from the spec) |
3195 | 3195 |
3196 | 3196 |
3197 // We don't use containingBlock(), since we may be positioned by an enclosin
g relpositioned inline. | 3197 // We don't use containingBlock(), since we may be positioned by an enclosin
g relpositioned inline. |
3198 const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(containe
r()); | 3198 const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(containe
r()); |
3199 | 3199 |
3200 const LayoutUnit containerLogicalHeight = containingBlockLogicalHeightForPos
itioned(containerBlock); | 3200 const LayoutUnit containerLogicalHeight = containingBlockLogicalHeightForPos
itioned(containerBlock); |
3201 | 3201 |
3202 RenderStyle* styleToUse = style(); | 3202 const RenderStyle* styleToUse = style(); |
3203 const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight(); | 3203 const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight(); |
3204 const Length marginBefore = styleToUse->marginBefore(); | 3204 const Length marginBefore = styleToUse->marginBefore(); |
3205 const Length marginAfter = styleToUse->marginAfter(); | 3205 const Length marginAfter = styleToUse->marginAfter(); |
3206 Length logicalTopLength = styleToUse->logicalTop(); | 3206 Length logicalTopLength = styleToUse->logicalTop(); |
3207 Length logicalBottomLength = styleToUse->logicalBottom(); | 3207 Length logicalBottomLength = styleToUse->logicalBottom(); |
3208 | 3208 |
3209 /*--------------------------------------------------------------------------
-*\ | 3209 /*--------------------------------------------------------------------------
-*\ |
3210 * For the purposes of this section and the next, the term "static position" | 3210 * For the purposes of this section and the next, the term "static position" |
3211 * (of an element) refers, roughly, to the position an element would have ha
d | 3211 * (of an element) refers, roughly, to the position an element would have ha
d |
3212 * in the normal flow. More precisely, the static position for 'top' is the | 3212 * in the normal flow. More precisely, the static position for 'top' is the |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4288 const RenderObject* curr = this; | 4288 const RenderObject* curr = this; |
4289 while (curr) { | 4289 while (curr) { |
4290 RenderLayer* layer = curr->hasLayer() && curr->isBox() ? toRenderBox(cur
r)->layer() : 0; | 4290 RenderLayer* layer = curr->hasLayer() && curr->isBox() ? toRenderBox(cur
r)->layer() : 0; |
4291 if (layer && layer->isSelfPaintingLayer()) | 4291 if (layer && layer->isSelfPaintingLayer()) |
4292 return layer; | 4292 return layer; |
4293 curr = curr->parent(); | 4293 curr = curr->parent(); |
4294 } | 4294 } |
4295 return 0; | 4295 return 0; |
4296 } | 4296 } |
4297 | 4297 |
4298 LayoutRect RenderBox::logicalVisualOverflowRectForPropagation(RenderStyle* paren
tStyle) const | 4298 LayoutRect RenderBox::logicalVisualOverflowRectForPropagation(const RenderStyle*
parentStyle) const |
4299 { | 4299 { |
4300 LayoutRect rect = visualOverflowRectForPropagation(parentStyle); | 4300 LayoutRect rect = visualOverflowRectForPropagation(parentStyle); |
4301 if (!parentStyle->isHorizontalWritingMode()) | 4301 if (!parentStyle->isHorizontalWritingMode()) |
4302 return rect.transposedRect(); | 4302 return rect.transposedRect(); |
4303 return rect; | 4303 return rect; |
4304 } | 4304 } |
4305 | 4305 |
4306 LayoutRect RenderBox::visualOverflowRectForPropagation(RenderStyle* parentStyle)
const | 4306 LayoutRect RenderBox::visualOverflowRectForPropagation(const RenderStyle* parent
Style) const |
4307 { | 4307 { |
4308 // If the writing modes of the child and parent match, then we don't have to | 4308 // If the writing modes of the child and parent match, then we don't have to |
4309 // do anything fancy. Just return the result. | 4309 // do anything fancy. Just return the result. |
4310 LayoutRect rect = visualOverflowRect(); | 4310 LayoutRect rect = visualOverflowRect(); |
4311 if (parentStyle->writingMode() == style()->writingMode()) | 4311 if (parentStyle->writingMode() == style()->writingMode()) |
4312 return rect; | 4312 return rect; |
4313 | 4313 |
4314 // We are putting ourselves into our parent's coordinate space. If there is
a flipped block mismatch | 4314 // We are putting ourselves into our parent's coordinate space. If there is
a flipped block mismatch |
4315 // in a particular axis, then we have to flip the rect along that axis. | 4315 // in a particular axis, then we have to flip the rect along that axis. |
4316 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing
Mode() == RightToLeftWritingMode) | 4316 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing
Mode() == RightToLeftWritingMode) |
4317 rect.setX(size().width() - rect.maxX()); | 4317 rect.setX(size().width() - rect.maxX()); |
4318 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr
itingMode() == BottomToTopWritingMode) | 4318 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr
itingMode() == BottomToTopWritingMode) |
4319 rect.setY(size().height() - rect.maxY()); | 4319 rect.setY(size().height() - rect.maxY()); |
4320 | 4320 |
4321 return rect; | 4321 return rect; |
4322 } | 4322 } |
4323 | 4323 |
4324 LayoutRect RenderBox::logicalLayoutOverflowRectForPropagation(RenderStyle* paren
tStyle) const | 4324 LayoutRect RenderBox::logicalLayoutOverflowRectForPropagation(const RenderStyle*
parentStyle) const |
4325 { | 4325 { |
4326 LayoutRect rect = layoutOverflowRectForPropagation(parentStyle); | 4326 LayoutRect rect = layoutOverflowRectForPropagation(parentStyle); |
4327 if (!parentStyle->isHorizontalWritingMode()) | 4327 if (!parentStyle->isHorizontalWritingMode()) |
4328 return rect.transposedRect(); | 4328 return rect.transposedRect(); |
4329 return rect; | 4329 return rect; |
4330 } | 4330 } |
4331 | 4331 |
4332 LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle)
const | 4332 LayoutRect RenderBox::layoutOverflowRectForPropagation(const RenderStyle* parent
Style) const |
4333 { | 4333 { |
4334 // Only propagate interior layout overflow if we don't clip it. | 4334 // Only propagate interior layout overflow if we don't clip it. |
4335 LayoutRect rect = borderBoxRect(); | 4335 LayoutRect rect = borderBoxRect(); |
4336 // We want to include the margin, but only when it adds height. Quirky margi
ns don't contribute height | 4336 // We want to include the margin, but only when it adds height. Quirky margi
ns don't contribute height |
4337 // nor do the margins of self-collapsing blocks. | 4337 // nor do the margins of self-collapsing blocks. |
4338 if (!style()->hasMarginAfterQuirk() && !isSelfCollapsingBlock()) | 4338 if (!style()->hasMarginAfterQuirk() && !isSelfCollapsingBlock()) |
4339 rect.expand(isHorizontalWritingMode() ? LayoutSize(LayoutUnit(), marginA
fter()) : LayoutSize(marginAfter(), LayoutUnit())); | 4339 rect.expand(isHorizontalWritingMode() ? LayoutSize(LayoutUnit(), marginA
fter()) : LayoutSize(marginAfter(), LayoutUnit())); |
4340 | 4340 |
4341 if (!hasOverflowClip()) | 4341 if (!hasOverflowClip()) |
4342 rect.unite(layoutOverflowRect()); | 4342 rect.unite(layoutOverflowRect()); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4568 computedValues.m_margins.m_end = marginEnd(); | 4568 computedValues.m_margins.m_end = marginEnd(); |
4569 | 4569 |
4570 setLogicalTop(oldLogicalTop); | 4570 setLogicalTop(oldLogicalTop); |
4571 setLogicalWidth(oldLogicalWidth); | 4571 setLogicalWidth(oldLogicalWidth); |
4572 setLogicalLeft(oldLogicalLeft); | 4572 setLogicalLeft(oldLogicalLeft); |
4573 setMarginLeft(oldMarginLeft); | 4573 setMarginLeft(oldMarginLeft); |
4574 setMarginRight(oldMarginRight); | 4574 setMarginRight(oldMarginRight); |
4575 } | 4575 } |
4576 | 4576 |
4577 } // namespace blink | 4577 } // namespace blink |
OLD | NEW |