| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/editing/RenderedPosition.h" | 38 #include "core/editing/RenderedPosition.h" |
| 39 #include "core/editing/TextAffinity.h" | 39 #include "core/editing/TextAffinity.h" |
| 40 #include "core/editing/VisiblePosition.h" | 40 #include "core/editing/VisiblePosition.h" |
| 41 #include "core/editing/iterators/BackwardsCharacterIterator.h" | 41 #include "core/editing/iterators/BackwardsCharacterIterator.h" |
| 42 #include "core/editing/iterators/CharacterIterator.h" | 42 #include "core/editing/iterators/CharacterIterator.h" |
| 43 #include "core/editing/iterators/SimplifiedBackwardsTextIterator.h" | 43 #include "core/editing/iterators/SimplifiedBackwardsTextIterator.h" |
| 44 #include "core/editing/iterators/TextIterator.h" | 44 #include "core/editing/iterators/TextIterator.h" |
| 45 #include "core/frame/LocalFrame.h" | 45 #include "core/frame/LocalFrame.h" |
| 46 #include "core/frame/Settings.h" | 46 #include "core/frame/Settings.h" |
| 47 #include "core/html/HTMLBRElement.h" | 47 #include "core/html/HTMLBRElement.h" |
| 48 #include "core/html/HTMLTextFormControlElement.h" |
| 48 #include "core/layout/HitTestRequest.h" | 49 #include "core/layout/HitTestRequest.h" |
| 49 #include "core/layout/HitTestResult.h" | 50 #include "core/layout/HitTestResult.h" |
| 50 #include "core/layout/LayoutBlockFlow.h" | 51 #include "core/layout/LayoutBlockFlow.h" |
| 51 #include "core/layout/LayoutInline.h" | 52 #include "core/layout/LayoutInline.h" |
| 52 #include "core/layout/LayoutObject.h" | 53 #include "core/layout/LayoutObject.h" |
| 53 #include "core/layout/LayoutView.h" | 54 #include "core/layout/LayoutView.h" |
| 54 #include "core/layout/line/InlineIterator.h" | 55 #include "core/layout/line/InlineIterator.h" |
| 55 #include "core/layout/line/InlineTextBox.h" | 56 #include "core/layout/line/InlineTextBox.h" |
| 56 #include "core/paint/DeprecatedPaintLayer.h" | 57 #include "core/paint/DeprecatedPaintLayer.h" |
| 57 #include "platform/Logging.h" | 58 #include "platform/Logging.h" |
| (...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 | 1788 |
| 1788 VisiblePosition endOfEditableContent(const VisiblePosition& visiblePosition) | 1789 VisiblePosition endOfEditableContent(const VisiblePosition& visiblePosition) |
| 1789 { | 1790 { |
| 1790 ContainerNode* highestRoot = highestEditableRoot(visiblePosition.deepEquival
ent()); | 1791 ContainerNode* highestRoot = highestEditableRoot(visiblePosition.deepEquival
ent()); |
| 1791 if (!highestRoot) | 1792 if (!highestRoot) |
| 1792 return VisiblePosition(); | 1793 return VisiblePosition(); |
| 1793 | 1794 |
| 1794 return createVisiblePosition(lastPositionInNode(highestRoot)); | 1795 return createVisiblePosition(lastPositionInNode(highestRoot)); |
| 1795 } | 1796 } |
| 1796 | 1797 |
| 1797 template <typename Strategy> | |
| 1798 static bool isEndOfEditableOrNonEditableContentAlgorithm(const VisiblePositionTe
mplate<Strategy>& p) | |
| 1799 { | |
| 1800 return p.isNotNull() && nextPositionOf(p).isNull(); | |
| 1801 } | |
| 1802 | |
| 1803 bool isEndOfEditableOrNonEditableContent(const VisiblePosition& position) | 1798 bool isEndOfEditableOrNonEditableContent(const VisiblePosition& position) |
| 1804 { | 1799 { |
| 1805 return isEndOfEditableOrNonEditableContentAlgorithm<EditingStrategy>(positio
n); | 1800 return position.isNotNull() && nextPositionOf(position).isNull(); |
| 1806 } | 1801 } |
| 1807 | 1802 |
| 1803 // TODO(yosin) We should rename |isEndOfEditableOrNonEditableContent()| what |
| 1804 // this function does, e.g. |isLastVisiblePositionOrEndOfInnerEditor()|. |
| 1808 bool isEndOfEditableOrNonEditableContent(const VisiblePositionInComposedTree& po
sition) | 1805 bool isEndOfEditableOrNonEditableContent(const VisiblePositionInComposedTree& po
sition) |
| 1809 { | 1806 { |
| 1810 return isEndOfEditableOrNonEditableContentAlgorithm<EditingInComposedTreeStr
ategy>(position); | 1807 if (position.isNull()) |
| 1808 return false; |
| 1809 const VisiblePositionInComposedTree nextPosition = nextPositionOf(position); |
| 1810 if (nextPosition.isNull()) |
| 1811 return true; |
| 1812 // In DOM version, following condition, the last position of inner editor |
| 1813 // of INPUT/TEXTAREA element, by |nextPosition().isNull()|, because of |
| 1814 // an inner editor is an only leaf node. |
| 1815 if (!nextPosition.deepEquivalent().isAfterAnchor()) |
| 1816 return false; |
| 1817 return isHTMLTextFormControlElement(nextPosition.deepEquivalent().anchorNode
()); |
| 1811 } | 1818 } |
| 1812 | 1819 |
| 1813 VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direc
tion) | 1820 VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direc
tion) |
| 1814 { | 1821 { |
| 1815 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1822 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
| 1816 } | 1823 } |
| 1817 | 1824 |
| 1818 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1825 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
| 1819 { | 1826 { |
| 1820 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1827 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
| (...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3239 { | 3246 { |
| 3240 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); | 3247 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); |
| 3241 } | 3248 } |
| 3242 | 3249 |
| 3243 VisiblePositionInComposedTree previousPositionOf(const VisiblePositionInComposed
Tree& visiblePosition, EditingBoundaryCrossingRule rule) | 3250 VisiblePositionInComposedTree previousPositionOf(const VisiblePositionInComposed
Tree& visiblePosition, EditingBoundaryCrossingRule rule) |
| 3244 { | 3251 { |
| 3245 return previousPositionOfAlgorithm<EditingInComposedTreeStrategy>(visiblePos
ition, rule); | 3252 return previousPositionOfAlgorithm<EditingInComposedTreeStrategy>(visiblePos
ition, rule); |
| 3246 } | 3253 } |
| 3247 | 3254 |
| 3248 } // namespace blink | 3255 } // namespace blink |
| OLD | NEW |