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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "core/rendering/RenderTheme.h" | 54 #include "core/rendering/RenderTheme.h" |
55 #include "core/rendering/RenderView.h" | 55 #include "core/rendering/RenderView.h" |
56 #include "core/rendering/compositing/RenderLayerCompositor.h" | 56 #include "core/rendering/compositing/RenderLayerCompositor.h" |
57 #include "platform/LengthFunctions.h" | 57 #include "platform/LengthFunctions.h" |
58 #include "platform/geometry/FloatQuad.h" | 58 #include "platform/geometry/FloatQuad.h" |
59 #include "platform/geometry/TransformState.h" | 59 #include "platform/geometry/TransformState.h" |
60 #include "platform/graphics/GraphicsContextStateSaver.h" | 60 #include "platform/graphics/GraphicsContextStateSaver.h" |
61 #include <algorithm> | 61 #include <algorithm> |
62 #include <math.h> | 62 #include <math.h> |
63 | 63 |
64 using namespace std; | |
65 | |
66 namespace WebCore { | 64 namespace WebCore { |
67 | 65 |
68 using namespace HTMLNames; | 66 using namespace HTMLNames; |
69 | 67 |
70 // Used by flexible boxes when flexing this element and by table cells. | 68 // Used by flexible boxes when flexing this element and by table cells. |
71 typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap; | 69 typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap; |
72 | 70 |
73 // Used by grid elements to properly size their grid items. | 71 // Used by grid elements to properly size their grid items. |
74 // FIXME: Move these into RenderBoxRareData. | 72 // FIXME: Move these into RenderBoxRareData. |
75 static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0; | 73 static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = 0; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 return snapSizeToPixel(offsetHeight(), y() + clientTop()); | 361 return snapSizeToPixel(offsetHeight(), y() + clientTop()); |
364 } | 362 } |
365 | 363 |
366 LayoutUnit RenderBox::scrollWidth() const | 364 LayoutUnit RenderBox::scrollWidth() const |
367 { | 365 { |
368 if (hasOverflowClip()) | 366 if (hasOverflowClip()) |
369 return layer()->scrollableArea()->scrollWidth(); | 367 return layer()->scrollableArea()->scrollWidth(); |
370 // For objects with visible overflow, this matches IE. | 368 // For objects with visible overflow, this matches IE. |
371 // FIXME: Need to work right with writing modes. | 369 // FIXME: Need to work right with writing modes. |
372 if (style()->isLeftToRightDirection()) | 370 if (style()->isLeftToRightDirection()) |
373 return max(clientWidth(), layoutOverflowRect().maxX() - borderLeft()); | 371 return std::max(clientWidth(), layoutOverflowRect().maxX() - borderLeft(
)); |
374 return clientWidth() - min<LayoutUnit>(0, layoutOverflowRect().x() - borderL
eft()); | 372 return clientWidth() - std::min<LayoutUnit>(0, layoutOverflowRect().x() - bo
rderLeft()); |
375 } | 373 } |
376 | 374 |
377 LayoutUnit RenderBox::scrollHeight() const | 375 LayoutUnit RenderBox::scrollHeight() const |
378 { | 376 { |
379 if (hasOverflowClip()) | 377 if (hasOverflowClip()) |
380 return layer()->scrollableArea()->scrollHeight(); | 378 return layer()->scrollableArea()->scrollHeight(); |
381 // For objects with visible overflow, this matches IE. | 379 // For objects with visible overflow, this matches IE. |
382 // FIXME: Need to work right with writing modes. | 380 // FIXME: Need to work right with writing modes. |
383 return max(clientHeight(), layoutOverflowRect().maxY() - borderTop()); | 381 return std::max(clientHeight(), layoutOverflowRect().maxY() - borderTop()); |
384 } | 382 } |
385 | 383 |
386 LayoutUnit RenderBox::scrollLeft() const | 384 LayoutUnit RenderBox::scrollLeft() const |
387 { | 385 { |
388 return hasOverflowClip() ? layer()->scrollableArea()->scrollXOffset() : 0; | 386 return hasOverflowClip() ? layer()->scrollableArea()->scrollXOffset() : 0; |
389 } | 387 } |
390 | 388 |
391 LayoutUnit RenderBox::scrollTop() const | 389 LayoutUnit RenderBox::scrollTop() const |
392 { | 390 { |
393 return hasOverflowClip() ? layer()->scrollableArea()->scrollYOffset() : 0; | 391 return hasOverflowClip() ? layer()->scrollableArea()->scrollYOffset() : 0; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 if (isHTMLFrameElement(*ownerElement) || isHTMLIFrameElement(*ow
nerElement)) | 480 if (isHTMLFrameElement(*ownerElement) || isHTMLIFrameElement(*ow
nerElement)) |
483 frameElementBase = toHTMLFrameElementBase(ownerElement); | 481 frameElementBase = toHTMLFrameElementBase(ownerElement); |
484 | 482 |
485 if (frameElementAndViewPermitScroll(frameElementBase, frameView)
) { | 483 if (frameElementAndViewPermitScroll(frameElementBase, frameView)
) { |
486 LayoutRect viewRect = frameView->visibleContentRect(); | 484 LayoutRect viewRect = frameView->visibleContentRect(); |
487 LayoutRect exposeRect = ScrollAlignment::getRectToExpose(vie
wRect, rect, alignX, alignY); | 485 LayoutRect exposeRect = ScrollAlignment::getRectToExpose(vie
wRect, rect, alignX, alignY); |
488 | 486 |
489 int xOffset = roundToInt(exposeRect.x()); | 487 int xOffset = roundToInt(exposeRect.x()); |
490 int yOffset = roundToInt(exposeRect.y()); | 488 int yOffset = roundToInt(exposeRect.y()); |
491 // Adjust offsets if they're outside of the allowable range. | 489 // Adjust offsets if they're outside of the allowable range. |
492 xOffset = max(0, min(frameView->contentsWidth(), xOffset)); | 490 xOffset = std::max(0, std::min(frameView->contentsWidth(), x
Offset)); |
493 yOffset = max(0, min(frameView->contentsHeight(), yOffset)); | 491 yOffset = std::max(0, std::min(frameView->contentsHeight(),
yOffset)); |
494 | 492 |
495 frameView->setScrollPosition(IntPoint(xOffset, yOffset)); | 493 frameView->setScrollPosition(IntPoint(xOffset, yOffset)); |
496 if (frameView->safeToPropagateScrollToParent()) { | 494 if (frameView->safeToPropagateScrollToParent()) { |
497 parentBox = ownerElement->renderer()->enclosingBox(); | 495 parentBox = ownerElement->renderer()->enclosingBox(); |
498 // FIXME: This doesn't correctly convert the rect to | 496 // FIXME: This doesn't correctly convert the rect to |
499 // absolute coordinates in the parent. | 497 // absolute coordinates in the parent. |
500 newRect.setX(rect.x() - frameView->scrollX() + frameView
->x()); | 498 newRect.setX(rect.x() - frameView->scrollX() + frameView
->x()); |
501 newRect.setY(rect.y() - frameView->scrollY() + frameView
->y()); | 499 newRect.setY(rect.y() - frameView->scrollY() + frameView
->y()); |
502 } else { | 500 } else { |
503 parentBox = 0; | 501 parentBox = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 { | 536 { |
539 // Transform-origin depends on box size, so we need to update the layer tran
sform after layout. | 537 // Transform-origin depends on box size, so we need to update the layer tran
sform after layout. |
540 if (hasLayer()) | 538 if (hasLayer()) |
541 layer()->updateTransformationMatrix(); | 539 layer()->updateTransformationMatrix(); |
542 } | 540 } |
543 | 541 |
544 LayoutUnit RenderBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, Lay
outUnit availableWidth, RenderBlock* cb) const | 542 LayoutUnit RenderBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, Lay
outUnit availableWidth, RenderBlock* cb) const |
545 { | 543 { |
546 RenderStyle* styleToUse = style(); | 544 RenderStyle* styleToUse = style(); |
547 if (!styleToUse->logicalMaxWidth().isUndefined()) | 545 if (!styleToUse->logicalMaxWidth().isUndefined()) |
548 logicalWidth = min(logicalWidth, computeLogicalWidthUsing(MaxSize, style
ToUse->logicalMaxWidth(), availableWidth, cb)); | 546 logicalWidth = std::min(logicalWidth, computeLogicalWidthUsing(MaxSize,
styleToUse->logicalMaxWidth(), availableWidth, cb)); |
549 return max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse->logic
alMinWidth(), availableWidth, cb)); | 547 return std::max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse->
logicalMinWidth(), availableWidth, cb)); |
550 } | 548 } |
551 | 549 |
552 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L
ayoutUnit intrinsicContentHeight) const | 550 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L
ayoutUnit intrinsicContentHeight) const |
553 { | 551 { |
554 RenderStyle* styleToUse = style(); | 552 RenderStyle* styleToUse = style(); |
555 if (!styleToUse->logicalMaxHeight().isUndefined()) { | 553 if (!styleToUse->logicalMaxHeight().isUndefined()) { |
556 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight
(), intrinsicContentHeight); | 554 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight
(), intrinsicContentHeight); |
557 if (maxH != -1) | 555 if (maxH != -1) |
558 logicalHeight = min(logicalHeight, maxH); | 556 logicalHeight = std::min(logicalHeight, maxH); |
559 } | 557 } |
560 return max(logicalHeight, computeLogicalHeightUsing(styleToUse->logicalMinHe
ight(), intrinsicContentHeight)); | 558 return std::max(logicalHeight, computeLogicalHeightUsing(styleToUse->logical
MinHeight(), intrinsicContentHeight)); |
561 } | 559 } |
562 | 560 |
563 LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
lHeight, LayoutUnit intrinsicContentHeight) const | 561 LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
lHeight, LayoutUnit intrinsicContentHeight) const |
564 { | 562 { |
565 RenderStyle* styleToUse = style(); | 563 RenderStyle* styleToUse = style(); |
566 if (!styleToUse->logicalMaxHeight().isUndefined()) { | 564 if (!styleToUse->logicalMaxHeight().isUndefined()) { |
567 LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeig
ht(), intrinsicContentHeight); | 565 LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeig
ht(), intrinsicContentHeight); |
568 if (maxH != -1) | 566 if (maxH != -1) |
569 logicalHeight = min(logicalHeight, maxH); | 567 logicalHeight = std::min(logicalHeight, maxH); |
570 } | 568 } |
571 return max(logicalHeight, computeContentLogicalHeight(styleToUse->logicalMin
Height(), intrinsicContentHeight)); | 569 return std::max(logicalHeight, computeContentLogicalHeight(styleToUse->logic
alMinHeight(), intrinsicContentHeight)); |
572 } | 570 } |
573 | 571 |
574 IntRect RenderBox::absoluteContentBox() const | 572 IntRect RenderBox::absoluteContentBox() const |
575 { | 573 { |
576 // This is wrong with transforms and flipped writing modes. | 574 // This is wrong with transforms and flipped writing modes. |
577 IntRect rect = pixelSnappedIntRect(contentBoxRect()); | 575 IntRect rect = pixelSnappedIntRect(contentBoxRect()); |
578 FloatPoint absPos = localToAbsolute(); | 576 FloatPoint absPos = localToAbsolute(); |
579 rect.move(absPos.x(), absPos.y()); | 577 rect.move(absPos.x(), absPos.y()); |
580 return rect; | 578 return rect; |
581 } | 579 } |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 { | 1033 { |
1036 if (gOverrideContainingBlockLogicalHeightMap) | 1034 if (gOverrideContainingBlockLogicalHeightMap) |
1037 gOverrideContainingBlockLogicalHeightMap->remove(this); | 1035 gOverrideContainingBlockLogicalHeightMap->remove(this); |
1038 } | 1036 } |
1039 | 1037 |
1040 LayoutUnit RenderBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width)
const | 1038 LayoutUnit RenderBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width)
const |
1041 { | 1039 { |
1042 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); | 1040 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); |
1043 if (style()->boxSizing() == CONTENT_BOX) | 1041 if (style()->boxSizing() == CONTENT_BOX) |
1044 return width + bordersPlusPadding; | 1042 return width + bordersPlusPadding; |
1045 return max(width, bordersPlusPadding); | 1043 return std::max(width, bordersPlusPadding); |
1046 } | 1044 } |
1047 | 1045 |
1048 LayoutUnit RenderBox::adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height
) const | 1046 LayoutUnit RenderBox::adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height
) const |
1049 { | 1047 { |
1050 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight(); | 1048 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight(); |
1051 if (style()->boxSizing() == CONTENT_BOX) | 1049 if (style()->boxSizing() == CONTENT_BOX) |
1052 return height + bordersPlusPadding; | 1050 return height + bordersPlusPadding; |
1053 return max(height, bordersPlusPadding); | 1051 return std::max(height, bordersPlusPadding); |
1054 } | 1052 } |
1055 | 1053 |
1056 LayoutUnit RenderBox::adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width)
const | 1054 LayoutUnit RenderBox::adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width)
const |
1057 { | 1055 { |
1058 if (style()->boxSizing() == BORDER_BOX) | 1056 if (style()->boxSizing() == BORDER_BOX) |
1059 width -= borderAndPaddingLogicalWidth(); | 1057 width -= borderAndPaddingLogicalWidth(); |
1060 return max<LayoutUnit>(0, width); | 1058 return std::max<LayoutUnit>(0, width); |
1061 } | 1059 } |
1062 | 1060 |
1063 LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit heigh
t) const | 1061 LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit heigh
t) const |
1064 { | 1062 { |
1065 if (style()->boxSizing() == BORDER_BOX) | 1063 if (style()->boxSizing() == BORDER_BOX) |
1066 height -= borderAndPaddingLogicalHeight(); | 1064 height -= borderAndPaddingLogicalHeight(); |
1067 return max<LayoutUnit>(0, height); | 1065 return std::max<LayoutUnit>(0, height); |
1068 } | 1066 } |
1069 | 1067 |
1070 // Hit Testing | 1068 // Hit Testing |
1071 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs
et, HitTestAction action) | 1069 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs
et, HitTestAction action) |
1072 { | 1070 { |
1073 LayoutPoint adjustedLocation = accumulatedOffset + location(); | 1071 LayoutPoint adjustedLocation = accumulatedOffset + location(); |
1074 | 1072 |
1075 // Check kids first. | 1073 // Check kids first. |
1076 for (RenderObject* child = slowLastChild(); child; child = child->previousSi
bling()) { | 1074 for (RenderObject* child = slowLastChild(); child; child = child->previousSi
bling()) { |
1077 if ((!child->hasLayer() || !toRenderLayerModelObject(child)->layer()->is
SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer,
adjustedLocation, action)) { | 1075 if ((!child->hasLayer() || !toRenderLayerModelObject(child)->layer()->is
SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer,
adjustedLocation, action)) { |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 | 1525 |
1528 if (FrameView* frameView = toRenderView(layerRenderer)->fram
eView()) { | 1526 if (FrameView* frameView = toRenderView(layerRenderer)->fram
eView()) { |
1529 rw = frameView->contentsWidth(); | 1527 rw = frameView->contentsWidth(); |
1530 rh = frameView->contentsHeight(); | 1528 rh = frameView->contentsHeight(); |
1531 } else { | 1529 } else { |
1532 rw = layerRenderer->width(); | 1530 rw = layerRenderer->width(); |
1533 rh = layerRenderer->height(); | 1531 rh = layerRenderer->height(); |
1534 } | 1532 } |
1535 rendererRect = LayoutRect(-layerRenderer->marginLeft(), | 1533 rendererRect = LayoutRect(-layerRenderer->marginLeft(), |
1536 -layerRenderer->marginTop(), | 1534 -layerRenderer->marginTop(), |
1537 max(layerRenderer->width() + layerRenderer->marginWidth(
) + layerRenderer->borderLeft() + layerRenderer->borderRight(), rw), | 1535 std::max(layerRenderer->width() + layerRenderer->marginW
idth() + layerRenderer->borderLeft() + layerRenderer->borderRight(), rw), |
1538 max(layerRenderer->height() + layerRenderer->marginHeigh
t() + layerRenderer->borderTop() + layerRenderer->borderBottom(), rh)); | 1536 std::max(layerRenderer->height() + layerRenderer->margin
Height() + layerRenderer->borderTop() + layerRenderer->borderBottom(), rh)); |
1539 } else { | 1537 } else { |
1540 layerRenderer = this; | 1538 layerRenderer = this; |
1541 rendererRect = borderBoxRect(); | 1539 rendererRect = borderBoxRect(); |
1542 } | 1540 } |
1543 } | 1541 } |
1544 | 1542 |
1545 BackgroundImageGeometry geometry; | 1543 BackgroundImageGeometry geometry; |
1546 layerRenderer->calculateBackgroundImageGeometry(0, curLayer, rendere
rRect, geometry); | 1544 layerRenderer->calculateBackgroundImageGeometry(0, curLayer, rendere
rRect, geometry); |
1547 if (geometry.hasNonLocalGeometry()) { | 1545 if (geometry.hasNonLocalGeometry()) { |
1548 // Rather than incur the costs of computing the paintContainer f
or renderers with fixed backgrounds | 1546 // Rather than incur the costs of computing the paintContainer f
or renderers with fixed backgrounds |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 return 0; | 1741 return 0; |
1744 LayoutUnit contentSideWithMargin = contentSide + childMargin; | 1742 LayoutUnit contentSideWithMargin = contentSide + childMargin; |
1745 if (offset > contentSideWithMargin) | 1743 if (offset > contentSideWithMargin) |
1746 return childMargin; | 1744 return childMargin; |
1747 return offset - contentSide; | 1745 return offset - contentSide; |
1748 } | 1746 } |
1749 | 1747 |
1750 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const | 1748 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const |
1751 { | 1749 { |
1752 LayoutUnit logicalTopPosition = logicalTop(); | 1750 LayoutUnit logicalTopPosition = logicalTop(); |
1753 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e) - max<LayoutUnit>(0, childMarginStart) - max<LayoutUnit>(0, childMarginEnd); | 1751 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e) - std::max<LayoutUnit>(0, childMarginStart) - std::max<LayoutUnit>(0, childMa
rginEnd); |
1754 | 1752 |
1755 // 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, | 1753 // 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, |
1756 // 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 | 1754 // 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 |
1757 // 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 | 1755 // 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 |
1758 // 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 | 1756 // 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 |
1759 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. | 1757 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. |
1760 width += portionOfMarginNotConsumedByFloat(childMarginStart, cb->startOffset
ForContent(), cb->startOffsetForLine(logicalTopPosition, false)); | 1758 width += portionOfMarginNotConsumedByFloat(childMarginStart, cb->startOffset
ForContent(), cb->startOffsetForLine(logicalTopPosition, false)); |
1761 width += portionOfMarginNotConsumedByFloat(childMarginEnd, cb->endOffsetForC
ontent(), cb->endOffsetForLine(logicalTopPosition, false)); | 1759 width += portionOfMarginNotConsumedByFloat(childMarginEnd, cb->endOffsetForC
ontent(), cb->endOffsetForLine(logicalTopPosition, false)); |
1762 return width; | 1760 return width; |
1763 } | 1761 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 if (cb->hasOverrideHeight()) | 1795 if (cb->hasOverrideHeight()) |
1798 return cb->overrideLogicalContentHeight(); | 1796 return cb->overrideLogicalContentHeight(); |
1799 | 1797 |
1800 RenderStyle* containingBlockStyle = cb->style(); | 1798 RenderStyle* containingBlockStyle = cb->style(); |
1801 Length logicalHeightLength = containingBlockStyle->logicalHeight(); | 1799 Length logicalHeightLength = containingBlockStyle->logicalHeight(); |
1802 | 1800 |
1803 // FIXME: For now just support fixed heights. Eventually should support per
centage heights as well. | 1801 // FIXME: For now just support fixed heights. Eventually should support per
centage heights as well. |
1804 if (!logicalHeightLength.isFixed()) { | 1802 if (!logicalHeightLength.isFixed()) { |
1805 LayoutUnit fillFallbackExtent = containingBlockStyle->isHorizontalWritin
gMode() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWid
th(); | 1803 LayoutUnit fillFallbackExtent = containingBlockStyle->isHorizontalWritin
gMode() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWid
th(); |
1806 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 1804 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
1807 return min(fillAvailableExtent, fillFallbackExtent); | 1805 return std::min(fillAvailableExtent, fillFallbackExtent); |
1808 } | 1806 } |
1809 | 1807 |
1810 // Use the content box logical height as specified by the style. | 1808 // Use the content box logical height as specified by the style. |
1811 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); | 1809 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); |
1812 } | 1810 } |
1813 | 1811 |
1814 void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContain
er, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) co
nst | 1812 void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContain
er, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) co
nst |
1815 { | 1813 { |
1816 if (repaintContainer == this) | 1814 if (repaintContainer == this) |
1817 return; | 1815 return; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 continue; | 2150 continue; |
2153 | 2151 |
2154 RenderBox* listItem = toRenderBox(child); | 2152 RenderBox* listItem = toRenderBox(child); |
2155 for (RenderObject* itemChild = listItem->slowFirstChild(); itemChild; it
emChild = itemChild->nextSibling()) { | 2153 for (RenderObject* itemChild = listItem->slowFirstChild(); itemChild; it
emChild = itemChild->nextSibling()) { |
2156 if (!itemChild->isListMarker()) | 2154 if (!itemChild->isListMarker()) |
2157 continue; | 2155 continue; |
2158 RenderBox* itemMarker = toRenderBox(itemChild); | 2156 RenderBox* itemMarker = toRenderBox(itemChild); |
2159 // Make sure to compute the autosized width. | 2157 // Make sure to compute the autosized width. |
2160 if (itemMarker->needsLayout()) | 2158 if (itemMarker->needsLayout()) |
2161 itemMarker->layout(); | 2159 itemMarker->layout(); |
2162 maxWidth = max<float>(maxWidth, toRenderListMarker(itemMarker)->logi
calWidth().toFloat()); | 2160 maxWidth = std::max<float>(maxWidth, toRenderListMarker(itemMarker)-
>logicalWidth().toFloat()); |
2163 break; | 2161 break; |
2164 } | 2162 } |
2165 } | 2163 } |
2166 return maxWidth; | 2164 return maxWidth; |
2167 } | 2165 } |
2168 | 2166 |
2169 void RenderBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues)
const | 2167 void RenderBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues)
const |
2170 { | 2168 { |
2171 computedValues.m_extent = logicalWidth(); | 2169 computedValues.m_extent = logicalWidth(); |
2172 computedValues.m_position = logicalLeft(); | 2170 computedValues.m_position = logicalLeft(); |
(...skipping 23 matching lines...) Expand all Loading... |
2196 // FIXME: Account for block-flow in flexible boxes. | 2194 // FIXME: Account for block-flow in flexible boxes. |
2197 // https://bugs.webkit.org/show_bug.cgi?id=46418 | 2195 // https://bugs.webkit.org/show_bug.cgi?id=46418 |
2198 bool inVerticalBox = parent()->isDeprecatedFlexibleBox() && (parent()->style
()->boxOrient() == VERTICAL); | 2196 bool inVerticalBox = parent()->isDeprecatedFlexibleBox() && (parent()->style
()->boxOrient() == VERTICAL); |
2199 bool stretching = (parent()->style()->boxAlign() == BSTRETCH); | 2197 bool stretching = (parent()->style()->boxAlign() == BSTRETCH); |
2200 bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !
stretching); | 2198 bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !
stretching); |
2201 | 2199 |
2202 RenderStyle* styleToUse = style(); | 2200 RenderStyle* styleToUse = style(); |
2203 Length logicalWidthLength = treatAsReplaced ? Length(computeReplacedLogicalW
idth(), Fixed) : styleToUse->logicalWidth(); | 2201 Length logicalWidthLength = treatAsReplaced ? Length(computeReplacedLogicalW
idth(), Fixed) : styleToUse->logicalWidth(); |
2204 | 2202 |
2205 RenderBlock* cb = containingBlock(); | 2203 RenderBlock* cb = containingBlock(); |
2206 LayoutUnit containerLogicalWidth = max<LayoutUnit>(0, containingBlockLogical
WidthForContent()); | 2204 LayoutUnit containerLogicalWidth = std::max<LayoutUnit>(0, containingBlockLo
gicalWidthForContent()); |
2207 bool hasPerpendicularContainingBlock = cb->isHorizontalWritingMode() != isHo
rizontalWritingMode(); | 2205 bool hasPerpendicularContainingBlock = cb->isHorizontalWritingMode() != isHo
rizontalWritingMode(); |
2208 | 2206 |
2209 if (isInline() && !isInlineBlockOrInlineTable()) { | 2207 if (isInline() && !isInlineBlockOrInlineTable()) { |
2210 // just calculate margins | 2208 // just calculate margins |
2211 computedValues.m_margins.m_start = minimumValueForLength(styleToUse->mar
ginStart(), containerLogicalWidth); | 2209 computedValues.m_margins.m_start = minimumValueForLength(styleToUse->mar
ginStart(), containerLogicalWidth); |
2212 computedValues.m_margins.m_end = minimumValueForLength(styleToUse->margi
nEnd(), containerLogicalWidth); | 2210 computedValues.m_margins.m_end = minimumValueForLength(styleToUse->margi
nEnd(), containerLogicalWidth); |
2213 if (treatAsReplaced) | 2211 if (treatAsReplaced) |
2214 computedValues.m_extent = max<LayoutUnit>(floatValueForLength(logica
lWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()); | 2212 computedValues.m_extent = std::max<LayoutUnit>(floatValueForLength(l
ogicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth
()); |
2215 return; | 2213 return; |
2216 } | 2214 } |
2217 | 2215 |
2218 // Width calculations | 2216 // Width calculations |
2219 if (treatAsReplaced) | 2217 if (treatAsReplaced) |
2220 computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingL
ogicalWidth(); | 2218 computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingL
ogicalWidth(); |
2221 else { | 2219 else { |
2222 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; | 2220 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; |
2223 if (hasPerpendicularContainingBlock) | 2221 if (hasPerpendicularContainingBlock) |
2224 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); | 2222 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 | 2277 |
2280 if (logicalWidthLength.type() == MinContent) | 2278 if (logicalWidthLength.type() == MinContent) |
2281 return minLogicalWidth + borderAndPadding; | 2279 return minLogicalWidth + borderAndPadding; |
2282 | 2280 |
2283 if (logicalWidthLength.type() == MaxContent) | 2281 if (logicalWidthLength.type() == MaxContent) |
2284 return maxLogicalWidth + borderAndPadding; | 2282 return maxLogicalWidth + borderAndPadding; |
2285 | 2283 |
2286 if (logicalWidthLength.type() == FitContent) { | 2284 if (logicalWidthLength.type() == FitContent) { |
2287 minLogicalWidth += borderAndPadding; | 2285 minLogicalWidth += borderAndPadding; |
2288 maxLogicalWidth += borderAndPadding; | 2286 maxLogicalWidth += borderAndPadding; |
2289 return max(minLogicalWidth, min(maxLogicalWidth, fillAvailableMeasure(av
ailableLogicalWidth))); | 2287 return std::max(minLogicalWidth, std::min(maxLogicalWidth, fillAvailable
Measure(availableLogicalWidth))); |
2290 } | 2288 } |
2291 | 2289 |
2292 ASSERT_NOT_REACHED(); | 2290 ASSERT_NOT_REACHED(); |
2293 return 0; | 2291 return 0; |
2294 } | 2292 } |
2295 | 2293 |
2296 LayoutUnit RenderBox::computeLogicalWidthUsing(SizeType widthType, const Length&
logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* cb) const | 2294 LayoutUnit RenderBox::computeLogicalWidthUsing(SizeType widthType, const Length&
logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* cb) const |
2297 { | 2295 { |
2298 if (!logicalWidth.isIntrinsicOrAuto()) { | 2296 if (!logicalWidth.isIntrinsicOrAuto()) { |
2299 // FIXME: If the containing block flow is perpendicular to our direction
we need to use the available logical height instead. | 2297 // FIXME: If the containing block flow is perpendicular to our direction
we need to use the available logical height instead. |
2300 return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWid
th, availableLogicalWidth)); | 2298 return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWid
th, availableLogicalWidth)); |
2301 } | 2299 } |
2302 | 2300 |
2303 if (logicalWidth.isIntrinsic()) | 2301 if (logicalWidth.isIntrinsic()) |
2304 return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalW
idth, borderAndPaddingLogicalWidth()); | 2302 return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalW
idth, borderAndPaddingLogicalWidth()); |
2305 | 2303 |
2306 LayoutUnit marginStart = 0; | 2304 LayoutUnit marginStart = 0; |
2307 LayoutUnit marginEnd = 0; | 2305 LayoutUnit marginEnd = 0; |
2308 LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth,
marginStart, marginEnd); | 2306 LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth,
marginStart, marginEnd); |
2309 | 2307 |
2310 if (shrinkToAvoidFloats() && cb->containsFloats()) | 2308 if (shrinkToAvoidFloats() && cb->containsFloats()) |
2311 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFl
oats(marginStart, marginEnd, toRenderBlockFlow(cb))); | 2309 logicalWidthResult = std::min(logicalWidthResult, shrinkLogicalWidthToAv
oidFloats(marginStart, marginEnd, toRenderBlockFlow(cb))); |
2312 | 2310 |
2313 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(logica
lWidth)) | 2311 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(logica
lWidth)) |
2314 return max(minPreferredLogicalWidth(), min(maxPreferredLogicalWidth(), l
ogicalWidthResult)); | 2312 return std::max(minPreferredLogicalWidth(), std::min(maxPreferredLogical
Width(), logicalWidthResult)); |
2315 return logicalWidthResult; | 2313 return logicalWidthResult; |
2316 } | 2314 } |
2317 | 2315 |
2318 static bool columnFlexItemHasStretchAlignment(const RenderObject* flexitem) | 2316 static bool columnFlexItemHasStretchAlignment(const RenderObject* flexitem) |
2319 { | 2317 { |
2320 RenderObject* parent = flexitem->parent(); | 2318 RenderObject* parent = flexitem->parent(); |
2321 // auto margins mean we don't stretch. Note that this function will only be
used for | 2319 // auto margins mean we don't stretch. Note that this function will only be
used for |
2322 // widths, so we don't have to check marginBefore/marginAfter. | 2320 // widths, so we don't have to check marginBefore/marginAfter. |
2323 ASSERT(parent->style()->isColumnFlexDirection()); | 2321 ASSERT(parent->style()->isColumnFlexDirection()); |
2324 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) | 2322 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 marginEndLength.setValue(0); | 2423 marginEndLength.setValue(0); |
2426 } | 2424 } |
2427 | 2425 |
2428 LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, conta
inerWidth); | 2426 LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, conta
inerWidth); |
2429 LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, container
Width); | 2427 LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, container
Width); |
2430 | 2428 |
2431 LayoutUnit availableWidth = containerWidth; | 2429 LayoutUnit availableWidth = containerWidth; |
2432 if (avoidsFloats() && containingBlock->containsFloats()) { | 2430 if (avoidsFloats() && containingBlock->containsFloats()) { |
2433 availableWidth = containingBlockAvailableLineWidth(); | 2431 availableWidth = containingBlockAvailableLineWidth(); |
2434 if (shrinkToAvoidFloats() && availableWidth < containerWidth) { | 2432 if (shrinkToAvoidFloats() && availableWidth < containerWidth) { |
2435 marginStart = max<LayoutUnit>(0, marginStartWidth); | 2433 marginStart = std::max<LayoutUnit>(0, marginStartWidth); |
2436 marginEnd = max<LayoutUnit>(0, marginEndWidth); | 2434 marginEnd = std::max<LayoutUnit>(0, marginEndWidth); |
2437 } | 2435 } |
2438 } | 2436 } |
2439 | 2437 |
2440 // CSS 2.1 (10.3.3): "If 'width' is not 'auto' and 'border-left-width' + 'pa
dding-left' + 'width' + 'padding-right' + 'border-right-width' | 2438 // CSS 2.1 (10.3.3): "If 'width' is not 'auto' and 'border-left-width' + 'pa
dding-left' + 'width' + 'padding-right' + 'border-right-width' |
2441 // (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larg
er than the width of the containing block, then any 'auto' | 2439 // (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larg
er than the width of the containing block, then any 'auto' |
2442 // values for 'margin-left' or 'margin-right' are, for the following rules,
treated as zero. | 2440 // values for 'margin-left' or 'margin-right' are, for the following rules,
treated as zero. |
2443 LayoutUnit marginBoxWidth = childWidth + (!style()->width().isAuto() ? margi
nStartWidth + marginEndWidth : LayoutUnit()); | 2441 LayoutUnit marginBoxWidth = childWidth + (!style()->width().isAuto() ? margi
nStartWidth + marginEndWidth : LayoutUnit()); |
2444 | 2442 |
2445 // CSS 2.1: "If both 'margin-left' and 'margin-right' are 'auto', their used
values are equal. This horizontally centers the element | 2443 // CSS 2.1: "If both 'margin-left' and 'margin-right' are 'auto', their used
values are equal. This horizontally centers the element |
2446 // with respect to the edges of the containing block." | 2444 // with respect to the edges of the containing block." |
2447 const RenderStyle* containingBlockStyle = containingBlock->style(); | 2445 const RenderStyle* containingBlockStyle = containingBlock->style(); |
2448 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && marginBoxWidt
h < availableWidth) | 2446 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && marginBoxWidt
h < availableWidth) |
2449 || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containi
ngBlockStyle->textAlign() == WEBKIT_CENTER)) { | 2447 || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containi
ngBlockStyle->textAlign() == WEBKIT_CENTER)) { |
2450 // Other browsers center the margin box for align=center elements so we
match them here. | 2448 // Other browsers center the margin box for align=center elements so we
match them here. |
2451 LayoutUnit centeredMarginBoxStart = max<LayoutUnit>(0, (availableWidth -
childWidth - marginStartWidth - marginEndWidth) / 2); | 2449 LayoutUnit centeredMarginBoxStart = std::max<LayoutUnit>(0, (availableWi
dth - childWidth - marginStartWidth - marginEndWidth) / 2); |
2452 marginStart = centeredMarginBoxStart + marginStartWidth; | 2450 marginStart = centeredMarginBoxStart + marginStartWidth; |
2453 marginEnd = availableWidth - childWidth - marginStart + marginEndWidth; | 2451 marginEnd = availableWidth - childWidth - marginStart + marginEndWidth; |
2454 return; | 2452 return; |
2455 } | 2453 } |
2456 | 2454 |
2457 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val
ue follows from the equality." | 2455 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val
ue follows from the equality." |
2458 if (marginEndLength.isAuto() && marginBoxWidth < availableWidth) { | 2456 if (marginEndLength.isAuto() && marginBoxWidth < availableWidth) { |
2459 marginStart = marginStartWidth; | 2457 marginStart = marginStartWidth; |
2460 marginEnd = availableWidth - childWidth - marginStart; | 2458 marginEnd = availableWidth - childWidth - marginStart; |
2461 return; | 2459 return; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 // <html> block in quirks mode. Only apply this quirk if the block is norma
l flow and no height | 2567 // <html> block in quirks mode. Only apply this quirk if the block is norma
l flow and no height |
2570 // is specified. When we're printing, we also need this quirk if the body or
root has a percentage | 2568 // is specified. When we're printing, we also need this quirk if the body or
root has a percentage |
2571 // height since we don't set a height in RenderView when we're printing. So
without this quirk, the | 2569 // height since we don't set a height in RenderView when we're printing. So
without this quirk, the |
2572 // height has nothing to be a percentage of, and it ends up being 0. That is
bad. | 2570 // height has nothing to be a percentage of, and it ends up being 0. That is
bad. |
2573 bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercent(
) | 2571 bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercent(
) |
2574 && (isDocumentElement() || (isBody() && document().documentElement()->re
nderer()->style()->logicalHeight().isPercent())) && !isInline(); | 2572 && (isDocumentElement() || (isBody() && document().documentElement()->re
nderer()->style()->logicalHeight().isPercent())) && !isInline(); |
2575 if (stretchesToViewport() || paginatedContentNeedsBaseHeight) { | 2573 if (stretchesToViewport() || paginatedContentNeedsBaseHeight) { |
2576 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter(); | 2574 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter(); |
2577 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages(); | 2575 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages(); |
2578 if (isDocumentElement()) | 2576 if (isDocumentElement()) |
2579 computedValues.m_extent = max(computedValues.m_extent, visibleHeight
- margins); | 2577 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - margins); |
2580 else { | 2578 else { |
2581 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo
re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight()
; | 2579 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo
re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight()
; |
2582 computedValues.m_extent = max(computedValues.m_extent, visibleHeight
- marginsBordersPadding); | 2580 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - marginsBordersPadding); |
2583 } | 2581 } |
2584 } | 2582 } |
2585 } | 2583 } |
2586 | 2584 |
2587 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit
intrinsicContentHeight) const | 2585 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit
intrinsicContentHeight) const |
2588 { | 2586 { |
2589 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
ht, intrinsicContentHeight); | 2587 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
ht, intrinsicContentHeight); |
2590 if (logicalHeight != -1) | 2588 if (logicalHeight != -1) |
2591 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); | 2589 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); |
2592 return logicalHeight; | 2590 return logicalHeight; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2692 RenderTableCell* cell = toRenderTableCell(cb); | 2690 RenderTableCell* cell = toRenderTableCell(cb); |
2693 if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAut
o() || !cell->table()->style()->logicalHeight().isAuto())) | 2691 if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAut
o() || !cell->table()->style()->logicalHeight().isAuto())) |
2694 return 0; | 2692 return 0; |
2695 return -1; | 2693 return -1; |
2696 } | 2694 } |
2697 availableHeight = cb->overrideLogicalContentHeight(); | 2695 availableHeight = cb->overrideLogicalContentHeight(); |
2698 includeBorderPadding = true; | 2696 includeBorderPadding = true; |
2699 } | 2697 } |
2700 } else if (cbstyle->logicalHeight().isFixed()) { | 2698 } else if (cbstyle->logicalHeight().isFixed()) { |
2701 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz
ing(cbstyle->logicalHeight().value()); | 2699 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz
ing(cbstyle->logicalHeight().value()); |
2702 availableHeight = max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeigh
tByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1)); | 2700 availableHeight = std::max<LayoutUnit>(0, cb->constrainContentBoxLogical
HeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1)); |
2703 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit
hSpecifiedHeight) { | 2701 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit
hSpecifiedHeight) { |
2704 // We need to recur and compute the percentage height for our containing
block. | 2702 // We need to recur and compute the percentage height for our containing
block. |
2705 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst
yle->logicalHeight()); | 2703 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst
yle->logicalHeight()); |
2706 if (heightWithScrollbar != -1) { | 2704 if (heightWithScrollbar != -1) { |
2707 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic
alHeightForBoxSizing(heightWithScrollbar); | 2705 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic
alHeightForBoxSizing(heightWithScrollbar); |
2708 // We need to adjust for min/max height because this method does not | 2706 // We need to adjust for min/max height because this method does not |
2709 // handle the min/max of the current block, its caller does. So the | 2707 // handle the min/max of the current block, its caller does. So the |
2710 // return value from the recursive call will not have been adjusted | 2708 // return value from the recursive call will not have been adjusted |
2711 // yet. | 2709 // yet. |
2712 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy
MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1); | 2710 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy
MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1); |
2713 availableHeight = max<LayoutUnit>(0, contentBoxHeight); | 2711 availableHeight = std::max<LayoutUnit>(0, contentBoxHeight); |
2714 } | 2712 } |
2715 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { | 2713 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { |
2716 // Don't allow this to affect the block' height() member variable, since
this | 2714 // Don't allow this to affect the block' height() member variable, since
this |
2717 // can get called while the block is still laying out its kids. | 2715 // can get called while the block is still laying out its kids. |
2718 LogicalExtentComputedValues computedValues; | 2716 LogicalExtentComputedValues computedValues; |
2719 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); | 2717 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); |
2720 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH
eight() - cb->scrollbarLogicalHeight(); | 2718 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH
eight() - cb->scrollbarLogicalHeight(); |
2721 } else if (cb->isRenderView()) | 2719 } else if (cb->isRenderView()) |
2722 availableHeight = view()->viewLogicalHeightForPercentages(); | 2720 availableHeight = view()->viewLogicalHeightForPercentages(); |
2723 | 2721 |
2724 if (availableHeight == -1) | 2722 if (availableHeight == -1) |
2725 return availableHeight; | 2723 return availableHeight; |
2726 | 2724 |
2727 availableHeight -= rootMarginBorderPaddingHeight; | 2725 availableHeight -= rootMarginBorderPaddingHeight; |
2728 | 2726 |
2729 LayoutUnit result = valueForLength(height, availableHeight); | 2727 LayoutUnit result = valueForLength(height, availableHeight); |
2730 if (includeBorderPadding) { | 2728 if (includeBorderPadding) { |
2731 // FIXME: Table cells should default to box-sizing: border-box so we can
avoid this hack. | 2729 // FIXME: Table cells should default to box-sizing: border-box so we can
avoid this hack. |
2732 // It is necessary to use the border-box to match WinIE's broken | 2730 // It is necessary to use the border-box to match WinIE's broken |
2733 // box model. This is essential for sizing inside | 2731 // box model. This is essential for sizing inside |
2734 // table cells using percentage heights. | 2732 // table cells using percentage heights. |
2735 result -= borderAndPaddingLogicalHeight(); | 2733 result -= borderAndPaddingLogicalHeight(); |
2736 return max<LayoutUnit>(0, result); | 2734 return std::max<LayoutUnit>(0, result); |
2737 } | 2735 } |
2738 return result; | 2736 return result; |
2739 } | 2737 } |
2740 | 2738 |
2741 LayoutUnit RenderBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC
omputePreferred) const | 2739 LayoutUnit RenderBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC
omputePreferred) const |
2742 { | 2740 { |
2743 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogic
alWidthUsing(style()->logicalWidth()), shouldComputePreferred); | 2741 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogic
alWidthUsing(style()->logicalWidth()), shouldComputePreferred); |
2744 } | 2742 } |
2745 | 2743 |
2746 LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUni
t logicalWidth, ShouldComputePreferred shouldComputePreferred) const | 2744 LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUni
t logicalWidth, ShouldComputePreferred shouldComputePreferred) const |
2747 { | 2745 { |
2748 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMinWidth().isPercent()) || style()->logicalMinWidth().isUndefine
d() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMinWidth()
); | 2746 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMinWidth().isPercent()) || style()->logicalMinWidth().isUndefine
d() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMinWidth()
); |
2749 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMaxWidth().isPercent()) || style()->logicalMaxWidth().isUndefine
d() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth()
); | 2747 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMaxWidth().isPercent()) || style()->logicalMaxWidth().isUndefine
d() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth()
); |
2750 return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth)); | 2748 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); |
2751 } | 2749 } |
2752 | 2750 |
2753 LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(const Length& logicalWidt
h) const | 2751 LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(const Length& logicalWidt
h) const |
2754 { | 2752 { |
2755 switch (logicalWidth.type()) { | 2753 switch (logicalWidth.type()) { |
2756 case Fixed: | 2754 case Fixed: |
2757 return adjustContentBoxLogicalWidthForBoxSizing(logicalWidth.value()
); | 2755 return adjustContentBoxLogicalWidthForBoxSizing(logicalWidth.value()
); |
2758 case MinContent: | 2756 case MinContent: |
2759 case MaxContent: { | 2757 case MaxContent: { |
2760 // MinContent/MaxContent don't need the availableLogicalWidth argume
nt. | 2758 // MinContent/MaxContent don't need the availableLogicalWidth argume
nt. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 | 2793 |
2796 LayoutUnit RenderBox::computeReplacedLogicalHeight() const | 2794 LayoutUnit RenderBox::computeReplacedLogicalHeight() const |
2797 { | 2795 { |
2798 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLog
icalHeightUsing(style()->logicalHeight())); | 2796 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLog
icalHeightUsing(style()->logicalHeight())); |
2799 } | 2797 } |
2800 | 2798 |
2801 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU
nit logicalHeight) const | 2799 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU
nit logicalHeight) const |
2802 { | 2800 { |
2803 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style()->log
icalMinHeight()); | 2801 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style()->log
icalMinHeight()); |
2804 LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? lo
gicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); | 2802 LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? lo
gicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); |
2805 return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight)); | 2803 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight))
; |
2806 } | 2804 } |
2807 | 2805 |
2808 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei
ght) const | 2806 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei
ght) const |
2809 { | 2807 { |
2810 switch (logicalHeight.type()) { | 2808 switch (logicalHeight.type()) { |
2811 case Fixed: | 2809 case Fixed: |
2812 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value
()); | 2810 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value
()); |
2813 case Percent: | 2811 case Percent: |
2814 case Calculated: | 2812 case Calculated: |
2815 { | 2813 { |
(...skipping 25 matching lines...) Expand all Loading... |
2841 availableHeight = containingBlockLogicalHeightForContent(Include
MarginBorderPadding); | 2839 availableHeight = containingBlockLogicalHeightForContent(Include
MarginBorderPadding); |
2842 // It is necessary to use the border-box to match WinIE's broken | 2840 // It is necessary to use the border-box to match WinIE's broken |
2843 // box model. This is essential for sizing inside | 2841 // box model. This is essential for sizing inside |
2844 // table cells using percentage heights. | 2842 // table cells using percentage heights. |
2845 // FIXME: This needs to be made block-flow-aware. If the cell a
nd image are perpendicular block-flows, this isn't right. | 2843 // FIXME: This needs to be made block-flow-aware. If the cell a
nd image are perpendicular block-flows, this isn't right. |
2846 // https://bugs.webkit.org/show_bug.cgi?id=46997 | 2844 // https://bugs.webkit.org/show_bug.cgi?id=46997 |
2847 while (cb && !cb->isRenderView() && (cb->style()->logicalHeight(
).isAuto() || cb->style()->logicalHeight().isPercent())) { | 2845 while (cb && !cb->isRenderView() && (cb->style()->logicalHeight(
).isAuto() || cb->style()->logicalHeight().isPercent())) { |
2848 if (cb->isTableCell()) { | 2846 if (cb->isTableCell()) { |
2849 // Don't let table cells squeeze percent-height replaced
elements | 2847 // Don't let table cells squeeze percent-height replaced
elements |
2850 // <http://bugs.webkit.org/show_bug.cgi?id=15359> | 2848 // <http://bugs.webkit.org/show_bug.cgi?id=15359> |
2851 availableHeight = max(availableHeight, intrinsicLogicalH
eight()); | 2849 availableHeight = std::max(availableHeight, intrinsicLog
icalHeight()); |
2852 return valueForLength(logicalHeight, availableHeight - b
orderAndPaddingLogicalHeight()); | 2850 return valueForLength(logicalHeight, availableHeight - b
orderAndPaddingLogicalHeight()); |
2853 } | 2851 } |
2854 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<Ren
derBox*>(this)); | 2852 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<Ren
derBox*>(this)); |
2855 cb = cb->containingBlock(); | 2853 cb = cb->containingBlock(); |
2856 } | 2854 } |
2857 } | 2855 } |
2858 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logi
calHeight, availableHeight)); | 2856 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logi
calHeight, availableHeight)); |
2859 } | 2857 } |
2860 case MinContent: | 2858 case MinContent: |
2861 case MaxContent: | 2859 case MaxContent: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 LayoutUnit fromLeft; | 2956 LayoutUnit fromLeft; |
2959 LayoutUnit fromRight; | 2957 LayoutUnit fromRight; |
2960 if (containingBlock->style()->isLeftToRightDirection()) { | 2958 if (containingBlock->style()->isLeftToRightDirection()) { |
2961 fromLeft = first->logicalLeft() + first->borderLogicalLeft(); | 2959 fromLeft = first->logicalLeft() + first->borderLogicalLeft(); |
2962 fromRight = last->logicalLeft() + last->logicalWidth() - last->borderLog
icalRight(); | 2960 fromRight = last->logicalLeft() + last->logicalWidth() - last->borderLog
icalRight(); |
2963 } else { | 2961 } else { |
2964 fromRight = first->logicalLeft() + first->logicalWidth() - first->border
LogicalRight(); | 2962 fromRight = first->logicalLeft() + first->logicalWidth() - first->border
LogicalRight(); |
2965 fromLeft = last->logicalLeft() + last->borderLogicalLeft(); | 2963 fromLeft = last->logicalLeft() + last->borderLogicalLeft(); |
2966 } | 2964 } |
2967 | 2965 |
2968 return max<LayoutUnit>(0, fromRight - fromLeft); | 2966 return std::max<LayoutUnit>(0, fromRight - fromLeft); |
2969 } | 2967 } |
2970 | 2968 |
2971 LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxM
odelObject* containingBlock, bool checkForPerpendicularWritingMode) const | 2969 LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxM
odelObject* containingBlock, bool checkForPerpendicularWritingMode) const |
2972 { | 2970 { |
2973 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting
Mode() != isHorizontalWritingMode()) | 2971 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWriting
Mode() != isHorizontalWritingMode()) |
2974 return containingBlockLogicalWidthForPositioned(containingBlock, false); | 2972 return containingBlockLogicalWidthForPositioned(containingBlock, false); |
2975 | 2973 |
2976 // Use viewport as container for top-level fixed-position elements. | 2974 // Use viewport as container for top-level fixed-position elements. |
2977 if (style()->position() == FixedPosition && containingBlock->isRenderView())
{ | 2975 if (style()->position() == FixedPosition && containingBlock->isRenderView())
{ |
2978 const RenderView* view = toRenderView(containingBlock); | 2976 const RenderView* view = toRenderView(containingBlock); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3182 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderLeft() : containerBlock->borderTop()); | 3180 logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->bo
rderLeft() : containerBlock->borderTop()); |
3183 } | 3181 } |
3184 } | 3182 } |
3185 | 3183 |
3186 void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUn
it logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedV
alues& computedValues) const | 3184 void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUn
it logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedV
alues& computedValues) const |
3187 { | 3185 { |
3188 // FIXME: would it be better to have shrink-to-fit in one step? | 3186 // FIXME: would it be better to have shrink-to-fit in one step? |
3189 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding; | 3187 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlusPadding; |
3190 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPaddi
ng; | 3188 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersPlusPaddi
ng; |
3191 LayoutUnit availableWidth = availableSpace - logicalLeftValue; | 3189 LayoutUnit availableWidth = availableSpace - logicalLeftValue; |
3192 computedValues.m_extent = min(max(preferredMinWidth, availableWidth), prefer
redWidth); | 3190 computedValues.m_extent = std::min(std::max(preferredMinWidth, availableWidt
h), preferredWidth); |
3193 } | 3191 } |
3194 | 3192 |
3195 void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
nderBoxModelObject* containerBlock, TextDirection containerDirection, | 3193 void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
nderBoxModelObject* containerBlock, TextDirection containerDirection, |
3196 LayoutUnit containerLogicalWi
dth, LayoutUnit bordersPlusPadding, | 3194 LayoutUnit containerLogicalWi
dth, LayoutUnit bordersPlusPadding, |
3197 const Length& logicalLeft, co
nst Length& logicalRight, const Length& marginLogicalLeft, | 3195 const Length& logicalLeft, co
nst Length& logicalRight, const Length& marginLogicalLeft, |
3198 const Length& marginLogicalRi
ght, LogicalExtentComputedValues& computedValues) const | 3196 const Length& marginLogicalRi
ght, LogicalExtentComputedValues& computedValues) const |
3199 { | 3197 { |
3200 if (logicalWidth.isIntrinsic()) | 3198 if (logicalWidth.isIntrinsic()) |
3201 logicalWidth = Length(computeIntrinsicLogicalWidthUsing(logicalWidth, co
ntainerLogicalWidth, bordersPlusPadding) - bordersPlusPadding, Fixed); | 3199 logicalWidth = Length(computeIntrinsicLogicalWidthUsing(logicalWidth, co
ntainerLogicalWidth, bordersPlusPadding) - bordersPlusPadding, Fixed); |
3202 | 3200 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 // FIXME: Is there a faster way to find the correct case? | 3318 // FIXME: Is there a faster way to find the correct case? |
3321 // Use rule/case that applies. | 3319 // Use rule/case that applies. |
3322 if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) { | 3320 if (logicalLeftIsAuto && logicalWidthIsAuto && !logicalRightIsAuto) { |
3323 // RULE 1: (use shrink-to-fit for width, and solve of left) | 3321 // RULE 1: (use shrink-to-fit for width, and solve of left) |
3324 LayoutUnit logicalRightValue = valueForLength(logicalRight, containe
rLogicalWidth); | 3322 LayoutUnit logicalRightValue = valueForLength(logicalRight, containe
rLogicalWidth); |
3325 | 3323 |
3326 // FIXME: would it be better to have shrink-to-fit in one step? | 3324 // FIXME: would it be better to have shrink-to-fit in one step? |
3327 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlus
Padding; | 3325 LayoutUnit preferredWidth = maxPreferredLogicalWidth() - bordersPlus
Padding; |
3328 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersP
lusPadding; | 3326 LayoutUnit preferredMinWidth = minPreferredLogicalWidth() - bordersP
lusPadding; |
3329 LayoutUnit availableWidth = availableSpace - logicalRightValue; | 3327 LayoutUnit availableWidth = availableSpace - logicalRightValue; |
3330 computedValues.m_extent = min(max(preferredMinWidth, availableWidth)
, preferredWidth); | 3328 computedValues.m_extent = std::min(std::max(preferredMinWidth, avail
ableWidth), preferredWidth); |
3331 logicalLeftValue = availableSpace - (computedValues.m_extent + logic
alRightValue); | 3329 logicalLeftValue = availableSpace - (computedValues.m_extent + logic
alRightValue); |
3332 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAut
o) { | 3330 } else if (!logicalLeftIsAuto && logicalWidthIsAuto && logicalRightIsAut
o) { |
3333 // RULE 3: (use shrink-to-fit for width, and no need solve of right) | 3331 // RULE 3: (use shrink-to-fit for width, and no need solve of right) |
3334 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth
); | 3332 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth
); |
3335 | 3333 |
3336 shrinkToFitWidth(availableSpace, logicalLeftValue, bordersPlusPaddin
g, computedValues); | 3334 shrinkToFitWidth(availableSpace, logicalLeftValue, bordersPlusPaddin
g, computedValues); |
3337 } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAu
to) { | 3335 } else if (logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAu
to) { |
3338 // RULE 4: (solve for left) | 3336 // RULE 4: (solve for left) |
3339 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v
alueForLength(logicalWidth, containerLogicalWidth)); | 3337 computedValues.m_extent = adjustContentBoxLogicalWidthForBoxSizing(v
alueForLength(logicalWidth, containerLogicalWidth)); |
3340 logicalLeftValue = availableSpace - (computedValues.m_extent + value
ForLength(logicalRight, containerLogicalWidth)); | 3338 logicalLeftValue = availableSpace - (computedValues.m_extent + value
ForLength(logicalRight, containerLogicalWidth)); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3613 // RULE 3: (height is content based, no need solve of bottom) | 3611 // RULE 3: (height is content based, no need solve of bottom) |
3614 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight)
; | 3612 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight)
; |
3615 logicalHeightValue = contentLogicalHeight; | 3613 logicalHeightValue = contentLogicalHeight; |
3616 } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsA
uto) { | 3614 } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsA
uto) { |
3617 // RULE 4: (solve of top) | 3615 // RULE 4: (solve of top) |
3618 logicalHeightValue = resolvedLogicalHeight; | 3616 logicalHeightValue = resolvedLogicalHeight; |
3619 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen
gth(logicalBottom, containerLogicalHeight)); | 3617 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen
gth(logicalBottom, containerLogicalHeight)); |
3620 } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsA
uto) { | 3618 } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsA
uto) { |
3621 // RULE 5: (solve of height) | 3619 // RULE 5: (solve of height) |
3622 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight)
; | 3620 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight)
; |
3623 logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTop
Value + valueForLength(logicalBottom, containerLogicalHeight))); | 3621 logicalHeightValue = std::max<LayoutUnit>(0, availableSpace - (logic
alTopValue + valueForLength(logicalBottom, containerLogicalHeight))); |
3624 } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsA
uto) { | 3622 } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsA
uto) { |
3625 // RULE 6: (no need solve of bottom) | 3623 // RULE 6: (no need solve of bottom) |
3626 logicalHeightValue = resolvedLogicalHeight; | 3624 logicalHeightValue = resolvedLogicalHeight; |
3627 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight)
; | 3625 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight)
; |
3628 } | 3626 } |
3629 } | 3627 } |
3630 computedValues.m_extent = logicalHeightValue; | 3628 computedValues.m_extent = logicalHeightValue; |
3631 | 3629 |
3632 // Use computed values to calculate the vertical position. | 3630 // Use computed values to calculate the vertical position. |
3633 computedValues.m_position = logicalTopValue + computedValues.m_margins.m_bef
ore; | 3631 computedValues.m_position = logicalTopValue + computedValues.m_margins.m_bef
ore; |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4129 overflowMinY = borderBox.y() + ((!isFlipped || !isHorizontal) ? shadowTo
p : -shadowBottom); | 4127 overflowMinY = borderBox.y() + ((!isFlipped || !isHorizontal) ? shadowTo
p : -shadowBottom); |
4130 overflowMaxY = borderBox.maxY() + ((!isFlipped || !isHorizontal) ? shado
wBottom : -shadowTop); | 4128 overflowMaxY = borderBox.maxY() + ((!isFlipped || !isHorizontal) ? shado
wBottom : -shadowTop); |
4131 } | 4129 } |
4132 | 4130 |
4133 // Now compute border-image-outset overflow. | 4131 // Now compute border-image-outset overflow. |
4134 if (style()->hasBorderImageOutsets()) { | 4132 if (style()->hasBorderImageOutsets()) { |
4135 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); | 4133 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); |
4136 | 4134 |
4137 // In flipped blocks writing modes, the physical sides are inverted. For
example in vertical-rl, the right | 4135 // In flipped blocks writing modes, the physical sides are inverted. For
example in vertical-rl, the right |
4138 // border is at the lower x coordinate value. | 4136 // border is at the lower x coordinate value. |
4139 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHoriz
ontal) ? borderOutsets.left() : borderOutsets.right())); | 4137 overflowMinX = std::min(overflowMinX, borderBox.x() - ((!isFlipped || is
Horizontal) ? borderOutsets.left() : borderOutsets.right())); |
4140 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHo
rizontal) ? borderOutsets.right() : borderOutsets.left())); | 4138 overflowMaxX = std::max(overflowMaxX, borderBox.maxX() + ((!isFlipped ||
isHorizontal) ? borderOutsets.right() : borderOutsets.left())); |
4141 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHori
zontal) ? borderOutsets.top() : borderOutsets.bottom())); | 4139 overflowMinY = std::min(overflowMinY, borderBox.y() - ((!isFlipped || !i
sHorizontal) ? borderOutsets.top() : borderOutsets.bottom())); |
4142 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isH
orizontal) ? borderOutsets.bottom() : borderOutsets.top())); | 4140 overflowMaxY = std::max(overflowMaxY, borderBox.maxY() + ((!isFlipped ||
!isHorizontal) ? borderOutsets.bottom() : borderOutsets.top())); |
4143 } | 4141 } |
4144 | 4142 |
4145 if (style()->hasOutline()) { | 4143 if (style()->hasOutline()) { |
4146 LayoutUnit outlineSize = style()->outlineSize(); | 4144 LayoutUnit outlineSize = style()->outlineSize(); |
4147 | 4145 |
4148 overflowMinX = min(overflowMinX, borderBox.x() - outlineSize); | 4146 overflowMinX = std::min(overflowMinX, borderBox.x() - outlineSize); |
4149 overflowMaxX = max(overflowMaxX, borderBox.maxX() + outlineSize); | 4147 overflowMaxX = std::max(overflowMaxX, borderBox.maxX() + outlineSize); |
4150 overflowMinY = min(overflowMinY, borderBox.y() - outlineSize); | 4148 overflowMinY = std::min(overflowMinY, borderBox.y() - outlineSize); |
4151 overflowMaxY = max(overflowMaxY, borderBox.maxY() + outlineSize); | 4149 overflowMaxY = std::max(overflowMaxY, borderBox.maxY() + outlineSize); |
4152 } | 4150 } |
4153 | 4151 |
4154 // Add in the final overflow with shadows, outsets and outline combined. | 4152 // Add in the final overflow with shadows, outsets and outline combined. |
4155 LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - o
verflowMinX, overflowMaxY - overflowMinY); | 4153 LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - o
verflowMinX, overflowMaxY - overflowMinY); |
4156 addVisualOverflow(visualEffectOverflow); | 4154 addVisualOverflow(visualEffectOverflow); |
4157 } | 4155 } |
4158 | 4156 |
4159 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) | 4157 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) |
4160 { | 4158 { |
4161 // Never allow flow threads to propagate overflow up to a parent. | 4159 // Never allow flow threads to propagate overflow up to a parent. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4195 bool hasLeftOverflow = !style()->isLeftToRightDirection() && isHorizonta
lWritingMode(); | 4193 bool hasLeftOverflow = !style()->isLeftToRightDirection() && isHorizonta
lWritingMode(); |
4196 if (isFlexibleBox() && style()->isReverseFlexDirection()) { | 4194 if (isFlexibleBox() && style()->isReverseFlexDirection()) { |
4197 RenderFlexibleBox* flexibleBox = toRenderFlexibleBox(this); | 4195 RenderFlexibleBox* flexibleBox = toRenderFlexibleBox(this); |
4198 if (flexibleBox->isHorizontalFlow()) | 4196 if (flexibleBox->isHorizontalFlow()) |
4199 hasLeftOverflow = true; | 4197 hasLeftOverflow = true; |
4200 else | 4198 else |
4201 hasTopOverflow = true; | 4199 hasTopOverflow = true; |
4202 } | 4200 } |
4203 | 4201 |
4204 if (!hasTopOverflow) | 4202 if (!hasTopOverflow) |
4205 overflowRect.shiftYEdgeTo(max(overflowRect.y(), clientBox.y())); | 4203 overflowRect.shiftYEdgeTo(std::max(overflowRect.y(), clientBox.y()))
; |
4206 else | 4204 else |
4207 overflowRect.shiftMaxYEdgeTo(min(overflowRect.maxY(), clientBox.maxY
())); | 4205 overflowRect.shiftMaxYEdgeTo(std::min(overflowRect.maxY(), clientBox
.maxY())); |
4208 if (!hasLeftOverflow) | 4206 if (!hasLeftOverflow) |
4209 overflowRect.shiftXEdgeTo(max(overflowRect.x(), clientBox.x())); | 4207 overflowRect.shiftXEdgeTo(std::max(overflowRect.x(), clientBox.x()))
; |
4210 else | 4208 else |
4211 overflowRect.shiftMaxXEdgeTo(min(overflowRect.maxX(), clientBox.maxX
())); | 4209 overflowRect.shiftMaxXEdgeTo(std::min(overflowRect.maxX(), clientBox
.maxX())); |
4212 | 4210 |
4213 // Now re-test with the adjusted rectangle and see if it has become unre
achable or fully | 4211 // Now re-test with the adjusted rectangle and see if it has become unre
achable or fully |
4214 // contained. | 4212 // contained. |
4215 if (clientBox.contains(overflowRect) || overflowRect.isEmpty()) | 4213 if (clientBox.contains(overflowRect) || overflowRect.isEmpty()) |
4216 return; | 4214 return; |
4217 } | 4215 } |
4218 | 4216 |
4219 if (!m_overflow) | 4217 if (!m_overflow) |
4220 m_overflow = adoptPtr(new RenderOverflow(clientBox, borderBoxRect())); | 4218 m_overflow = adoptPtr(new RenderOverflow(clientBox, borderBoxRect())); |
4221 | 4219 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4646 return 0; | 4644 return 0; |
4647 | 4645 |
4648 if (!layoutState && !flowThreadContainingBlock()) | 4646 if (!layoutState && !flowThreadContainingBlock()) |
4649 return 0; | 4647 return 0; |
4650 | 4648 |
4651 RenderBlock* containerBlock = containingBlock(); | 4649 RenderBlock* containerBlock = containingBlock(); |
4652 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4650 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
4653 } | 4651 } |
4654 | 4652 |
4655 } // namespace WebCore | 4653 } // namespace WebCore |
OLD | NEW |