OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 break; | 758 break; |
759 } | 759 } |
760 | 760 |
761 m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) ||
alter == FrameSelection::AlterationExtend); | 761 m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) ||
alter == FrameSelection::AlterationExtend); |
762 | 762 |
763 return true; | 763 return true; |
764 } | 764 } |
765 | 765 |
766 // Abs x/y position of the caret ignoring transforms. | 766 // Abs x/y position of the caret ignoring transforms. |
767 // TODO(yosin) navigation with transforms should be smarter. | 767 // TODO(yosin) navigation with transforms should be smarter. |
768 static int lineDirectionPointForBlockDirectionNavigationOf(const VisiblePosition
& visiblePosition) | 768 static LayoutUnit lineDirectionPointForBlockDirectionNavigationOf(const VisibleP
osition& visiblePosition) |
769 { | 769 { |
770 if (visiblePosition.isNull()) | 770 if (visiblePosition.isNull()) |
771 return 0; | 771 return LayoutUnit(); |
772 | 772 |
773 LayoutObject* layoutObject; | 773 LayoutObject* layoutObject; |
774 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi
thAffinity(), layoutObject); | 774 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi
thAffinity(), layoutObject); |
775 if (localRect.isEmpty() || !layoutObject) | 775 if (localRect.isEmpty() || !layoutObject) |
776 return 0; | 776 return LayoutUnit(); |
777 | 777 |
778 // This ignores transforms on purpose, for now. Vertical navigation is done | 778 // This ignores transforms on purpose, for now. Vertical navigation is done |
779 // without consulting transforms, so that 'up' in transformed text is 'up' | 779 // without consulting transforms, so that 'up' in transformed text is 'up' |
780 // relative to the text, not absolute 'up'. | 780 // relative to the text, not absolute 'up'. |
781 FloatPoint caretPoint = layoutObject->localToAbsolute(FloatPoint(localRect.l
ocation())); | 781 FloatPoint caretPoint = layoutObject->localToAbsolute(FloatPoint(localRect.l
ocation())); |
782 LayoutObject* containingBlock = layoutObject->containingBlock(); | 782 LayoutObject* containingBlock = layoutObject->containingBlock(); |
783 if (!containingBlock) | 783 if (!containingBlock) |
784 containingBlock = layoutObject; // Just use ourselves to determine the w
riting mode if we have no containing block. | 784 containingBlock = layoutObject; // Just use ourselves to determine the w
riting mode if we have no containing block. |
785 return containingBlock->isHorizontalWritingMode() ? caretPoint.x() : caretPo
int.y(); | 785 return LayoutUnit(containingBlock->isHorizontalWritingMode() ? caretPoint.x(
) : caretPoint.y()); |
786 } | 786 } |
787 | 787 |
788 LayoutUnit SelectionEditor::lineDirectionPointForBlockDirectionNavigation(EPosit
ionType type) | 788 LayoutUnit SelectionEditor::lineDirectionPointForBlockDirectionNavigation(EPosit
ionType type) |
789 { | 789 { |
790 LayoutUnit x; | 790 LayoutUnit x; |
791 | 791 |
792 if (m_selection.isNone()) | 792 if (m_selection.isNone()) |
793 return x; | 793 return x; |
794 | 794 |
795 Position pos; | 795 Position pos; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 DEFINE_TRACE(SelectionEditor) | 901 DEFINE_TRACE(SelectionEditor) |
902 { | 902 { |
903 visitor->trace(m_frameSelection); | 903 visitor->trace(m_frameSelection); |
904 visitor->trace(m_selection); | 904 visitor->trace(m_selection); |
905 visitor->trace(m_selectionInComposedTree); | 905 visitor->trace(m_selectionInComposedTree); |
906 visitor->trace(m_logicalRange); | 906 visitor->trace(m_logicalRange); |
907 VisibleSelectionChangeObserver::trace(visitor); | 907 VisibleSelectionChangeObserver::trace(visitor); |
908 } | 908 } |
909 | 909 |
910 } // namespace blink | 910 } // namespace blink |
OLD | NEW |