| 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 break; | 749 break; |
| 750 } | 750 } |
| 751 | 751 |
| 752 m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) ||
alter == FrameSelection::AlterationExtend); | 752 m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) ||
alter == FrameSelection::AlterationExtend); |
| 753 | 753 |
| 754 return true; | 754 return true; |
| 755 } | 755 } |
| 756 | 756 |
| 757 // Abs x/y position of the caret ignoring transforms. | 757 // Abs x/y position of the caret ignoring transforms. |
| 758 // TODO(yosin) navigation with transforms should be smarter. | 758 // TODO(yosin) navigation with transforms should be smarter. |
| 759 static int lineDirectionPointForBlockDirectionNavigationOf(const VisiblePosition
& visiblePosition) | 759 static LayoutUnit lineDirectionPointForBlockDirectionNavigationOf(const VisibleP
osition& visiblePosition) |
| 760 { | 760 { |
| 761 if (visiblePosition.isNull()) | 761 if (visiblePosition.isNull()) |
| 762 return 0; | 762 return LayoutUnit(); |
| 763 | 763 |
| 764 LayoutObject* layoutObject; | 764 LayoutObject* layoutObject; |
| 765 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi
thAffinity(), layoutObject); | 765 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi
thAffinity(), layoutObject); |
| 766 if (localRect.isEmpty() || !layoutObject) | 766 if (localRect.isEmpty() || !layoutObject) |
| 767 return 0; | 767 return LayoutUnit(); |
| 768 | 768 |
| 769 // This ignores transforms on purpose, for now. Vertical navigation is done | 769 // This ignores transforms on purpose, for now. Vertical navigation is done |
| 770 // without consulting transforms, so that 'up' in transformed text is 'up' | 770 // without consulting transforms, so that 'up' in transformed text is 'up' |
| 771 // relative to the text, not absolute 'up'. | 771 // relative to the text, not absolute 'up'. |
| 772 FloatPoint caretPoint = layoutObject->localToAbsolute(FloatPoint(localRect.l
ocation())); | 772 FloatPoint caretPoint = layoutObject->localToAbsolute(FloatPoint(localRect.l
ocation())); |
| 773 LayoutObject* containingBlock = layoutObject->containingBlock(); | 773 LayoutObject* containingBlock = layoutObject->containingBlock(); |
| 774 if (!containingBlock) | 774 if (!containingBlock) |
| 775 containingBlock = layoutObject; // Just use ourselves to determine the w
riting mode if we have no containing block. | 775 containingBlock = layoutObject; // Just use ourselves to determine the w
riting mode if we have no containing block. |
| 776 return containingBlock->isHorizontalWritingMode() ? caretPoint.x() : caretPo
int.y(); | 776 return LayoutUnit(containingBlock->isHorizontalWritingMode() ? caretPoint.x(
) : caretPoint.y()); |
| 777 } | 777 } |
| 778 | 778 |
| 779 LayoutUnit SelectionEditor::lineDirectionPointForBlockDirectionNavigation(EPosit
ionType type) | 779 LayoutUnit SelectionEditor::lineDirectionPointForBlockDirectionNavigation(EPosit
ionType type) |
| 780 { | 780 { |
| 781 LayoutUnit x; | 781 LayoutUnit x; |
| 782 | 782 |
| 783 if (m_selection.isNone()) | 783 if (m_selection.isNone()) |
| 784 return x; | 784 return x; |
| 785 | 785 |
| 786 Position pos; | 786 Position pos; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 DEFINE_TRACE(SelectionEditor) | 886 DEFINE_TRACE(SelectionEditor) |
| 887 { | 887 { |
| 888 visitor->trace(m_frameSelection); | 888 visitor->trace(m_frameSelection); |
| 889 visitor->trace(m_selection); | 889 visitor->trace(m_selection); |
| 890 visitor->trace(m_selectionInComposedTree); | 890 visitor->trace(m_selectionInComposedTree); |
| 891 visitor->trace(m_logicalRange); | 891 visitor->trace(m_logicalRange); |
| 892 VisibleSelectionChangeObserver::trace(visitor); | 892 VisibleSelectionChangeObserver::trace(visitor); |
| 893 } | 893 } |
| 894 | 894 |
| 895 } // namespace blink | 895 } // namespace blink |
| OLD | NEW |