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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 | 702 |
703 if (node()) { | 703 if (node()) { |
704 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) | 704 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) |
705 return createPositionWithAffinity(0); | 705 return createPositionWithAffinity(0); |
706 return createPositionWithAffinity(1); | 706 return createPositionWithAffinity(1); |
707 } | 707 } |
708 | 708 |
709 return LayoutBox::positionForPoint(point); | 709 return LayoutBox::positionForPoint(point); |
710 } | 710 } |
711 | 711 |
712 LayoutRect LayoutReplaced::selectionRectForPaintInvalidation(const LayoutBoxMode
lObject* paintInvalidationContainer) const | |
713 { | |
714 ASSERT(!needsLayout()); | |
715 | |
716 LayoutRect rect = localSelectionRect(); | |
717 if (rect.isEmpty()) | |
718 return rect; | |
719 | |
720 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, 0); | |
721 // FIXME: groupedMapping() leaks the squashing abstraction. | |
722 if (paintInvalidationContainer->layer()->groupedMapping()) | |
723 PaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer,
rect); | |
724 return rect; | |
725 } | |
726 | |
727 LayoutRect LayoutReplaced::localSelectionRect() const | 712 LayoutRect LayoutReplaced::localSelectionRect() const |
728 { | 713 { |
729 if (getSelectionState() == SelectionNone) | 714 if (getSelectionState() == SelectionNone) |
730 return LayoutRect(); | 715 return LayoutRect(); |
731 | 716 |
732 if (!inlineBoxWrapper()) { | 717 if (!inlineBoxWrapper()) { |
733 // We're a block-level replaced element. Just return our own dimensions
. | 718 // We're a block-level replaced element. Just return our own dimensions
. |
734 return LayoutRect(LayoutPoint(), size()); | 719 return LayoutRect(LayoutPoint(), size()); |
735 } | 720 } |
736 | 721 |
737 RootInlineBox& root = inlineBoxWrapper()->root(); | 722 RootInlineBox& root = inlineBoxWrapper()->root(); |
738 LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode(
) ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectio
nTop() - inlineBoxWrapper()->logicalTop(); | 723 LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode(
) ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectio
nTop() - inlineBoxWrapper()->logicalTop(); |
739 if (root.block().style()->isHorizontalWritingMode()) | 724 if (root.block().style()->isHorizontalWritingMode()) |
740 return LayoutRect(LayoutUnit(), newLogicalTop, size().width(), root.sele
ctionHeight()); | 725 return LayoutRect(LayoutUnit(), newLogicalTop, size().width(), root.sele
ctionHeight()); |
741 return LayoutRect(newLogicalTop, LayoutUnit(), root.selectionHeight(), size(
).height()); | 726 return LayoutRect(newLogicalTop, LayoutUnit(), root.selectionHeight(), size(
).height()); |
742 } | 727 } |
743 | 728 |
744 void LayoutReplaced::setSelectionState(SelectionState state) | 729 void LayoutReplaced::setSelectionState(SelectionState state) |
745 { | 730 { |
746 // The selection state for our containing block hierarchy is updated by the
base class call. | 731 // The selection state for our containing block hierarchy is updated by the
base class call. |
747 LayoutBox::setSelectionState(state); | 732 LayoutBox::setSelectionState(state); |
748 | 733 |
749 if (!inlineBoxWrapper()) | 734 if (!inlineBoxWrapper()) |
750 return; | 735 return; |
751 | 736 |
752 // We only include the space below the baseline in our layer's cached paint
invalidation rect if the | 737 // We only include the space below the baseline in our layer's cached paint
invalidation rect if the |
753 // image is selected. Since the selection state has changed update the rect. | 738 // image is selected. Since the selection state has changed update the rect. |
754 if (hasLayer()) | 739 if (hasLayer()) { |
755 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe
rForPaintInvalidation())); | 740 LayoutRect rect = localOverflowRectForPaintInvalidation(); |
| 741 PaintLayer::mapRectToPaintInvalidationBacking(*this, containerForPaintIn
validation(), rect); |
| 742 setPreviousPaintInvalidationRect(rect); |
| 743 } |
756 | 744 |
757 if (canUpdateSelectionOnRootLineBoxes()) | 745 if (canUpdateSelectionOnRootLineBoxes()) |
758 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); | 746 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); |
759 } | 747 } |
760 | 748 |
761 void LayoutReplaced::IntrinsicSizingInfo::transpose() | 749 void LayoutReplaced::IntrinsicSizingInfo::transpose() |
762 { | 750 { |
763 size = size.transposedSize(); | 751 size = size.transposedSize(); |
764 aspectRatio = aspectRatio.transposedSize(); | 752 aspectRatio = aspectRatio.transposedSize(); |
765 std::swap(hasWidth, hasHeight); | 753 std::swap(hasWidth, hasHeight); |
766 } | 754 } |
767 | 755 |
768 } // namespace blink | 756 } // namespace blink |
OLD | NEW |