| 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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 void LayoutBox::positionLineBox(InlineBox* box) | 1721 void LayoutBox::positionLineBox(InlineBox* box) |
| 1722 { | 1722 { |
| 1723 if (isOutOfFlowPositioned()) { | 1723 if (isOutOfFlowPositioned()) { |
| 1724 // Cache the x position only if we were an INLINE type originally. | 1724 // Cache the x position only if we were an INLINE type originally. |
| 1725 bool originallyInline = style()->isOriginalDisplayInlineType(); | 1725 bool originallyInline = style()->isOriginalDisplayInlineType(); |
| 1726 if (originallyInline) { | 1726 if (originallyInline) { |
| 1727 // The value is cached in the xPos of the box. We only need this va
lue if | 1727 // The value is cached in the xPos of the box. We only need this va
lue if |
| 1728 // our object was inline originally, since otherwise it would have e
nded up underneath | 1728 // our object was inline originally, since otherwise it would have e
nded up underneath |
| 1729 // the inlines. | 1729 // the inlines. |
| 1730 RootInlineBox& root = box->root(); | 1730 RootInlineBox& root = box->root(); |
| 1731 root.block().setStaticInlinePositionForChild(*this, LayoutUnit::from
FloatRound(box->logicalLeft())); | 1731 root.block().setStaticInlinePositionForChild(*this, box->logicalLeft
()); |
| 1732 } else { | 1732 } else { |
| 1733 // Our object was a block originally, so we make our normal flow pos
ition be | 1733 // Our object was a block originally, so we make our normal flow pos
ition be |
| 1734 // just below the line box (as though all the inlines that came befo
re us got | 1734 // just below the line box (as though all the inlines that came befo
re us got |
| 1735 // wrapped in an anonymous block, which is what would have happened
had we been | 1735 // wrapped in an anonymous block, which is what would have happened
had we been |
| 1736 // in flow). This value was cached in the y() of the box. | 1736 // in flow). This value was cached in the y() of the box. |
| 1737 layer()->setStaticBlockPosition(box->logicalTop()); | 1737 layer()->setStaticBlockPosition(box->logicalTop()); |
| 1738 } | 1738 } |
| 1739 | 1739 |
| 1740 if (container()->isLayoutInline()) | 1740 if (container()->isLayoutInline()) |
| 1741 moveWithEdgeOfInlineContainerIfNecessary(box->isHorizontal()); | 1741 moveWithEdgeOfInlineContainerIfNecessary(box->isHorizontal()); |
| 1742 | 1742 |
| 1743 // Nuke the box. | 1743 // Nuke the box. |
| 1744 box->remove(DontMarkLineBoxes); | 1744 box->remove(DontMarkLineBoxes); |
| 1745 box->destroy(); | 1745 box->destroy(); |
| 1746 } else if (isReplaced()) { | 1746 } else if (isReplaced()) { |
| 1747 // FIXME: the call to roundedLayoutPoint() below is temporary and should
be removed once | 1747 // FIXME: the call to roundedLayoutPoint() below is temporary and should
be removed once |
| 1748 // the transition to LayoutUnit-based types is complete (crbug.com/32123
7) | 1748 // the transition to LayoutUnit-based types is complete (crbug.com/32123
7) |
| 1749 setLocationAndUpdateOverflowControlsIfNeeded(box->topLeft().roundedLayou
tPoint()); | 1749 setLocationAndUpdateOverflowControlsIfNeeded(box->topLeft()); |
| 1750 setInlineBoxWrapper(box); | 1750 setInlineBoxWrapper(box); |
| 1751 } | 1751 } |
| 1752 } | 1752 } |
| 1753 | 1753 |
| 1754 void LayoutBox::moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal) | 1754 void LayoutBox::moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal) |
| 1755 { | 1755 { |
| 1756 ASSERT(isOutOfFlowPositioned() && container()->isLayoutInline() && container
()->isRelPositioned()); | 1756 ASSERT(isOutOfFlowPositioned() && container()->isLayoutInline() && container
()->isRelPositioned()); |
| 1757 // If this object is inside a relative positioned inline and its inline posi
tion is an explicit offset from the edge of its container | 1757 // If this object is inside a relative positioned inline and its inline posi
tion is an explicit offset from the edge of its container |
| 1758 // then it will need to move if its inline container has changed width. We d
o not track if the width has changed | 1758 // then it will need to move if its inline container has changed width. We d
o not track if the width has changed |
| 1759 // but if we are here then we are laying out lines inside it, so it probably
has - mark our object for layout so that it can | 1759 // but if we are here then we are laying out lines inside it, so it probably
has - mark our object for layout so that it can |
| (...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3790 computedValues.m_position = logicalTopPos; | 3790 computedValues.m_position = logicalTopPos; |
| 3791 } | 3791 } |
| 3792 | 3792 |
| 3793 LayoutRect LayoutBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit
* extraWidthToEndOfLine) | 3793 LayoutRect LayoutBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit
* extraWidthToEndOfLine) |
| 3794 { | 3794 { |
| 3795 // VisiblePositions at offsets inside containers either a) refer to the posi
tions before/after | 3795 // VisiblePositions at offsets inside containers either a) refer to the posi
tions before/after |
| 3796 // those containers (tables and select elements) or b) refer to the position
inside an empty block. | 3796 // those containers (tables and select elements) or b) refer to the position
inside an empty block. |
| 3797 // They never refer to children. | 3797 // They never refer to children. |
| 3798 // FIXME: Paint the carets inside empty blocks differently than the carets b
efore/after elements. | 3798 // FIXME: Paint the carets inside empty blocks differently than the carets b
efore/after elements. |
| 3799 | 3799 |
| 3800 LayoutRect rect(location(), LayoutSize(caretWidth, size().height())); | 3800 LayoutRect rect(location(), LayoutSize(caretWidth(), size().height())); |
| 3801 bool ltr = box ? box->isLeftToRightDirection() : style()->isLeftToRightDirec
tion(); | 3801 bool ltr = box ? box->isLeftToRightDirection() : style()->isLeftToRightDirec
tion(); |
| 3802 | 3802 |
| 3803 if ((!caretOffset) ^ ltr) | 3803 if ((!caretOffset) ^ ltr) |
| 3804 rect.move(LayoutSize(size().width() - caretWidth, 0)); | 3804 rect.move(LayoutSize(size().width() - caretWidth(), 0)); |
| 3805 | 3805 |
| 3806 if (box) { | 3806 if (box) { |
| 3807 RootInlineBox& rootBox = box->root(); | 3807 RootInlineBox& rootBox = box->root(); |
| 3808 LayoutUnit top = rootBox.lineTop(); | 3808 LayoutUnit top = rootBox.lineTop(); |
| 3809 rect.setY(top); | 3809 rect.setY(top); |
| 3810 rect.setHeight(rootBox.lineBottom() - top); | 3810 rect.setHeight(rootBox.lineBottom() - top); |
| 3811 } | 3811 } |
| 3812 | 3812 |
| 3813 // If height of box is smaller than font height, use the latter one, | 3813 // If height of box is smaller than font height, use the latter one, |
| 3814 // otherwise the caret might become invisible. | 3814 // otherwise the caret might become invisible. |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4821 bool LayoutBox::canRenderBorderImage() const | 4821 bool LayoutBox::canRenderBorderImage() const |
| 4822 { | 4822 { |
| 4823 if (!style()->hasBorder()) | 4823 if (!style()->hasBorder()) |
| 4824 return false; | 4824 return false; |
| 4825 | 4825 |
| 4826 StyleImage* borderImage = style()->borderImage().image(); | 4826 StyleImage* borderImage = style()->borderImage().image(); |
| 4827 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); | 4827 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); |
| 4828 } | 4828 } |
| 4829 | 4829 |
| 4830 } // namespace blink | 4830 } // namespace blink |
| OLD | NEW |