| 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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 686 |
| 687 if (userTriggered == UserTriggered) { | 687 if (userTriggered == UserTriggered) { |
| 688 OwnPtrWillBeRawPtr<FrameSelection> trialFrameSelection = FrameSelection:
:create(); | 688 OwnPtrWillBeRawPtr<FrameSelection> trialFrameSelection = FrameSelection:
:create(); |
| 689 trialFrameSelection->setSelection(m_selection); | 689 trialFrameSelection->setSelection(m_selection); |
| 690 trialFrameSelection->modify(alter, verticalDistance, direction, NotUserT
riggered); | 690 trialFrameSelection->modify(alter, verticalDistance, direction, NotUserT
riggered); |
| 691 } | 691 } |
| 692 | 692 |
| 693 willBeModified(alter, direction == FrameSelection::DirectionUp ? DirectionBa
ckward : DirectionForward); | 693 willBeModified(alter, direction == FrameSelection::DirectionUp ? DirectionBa
ckward : DirectionForward); |
| 694 | 694 |
| 695 VisiblePosition pos; | 695 VisiblePosition pos; |
| 696 LayoutUnit xPos = 0; | 696 LayoutUnit xPos; |
| 697 switch (alter) { | 697 switch (alter) { |
| 698 case FrameSelection::AlterationMove: | 698 case FrameSelection::AlterationMove: |
| 699 pos = createVisiblePosition(direction == FrameSelection::DirectionUp ? m
_selection.start() : m_selection.end(), m_selection.affinity()); | 699 pos = createVisiblePosition(direction == FrameSelection::DirectionUp ? m
_selection.start() : m_selection.end(), m_selection.affinity()); |
| 700 xPos = lineDirectionPointForBlockDirectionNavigation(direction == FrameS
election::DirectionUp ? START : END); | 700 xPos = lineDirectionPointForBlockDirectionNavigation(direction == FrameS
election::DirectionUp ? START : END); |
| 701 m_selection.setAffinity(direction == FrameSelection::DirectionUp ? TextA
ffinity::Upstream : TextAffinity::Downstream); | 701 m_selection.setAffinity(direction == FrameSelection::DirectionUp ? TextA
ffinity::Upstream : TextAffinity::Downstream); |
| 702 break; | 702 break; |
| 703 case FrameSelection::AlterationExtend: | 703 case FrameSelection::AlterationExtend: |
| 704 pos = createVisiblePosition(m_selection.extent(), m_selection.affinity()
); | 704 pos = createVisiblePosition(m_selection.extent(), m_selection.affinity()
); |
| 705 xPos = lineDirectionPointForBlockDirectionNavigation(EXTENT); | 705 xPos = lineDirectionPointForBlockDirectionNavigation(EXTENT); |
| 706 m_selection.setAffinity(TextAffinity::Downstream); | 706 m_selection.setAffinity(TextAffinity::Downstream); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 containingBlock->isHorizontalWritingMode() ? caretPoint.x() : caretPo
int.y(); |
| 777 } | 777 } |
| 778 | 778 |
| 779 LayoutUnit SelectionEditor::lineDirectionPointForBlockDirectionNavigation(EPosit
ionType type) | 779 LayoutUnit SelectionEditor::lineDirectionPointForBlockDirectionNavigation(EPosit
ionType type) |
| 780 { | 780 { |
| 781 LayoutUnit x = 0; | 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; |
| 787 switch (type) { | 787 switch (type) { |
| 788 case START: | 788 case START: |
| 789 pos = m_selection.start(); | 789 pos = m_selection.start(); |
| 790 break; | 790 break; |
| 791 case END: | 791 case END: |
| (...skipping 94 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 |