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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/editing/VisibleUnits.h" | 27 #include "core/editing/VisibleUnits.h" |
28 | 28 |
29 #include "HTMLNames.h" | 29 #include "HTMLNames.h" |
| 30 #include "RuntimeEnabledFeatures.h" |
30 #include "bindings/v8/ExceptionState.h" | 31 #include "bindings/v8/ExceptionState.h" |
31 #include "bindings/v8/ExceptionStatePlaceholder.h" | 32 #include "bindings/v8/ExceptionStatePlaceholder.h" |
32 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
33 #include "core/dom/Element.h" | 34 #include "core/dom/Element.h" |
34 #include "core/dom/NodeTraversal.h" | 35 #include "core/dom/NodeTraversal.h" |
35 #include "core/dom/Position.h" | 36 #include "core/dom/Position.h" |
36 #include "core/dom/Text.h" | 37 #include "core/dom/Text.h" |
37 #include "core/editing/RenderedPosition.h" | 38 #include "core/editing/RenderedPosition.h" |
38 #include "core/editing/TextIterator.h" | 39 #include "core/editing/TextIterator.h" |
39 #include "core/editing/VisiblePosition.h" | 40 #include "core/editing/VisiblePosition.h" |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 | 1103 |
1103 Node* startBlock = enclosingBlock(startNode); | 1104 Node* startBlock = enclosingBlock(startNode); |
1104 | 1105 |
1105 Node* node = startNode; | 1106 Node* node = startNode; |
1106 Node* highestRoot = highestEditableRoot(p); | 1107 Node* highestRoot = highestEditableRoot(p); |
1107 int offset = p.deprecatedEditingOffset(); | 1108 int offset = p.deprecatedEditingOffset(); |
1108 Position::AnchorType type = p.anchorType(); | 1109 Position::AnchorType type = p.anchorType(); |
1109 | 1110 |
1110 Node* n = startNode; | 1111 Node* n = startNode; |
1111 while (n) { | 1112 while (n) { |
1112 #if ENABLE(USERSELECT_ALL) | |
1113 if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nod
eIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable(
)) | 1113 if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nod
eIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable(
)) |
1114 #else | |
1115 if (boundaryCrossingRule == CannotCrossEditingBoundary && n->rendererIsE
ditable() != startNode->rendererIsEditable()) | |
1116 #endif | |
1117 break; | 1114 break; |
1118 if (boundaryCrossingRule == CanSkipOverEditingBoundary) { | 1115 if (boundaryCrossingRule == CanSkipOverEditingBoundary) { |
1119 while (n && n->rendererIsEditable() != startNode->rendererIsEditable
()) | 1116 while (n && n->rendererIsEditable() != startNode->rendererIsEditable
()) |
1120 n = NodeTraversal::previousPostOrder(n, startBlock); | 1117 n = NodeTraversal::previousPostOrder(n, startBlock); |
1121 if (!n || !n->isDescendantOf(highestRoot)) | 1118 if (!n || !n->isDescendantOf(highestRoot)) |
1122 break; | 1119 break; |
1123 } | 1120 } |
1124 RenderObject* r = n->renderer(); | 1121 RenderObject* r = n->renderer(); |
1125 if (!r) { | 1122 if (!r) { |
1126 n = NodeTraversal::previousPostOrder(n, startBlock); | 1123 n = NodeTraversal::previousPostOrder(n, startBlock); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 Node* startBlock = enclosingBlock(startNode); | 1179 Node* startBlock = enclosingBlock(startNode); |
1183 Node* stayInsideBlock = startBlock; | 1180 Node* stayInsideBlock = startBlock; |
1184 | 1181 |
1185 Node* node = startNode; | 1182 Node* node = startNode; |
1186 Node* highestRoot = highestEditableRoot(p); | 1183 Node* highestRoot = highestEditableRoot(p); |
1187 int offset = p.deprecatedEditingOffset(); | 1184 int offset = p.deprecatedEditingOffset(); |
1188 Position::AnchorType type = p.anchorType(); | 1185 Position::AnchorType type = p.anchorType(); |
1189 | 1186 |
1190 Node* n = startNode; | 1187 Node* n = startNode; |
1191 while (n) { | 1188 while (n) { |
1192 #if ENABLE(USERSELECT_ALL) | |
1193 if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nod
eIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable(
)) | 1189 if (boundaryCrossingRule == CannotCrossEditingBoundary && !Position::nod
eIsUserSelectAll(n) && n->rendererIsEditable() != startNode->rendererIsEditable(
)) |
1194 #else | |
1195 if (boundaryCrossingRule == CannotCrossEditingBoundary && n->rendererIsE
ditable() != startNode->rendererIsEditable()) | |
1196 #endif | |
1197 break; | 1190 break; |
1198 if (boundaryCrossingRule == CanSkipOverEditingBoundary) { | 1191 if (boundaryCrossingRule == CanSkipOverEditingBoundary) { |
1199 while (n && n->rendererIsEditable() != startNode->rendererIsEditable
()) | 1192 while (n && n->rendererIsEditable() != startNode->rendererIsEditable
()) |
1200 n = NodeTraversal::next(n, stayInsideBlock); | 1193 n = NodeTraversal::next(n, stayInsideBlock); |
1201 if (!n || !n->isDescendantOf(highestRoot)) | 1194 if (!n || !n->isDescendantOf(highestRoot)) |
1202 break; | 1195 break; |
1203 } | 1196 } |
1204 | 1197 |
1205 RenderObject* r = n->renderer(); | 1198 RenderObject* r = n->renderer(); |
1206 if (!r) { | 1199 if (!r) { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 { | 1407 { |
1415 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1408 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
1416 } | 1409 } |
1417 | 1410 |
1418 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1411 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
1419 { | 1412 { |
1420 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1413 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
1421 } | 1414 } |
1422 | 1415 |
1423 } | 1416 } |
OLD | NEW |