| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "core/rendering/compositing/RenderLayerCompositor.h" | 46 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 47 #include "platform/LengthFunctions.h" | 47 #include "platform/LengthFunctions.h" |
| 48 #include "platform/geometry/FloatQuad.h" | 48 #include "platform/geometry/FloatQuad.h" |
| 49 #include "platform/geometry/TransformState.h" | 49 #include "platform/geometry/TransformState.h" |
| 50 #include "platform/graphics/GraphicsContextStateSaver.h" | 50 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 51 #include <algorithm> | 51 #include <algorithm> |
| 52 #include <math.h> | 52 #include <math.h> |
| 53 | 53 |
| 54 namespace blink { | 54 namespace blink { |
| 55 | 55 |
| 56 // Used by flexible boxes when flexing this element and by table cells. | |
| 57 typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap; | |
| 58 | |
| 59 //FIXME(sky): Remove | |
| 60 static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0; | |
| 61 static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0; | |
| 62 | |
| 63 | |
| 64 // Size of border belt for autoscroll. When mouse pointer in border belt, | 56 // Size of border belt for autoscroll. When mouse pointer in border belt, |
| 65 // autoscroll is started. | 57 // autoscroll is started. |
| 66 static const int autoscrollBeltSize = 20; | 58 static const int autoscrollBeltSize = 20; |
| 67 static const unsigned backgroundObscurationTestMaxDepth = 4; | 59 static const unsigned backgroundObscurationTestMaxDepth = 4; |
| 68 | 60 |
| 69 RenderBox::RenderBox(ContainerNode* node) | 61 RenderBox::RenderBox(ContainerNode* node) |
| 70 : RenderBoxModelObject(node) | 62 : RenderBoxModelObject(node) |
| 71 , m_intrinsicContentLogicalHeight(-1) | 63 , m_intrinsicContentLogicalHeight(-1) |
| 72 , m_minPreferredLogicalWidth(-1) | 64 , m_minPreferredLogicalWidth(-1) |
| 73 , m_maxPreferredLogicalWidth(-1) | 65 , m_maxPreferredLogicalWidth(-1) |
| 74 { | 66 { |
| 75 setIsBox(); | 67 setIsBox(); |
| 76 } | 68 } |
| 77 | 69 |
| 78 void RenderBox::willBeDestroyed() | 70 void RenderBox::willBeDestroyed() |
| 79 { | 71 { |
| 80 clearOverrideSize(); | 72 clearOverrideSize(); |
| 81 clearContainingBlockOverrideSize(); | |
| 82 | |
| 83 RenderBlock::removePercentHeightDescendantIfNeeded(this); | 73 RenderBlock::removePercentHeightDescendantIfNeeded(this); |
| 84 | |
| 85 RenderBoxModelObject::willBeDestroyed(); | 74 RenderBoxModelObject::willBeDestroyed(); |
| 86 } | 75 } |
| 87 | 76 |
| 88 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() | 77 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() |
| 89 { | 78 { |
| 90 ASSERT(isFloatingOrOutOfFlowPositioned()); | 79 ASSERT(isFloatingOrOutOfFlowPositioned()); |
| 91 | 80 |
| 92 if (documentBeingDestroyed()) | 81 if (documentBeingDestroyed()) |
| 93 return; | 82 return; |
| 94 | 83 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 ASSERT(hasOverrideWidth()); | 599 ASSERT(hasOverrideWidth()); |
| 611 return m_rareData->m_overrideLogicalContentWidth; | 600 return m_rareData->m_overrideLogicalContentWidth; |
| 612 } | 601 } |
| 613 | 602 |
| 614 LayoutUnit RenderBox::overrideLogicalContentHeight() const | 603 LayoutUnit RenderBox::overrideLogicalContentHeight() const |
| 615 { | 604 { |
| 616 ASSERT(hasOverrideHeight()); | 605 ASSERT(hasOverrideHeight()); |
| 617 return m_rareData->m_overrideLogicalContentHeight; | 606 return m_rareData->m_overrideLogicalContentHeight; |
| 618 } | 607 } |
| 619 | 608 |
| 620 LayoutUnit RenderBox::overrideContainingBlockContentLogicalWidth() const | |
| 621 { | |
| 622 ASSERT(hasOverrideContainingBlockLogicalWidth()); | |
| 623 return gOverrideContainingBlockLogicalWidthMap->get(this); | |
| 624 } | |
| 625 | |
| 626 LayoutUnit RenderBox::overrideContainingBlockContentLogicalHeight() const | |
| 627 { | |
| 628 ASSERT(hasOverrideContainingBlockLogicalHeight()); | |
| 629 return gOverrideContainingBlockLogicalHeightMap->get(this); | |
| 630 } | |
| 631 | |
| 632 bool RenderBox::hasOverrideContainingBlockLogicalWidth() const | |
| 633 { | |
| 634 return gOverrideContainingBlockLogicalWidthMap && gOverrideContainingBlockLo
gicalWidthMap->contains(this); | |
| 635 } | |
| 636 | |
| 637 bool RenderBox::hasOverrideContainingBlockLogicalHeight() const | |
| 638 { | |
| 639 return gOverrideContainingBlockLogicalHeightMap && gOverrideContainingBlockL
ogicalHeightMap->contains(this); | |
| 640 } | |
| 641 | |
| 642 void RenderBox::setOverrideContainingBlockContentLogicalWidth(LayoutUnit logical
Width) | |
| 643 { | |
| 644 if (!gOverrideContainingBlockLogicalWidthMap) | |
| 645 gOverrideContainingBlockLogicalWidthMap = new OverrideSizeMap; | |
| 646 gOverrideContainingBlockLogicalWidthMap->set(this, logicalWidth); | |
| 647 } | |
| 648 | |
| 649 void RenderBox::setOverrideContainingBlockContentLogicalHeight(LayoutUnit logica
lHeight) | |
| 650 { | |
| 651 if (!gOverrideContainingBlockLogicalHeightMap) | |
| 652 gOverrideContainingBlockLogicalHeightMap = new OverrideSizeMap; | |
| 653 gOverrideContainingBlockLogicalHeightMap->set(this, logicalHeight); | |
| 654 } | |
| 655 | |
| 656 void RenderBox::clearContainingBlockOverrideSize() | |
| 657 { | |
| 658 if (gOverrideContainingBlockLogicalWidthMap) | |
| 659 gOverrideContainingBlockLogicalWidthMap->remove(this); | |
| 660 clearOverrideContainingBlockContentLogicalHeight(); | |
| 661 } | |
| 662 | |
| 663 void RenderBox::clearOverrideContainingBlockContentLogicalHeight() | |
| 664 { | |
| 665 if (gOverrideContainingBlockLogicalHeightMap) | |
| 666 gOverrideContainingBlockLogicalHeightMap->remove(this); | |
| 667 } | |
| 668 | |
| 669 LayoutUnit RenderBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width)
const | 609 LayoutUnit RenderBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width)
const |
| 670 { | 610 { |
| 671 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); | 611 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); |
| 672 if (style()->boxSizing() == CONTENT_BOX) | 612 if (style()->boxSizing() == CONTENT_BOX) |
| 673 return width + bordersPlusPadding; | 613 return width + bordersPlusPadding; |
| 674 return std::max(width, bordersPlusPadding); | 614 return std::max(width, bordersPlusPadding); |
| 675 } | 615 } |
| 676 | 616 |
| 677 LayoutUnit RenderBox::adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height
) const | 617 LayoutUnit RenderBox::adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height
) const |
| 678 { | 618 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 689 return std::max<LayoutUnit>(0, width); | 629 return std::max<LayoutUnit>(0, width); |
| 690 } | 630 } |
| 691 | 631 |
| 692 LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit heigh
t) const | 632 LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit heigh
t) const |
| 693 { | 633 { |
| 694 if (style()->boxSizing() == BORDER_BOX) | 634 if (style()->boxSizing() == BORDER_BOX) |
| 695 height -= borderAndPaddingLogicalHeight(); | 635 height -= borderAndPaddingLogicalHeight(); |
| 696 return std::max<LayoutUnit>(0, height); | 636 return std::max<LayoutUnit>(0, height); |
| 697 } | 637 } |
| 698 | 638 |
| 699 // Hit Testing | |
| 700 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs
et, HitTestAction action) | 639 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs
et, HitTestAction action) |
| 701 { | 640 { |
| 702 LayoutPoint adjustedLocation = accumulatedOffset + location(); | 641 LayoutPoint adjustedLocation = accumulatedOffset + location(); |
| 703 | 642 |
| 704 // Check kids first. | 643 // Check kids first. |
| 705 for (RenderObject* child = slowLastChild(); child; child = child->previousSi
bling()) { | 644 for (RenderObject* child = slowLastChild(); child; child = child->previousSi
bling()) { |
| 706 if ((!child->hasLayer() || !toRenderLayerModelObject(child)->layer()->is
SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer,
adjustedLocation, action)) { | 645 if ((!child->hasLayer() || !toRenderLayerModelObject(child)->layer()->is
SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer,
adjustedLocation, action)) { |
| 707 updateHitTestResult(result, locationInContainer.point() - toLayoutSi
ze(adjustedLocation)); | 646 updateHitTestResult(result, locationInContainer.point() - toLayoutSi
ze(adjustedLocation)); |
| 708 return true; | 647 return true; |
| 709 } | 648 } |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 // 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, | 1236 // 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, |
| 1298 // 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 | 1237 // 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 |
| 1299 // 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 | 1238 // 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 |
| 1300 // 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 | 1239 // 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 |
| 1301 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. | 1240 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. |
| 1302 width += portionOfMarginNotConsumedByFloat(childMarginStart, cb->startOffset
ForContent(), cb->startOffsetForLine(false)); | 1241 width += portionOfMarginNotConsumedByFloat(childMarginStart, cb->startOffset
ForContent(), cb->startOffsetForLine(false)); |
| 1303 width += portionOfMarginNotConsumedByFloat(childMarginEnd, cb->endOffsetForC
ontent(), cb->endOffsetForLine(false)); | 1242 width += portionOfMarginNotConsumedByFloat(childMarginEnd, cb->endOffsetForC
ontent(), cb->endOffsetForLine(false)); |
| 1304 return width; | 1243 return width; |
| 1305 } | 1244 } |
| 1306 | 1245 |
| 1307 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const | |
| 1308 { | |
| 1309 if (hasOverrideContainingBlockLogicalWidth()) | |
| 1310 return overrideContainingBlockContentLogicalWidth(); | |
| 1311 | |
| 1312 RenderBlock* cb = containingBlock(); | |
| 1313 return cb->availableLogicalWidth(); | |
| 1314 } | |
| 1315 | |
| 1316 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei
ghtType heightType) const | 1246 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei
ghtType heightType) const |
| 1317 { | 1247 { |
| 1318 if (hasOverrideContainingBlockLogicalHeight()) | 1248 return containingBlock()->availableLogicalHeight(heightType); |
| 1319 return overrideContainingBlockContentLogicalHeight(); | |
| 1320 | |
| 1321 RenderBlock* cb = containingBlock(); | |
| 1322 return cb->availableLogicalHeight(heightType); | |
| 1323 } | 1249 } |
| 1324 | 1250 |
| 1325 LayoutUnit RenderBox::containingBlockAvailableLineWidth() const | 1251 LayoutUnit RenderBox::containingBlockAvailableLineWidth() const |
| 1326 { | 1252 { |
| 1327 RenderBlock* cb = containingBlock(); | 1253 RenderBlock* cb = containingBlock(); |
| 1328 if (cb->isRenderBlockFlow()) | 1254 if (cb->isRenderBlockFlow()) |
| 1329 return toRenderBlockFlow(cb)->availableLogicalWidthForLine(false); | 1255 return toRenderBlockFlow(cb)->availableLogicalWidthForLine(false); |
| 1330 return 0; | 1256 return 0; |
| 1331 } | 1257 } |
| 1332 | 1258 |
| 1333 LayoutUnit RenderBox::perpendicularContainingBlockLogicalHeight() const | |
| 1334 { | |
| 1335 if (hasOverrideContainingBlockLogicalHeight()) | |
| 1336 return overrideContainingBlockContentLogicalHeight(); | |
| 1337 | |
| 1338 RenderBlock* cb = containingBlock(); | |
| 1339 if (cb->hasOverrideHeight()) | |
| 1340 return cb->overrideLogicalContentHeight(); | |
| 1341 | |
| 1342 RenderStyle* containingBlockStyle = cb->style(); | |
| 1343 Length logicalHeightLength = containingBlockStyle->logicalHeight(); | |
| 1344 | |
| 1345 // FIXME: For now just support fixed heights. Eventually should support per
centage heights as well. | |
| 1346 if (!logicalHeightLength.isFixed()) { | |
| 1347 LayoutUnit fillFallbackExtent = view()->frameView()->unscaledVisibleCont
entSize().height(); | |
| 1348 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | |
| 1349 return std::min(fillAvailableExtent, fillFallbackExtent); | |
| 1350 } | |
| 1351 | |
| 1352 // Use the content box logical height as specified by the style. | |
| 1353 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); | |
| 1354 } | |
| 1355 | |
| 1356 void RenderBox::mapLocalToContainer(const RenderLayerModelObject* paintInvalidat
ionContainer, TransformState& transformState, MapCoordinatesFlags mode, const Pa
intInvalidationState* paintInvalidationState) const | 1259 void RenderBox::mapLocalToContainer(const RenderLayerModelObject* paintInvalidat
ionContainer, TransformState& transformState, MapCoordinatesFlags mode, const Pa
intInvalidationState* paintInvalidationState) const |
| 1357 { | 1260 { |
| 1358 if (paintInvalidationContainer == this) | 1261 if (paintInvalidationContainer == this) |
| 1359 return; | 1262 return; |
| 1360 | 1263 |
| 1361 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1264 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
| 1362 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); | 1265 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); |
| 1363 if (style()->hasInFlowPosition() && layer()) | 1266 if (style()->hasInFlowPosition() && layer()) |
| 1364 offset += layer()->offsetForInFlowPosition(); | 1267 offset += layer()->offsetForInFlowPosition(); |
| 1365 transformState.move(offset); | 1268 transformState.move(offset); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 return; | 1527 return; |
| 1625 } | 1528 } |
| 1626 | 1529 |
| 1627 bool treatAsReplaced = shouldComputeSizeAsReplaced(); | 1530 bool treatAsReplaced = shouldComputeSizeAsReplaced(); |
| 1628 | 1531 |
| 1629 RenderStyle* styleToUse = style(); | 1532 RenderStyle* styleToUse = style(); |
| 1630 Length logicalWidthLength = treatAsReplaced ? Length(computeReplacedLogicalW
idth(), Fixed) : styleToUse->logicalWidth(); | 1533 Length logicalWidthLength = treatAsReplaced ? Length(computeReplacedLogicalW
idth(), Fixed) : styleToUse->logicalWidth(); |
| 1631 | 1534 |
| 1632 RenderBlock* cb = containingBlock(); | 1535 RenderBlock* cb = containingBlock(); |
| 1633 LayoutUnit containerLogicalWidth = std::max<LayoutUnit>(0, containingBlockLo
gicalWidthForContent()); | 1536 LayoutUnit containerLogicalWidth = std::max<LayoutUnit>(0, containingBlockLo
gicalWidthForContent()); |
| 1634 // FIXME(sky): Remove | |
| 1635 bool hasPerpendicularContainingBlock = false; | |
| 1636 | 1537 |
| 1637 if (isInline() && !isInlineBlock()) { | 1538 if (isInline() && !isInlineBlock()) { |
| 1638 // just calculate margins | 1539 // just calculate margins |
| 1639 computedValues.m_margins.m_start = minimumValueForLength(styleToUse->mar
ginStart(), containerLogicalWidth); | 1540 computedValues.m_margins.m_start = minimumValueForLength(styleToUse->mar
ginStart(), containerLogicalWidth); |
| 1640 computedValues.m_margins.m_end = minimumValueForLength(styleToUse->margi
nEnd(), containerLogicalWidth); | 1541 computedValues.m_margins.m_end = minimumValueForLength(styleToUse->margi
nEnd(), containerLogicalWidth); |
| 1641 if (treatAsReplaced) | 1542 if (treatAsReplaced) |
| 1642 computedValues.m_extent = std::max<LayoutUnit>(floatValueForLength(l
ogicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth
()); | 1543 computedValues.m_extent = std::max<LayoutUnit>(floatValueForLength(l
ogicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth
()); |
| 1643 return; | 1544 return; |
| 1644 } | 1545 } |
| 1645 | 1546 |
| 1646 // Width calculations | 1547 // Width calculations |
| 1647 if (treatAsReplaced) | 1548 if (treatAsReplaced) |
| 1648 computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingL
ogicalWidth(); | 1549 computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingL
ogicalWidth(); |
| 1649 else { | 1550 else { |
| 1650 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; | 1551 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse->logicalWidth(), containerLogicalWidth, cb); |
| 1651 if (hasPerpendicularContainingBlock) | 1552 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerLogicalWidth, cb); |
| 1652 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); | |
| 1653 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize
, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb); | |
| 1654 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth,
containerWidthInInlineDirection, cb); | |
| 1655 } | 1553 } |
| 1656 | 1554 |
| 1657 // Margin calculations. | 1555 // Margin calculations. |
| 1658 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, | 1556 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu
tedValues.m_extent, computedValues.m_margins.m_start, |
| 1659 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE
nd()); | 1557 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE
nd()); |
| 1660 | 1558 |
| 1661 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo
gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp
utedValues.m_margins.m_end) | 1559 if (containerLogicalWidth && containerLogicalWidth != (computedValues.m_exte
nt + computedValues.m_margins.m_start + computedValues.m_margins.m_end) |
| 1662 && !isInline() && !cb->isFlexibleBox()) { | 1560 && !isInline() && !cb->isFlexibleBox()) { |
| 1663 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent -
cb->marginStartForChild(this); | 1561 LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent -
cb->marginStartForChild(this); |
| 1664 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty
le()->isLeftToRightDirection(); | 1562 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != sty
le()->isLeftToRightDirection(); |
| 1665 if (hasInvertedDirection) | 1563 if (hasInvertedDirection) |
| 1666 computedValues.m_margins.m_start = newMargin; | 1564 computedValues.m_margins.m_start = newMargin; |
| 1667 else | 1565 else |
| 1668 computedValues.m_margins.m_end = newMargin; | 1566 computedValues.m_margins.m_end = newMargin; |
| 1669 } | 1567 } |
| 1670 } | 1568 } |
| 1671 | 1569 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 cb = cb->containingBlock(); | 1851 cb = cb->containingBlock(); |
| 1954 } | 1852 } |
| 1955 cb->addPercentHeightDescendant(const_cast<RenderBox*>(this)); | 1853 cb->addPercentHeightDescendant(const_cast<RenderBox*>(this)); |
| 1956 | 1854 |
| 1957 RenderStyle* cbstyle = cb->style(); | 1855 RenderStyle* cbstyle = cb->style(); |
| 1958 | 1856 |
| 1959 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height | 1857 // A positioned element that specified both top/bottom or that specifies hei
ght should be treated as though it has a height |
| 1960 // explicitly specified that can be used for any percentage computations. | 1858 // explicitly specified that can be used for any percentage computations. |
| 1961 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned()
&& (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c
bstyle->logicalBottom().isAuto())); | 1859 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned()
&& (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c
bstyle->logicalBottom().isAuto())); |
| 1962 | 1860 |
| 1963 if (hasOverrideContainingBlockLogicalHeight()) | 1861 if (cbstyle->logicalHeight().isFixed()) { |
| 1964 availableHeight = overrideContainingBlockContentLogicalHeight(); | |
| 1965 else if (cbstyle->logicalHeight().isFixed()) { | |
| 1966 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz
ing(cbstyle->logicalHeight().value()); | 1862 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz
ing(cbstyle->logicalHeight().value()); |
| 1967 availableHeight = std::max<LayoutUnit>(0, cb->constrainContentBoxLogical
HeightByMinMax(contentBoxHeight, -1)); | 1863 availableHeight = std::max<LayoutUnit>(0, cb->constrainContentBoxLogical
HeightByMinMax(contentBoxHeight, -1)); |
| 1968 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit
hSpecifiedHeight) { | 1864 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit
hSpecifiedHeight) { |
| 1969 // We need to recur and compute the percentage height for our containing
block. | 1865 // We need to recur and compute the percentage height for our containing
block. |
| 1970 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst
yle->logicalHeight()); | 1866 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst
yle->logicalHeight()); |
| 1971 if (heightWithScrollbar != -1) { | 1867 if (heightWithScrollbar != -1) { |
| 1972 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic
alHeightForBoxSizing(heightWithScrollbar); | 1868 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic
alHeightForBoxSizing(heightWithScrollbar); |
| 1973 // We need to adjust for min/max height because this method does not | 1869 // We need to adjust for min/max height because this method does not |
| 1974 // handle the min/max of the current block, its caller does. So the | 1870 // handle the min/max of the current block, its caller does. So the |
| 1975 // return value from the recursive call will not have been adjusted | 1871 // return value from the recursive call will not have been adjusted |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3729 | 3625 |
| 3730 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3626 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 3731 { | 3627 { |
| 3732 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3628 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 3733 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3629 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 3734 ASSERT(hasBackground == style.hasBackground()); | 3630 ASSERT(hasBackground == style.hasBackground()); |
| 3735 hasBorder = style.hasBorder(); | 3631 hasBorder = style.hasBorder(); |
| 3736 } | 3632 } |
| 3737 | 3633 |
| 3738 } // namespace blink | 3634 } // namespace blink |
| OLD | NEW |