| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh
t) { | 577 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh
t) { |
| 578 if (shouldComputePreferred == ComputePreferred) | 578 if (shouldComputePreferred == ComputePreferred) |
| 579 return computeReplacedLogicalWidthRespectingMinMaxWidth(0, C
omputePreferred); | 579 return computeReplacedLogicalWidthRespectingMinMaxWidth(0, C
omputePreferred); |
| 580 // The aforementioned 'constraint equation' used for block-level
, non-replaced elements in normal flow: | 580 // The aforementioned 'constraint equation' used for block-level
, non-replaced elements in normal flow: |
| 581 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width
' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin
g block | 581 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width
' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin
g block |
| 582 LayoutUnit logicalWidth = containingBlock()->availableLogicalWid
th(); | 582 LayoutUnit logicalWidth = containingBlock()->availableLogicalWid
th(); |
| 583 | 583 |
| 584 // This solves above equation for 'width' (== logicalWidth). | 584 // This solves above equation for 'width' (== logicalWidth). |
| 585 LayoutUnit marginStart = minimumValueForLength(style()->marginSt
art(), logicalWidth); | 585 LayoutUnit marginStart = minimumValueForLength(style()->marginSt
art(), logicalWidth); |
| 586 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(
), logicalWidth); | 586 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(
), logicalWidth); |
| 587 logicalWidth = std::max<LayoutUnit>(0, logicalWidth - (marginSta
rt + marginEnd + (size().width() - clientWidth()))); | 587 logicalWidth = (logicalWidth - (marginStart + marginEnd + (size(
).width() - clientWidth()))).clampNegativeToZero(); |
| 588 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalW
idth, shouldComputePreferred); | 588 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalW
idth, shouldComputePreferred); |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 | 591 |
| 592 // Otherwise, if 'width' has a computed value of 'auto', and the element
has an intrinsic width, then that intrinsic width is the used value of 'width'. | 592 // Otherwise, if 'width' has a computed value of 'auto', and the element
has an intrinsic width, then that intrinsic width is the used value of 'width'. |
| 593 if (hasIntrinsicWidth) | 593 if (hasIntrinsicWidth) |
| 594 return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedS
ize.width(), shouldComputePreferred); | 594 return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedS
ize.width(), shouldComputePreferred); |
| 595 | 595 |
| 596 // Otherwise, if 'width' has a computed value of 'auto', but none of the
conditions above are met, then the used value of 'width' becomes 300px. If 300p
x is too | 596 // Otherwise, if 'width' has a computed value of 'auto', but none of the
conditions above are met, then the used value of 'width' becomes 300px. If 300p
x is too |
| 597 // wide to fit the device, UAs should use the width of the largest recta
ngle that has a 2:1 ratio and fits the device instead. | 597 // wide to fit the device, UAs should use the width of the largest recta
ngle that has a 2:1 ratio and fits the device instead. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 return LayoutRect(); | 723 return LayoutRect(); |
| 724 | 724 |
| 725 if (!inlineBoxWrapper()) { | 725 if (!inlineBoxWrapper()) { |
| 726 // We're a block-level replaced element. Just return our own dimensions
. | 726 // We're a block-level replaced element. Just return our own dimensions
. |
| 727 return LayoutRect(LayoutPoint(), size()); | 727 return LayoutRect(LayoutPoint(), size()); |
| 728 } | 728 } |
| 729 | 729 |
| 730 RootInlineBox& root = inlineBoxWrapper()->root(); | 730 RootInlineBox& root = inlineBoxWrapper()->root(); |
| 731 LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode(
) ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectio
nTop() - inlineBoxWrapper()->logicalTop(); | 731 LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode(
) ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectio
nTop() - inlineBoxWrapper()->logicalTop(); |
| 732 if (root.block().style()->isHorizontalWritingMode()) | 732 if (root.block().style()->isHorizontalWritingMode()) |
| 733 return LayoutRect(0, newLogicalTop, size().width(), root.selectionHeight
()); | 733 return LayoutRect(LayoutUnit(), newLogicalTop, size().width(), root.sele
ctionHeight()); |
| 734 return LayoutRect(newLogicalTop, 0, root.selectionHeight(), size().height())
; | 734 return LayoutRect(newLogicalTop, LayoutUnit(), root.selectionHeight(), size(
).height()); |
| 735 } | 735 } |
| 736 | 736 |
| 737 void LayoutReplaced::setSelectionState(SelectionState state) | 737 void LayoutReplaced::setSelectionState(SelectionState state) |
| 738 { | 738 { |
| 739 // The selection state for our containing block hierarchy is updated by the
base class call. | 739 // The selection state for our containing block hierarchy is updated by the
base class call. |
| 740 LayoutBox::setSelectionState(state); | 740 LayoutBox::setSelectionState(state); |
| 741 | 741 |
| 742 if (!inlineBoxWrapper()) | 742 if (!inlineBoxWrapper()) |
| 743 return; | 743 return; |
| 744 | 744 |
| 745 // We only include the space below the baseline in our layer's cached paint
invalidation rect if the | 745 // We only include the space below the baseline in our layer's cached paint
invalidation rect if the |
| 746 // image is selected. Since the selection state has changed update the rect. | 746 // image is selected. Since the selection state has changed update the rect. |
| 747 if (hasLayer()) | 747 if (hasLayer()) |
| 748 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe
rForPaintInvalidation())); | 748 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe
rForPaintInvalidation())); |
| 749 | 749 |
| 750 if (canUpdateSelectionOnRootLineBoxes()) | 750 if (canUpdateSelectionOnRootLineBoxes()) |
| 751 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); | 751 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); |
| 752 } | 752 } |
| 753 | 753 |
| 754 } // namespace blink | 754 } // namespace blink |
| OLD | NEW |