OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 return nullptr; | 96 return nullptr; |
97 } | 97 } |
98 | 98 |
99 Node* NextLeafWithSameEditability( | 99 Node* NextLeafWithSameEditability( |
100 Node* node, | 100 Node* node, |
101 EditableType editable_type = kContentIsEditable) { | 101 EditableType editable_type = kContentIsEditable) { |
102 if (!node) | 102 if (!node) |
103 return nullptr; | 103 return nullptr; |
104 | 104 |
105 bool editable = HasEditableStyle(*node, editable_type); | 105 const bool editable = HasEditableStyle(*node, editable_type); |
106 node = NextAtomicLeafNode(*node); | 106 for (Node* runner = NextAtomicLeafNode(*node); runner; |
107 while (node) { | 107 runner = NextAtomicLeafNode(*runner)) { |
108 if (editable == HasEditableStyle(*node, editable_type)) | 108 if (editable == HasEditableStyle(*runner, editable_type)) |
109 return node; | 109 return runner; |
110 node = NextAtomicLeafNode(*node); | |
111 } | 110 } |
112 return nullptr; | 111 return nullptr; |
113 } | 112 } |
114 | 113 |
115 enum LineEndpointComputationMode { kUseLogicalOrdering, kUseInlineBoxOrdering }; | 114 enum LineEndpointComputationMode { kUseLogicalOrdering, kUseInlineBoxOrdering }; |
116 template <typename Strategy> | 115 template <typename Strategy> |
117 PositionWithAffinityTemplate<Strategy> StartPositionForLine( | 116 PositionWithAffinityTemplate<Strategy> StartPositionForLine( |
118 const PositionWithAffinityTemplate<Strategy>& c, | 117 const PositionWithAffinityTemplate<Strategy>& c, |
119 LineEndpointComputationMode mode) { | 118 LineEndpointComputationMode mode) { |
120 if (c.IsNull()) | 119 if (c.IsNull()) |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 // to the end of the line we're on. | 679 // to the end of the line we're on. |
681 Element* root_element = HasEditableStyle(*node, editable_type) | 680 Element* root_element = HasEditableStyle(*node, editable_type) |
682 ? RootEditableElement(*node, editable_type) | 681 ? RootEditableElement(*node, editable_type) |
683 : node->GetDocument().documentElement(); | 682 : node->GetDocument().documentElement(); |
684 if (!root_element) | 683 if (!root_element) |
685 return VisiblePosition(); | 684 return VisiblePosition(); |
686 return VisiblePosition::LastPositionInNode(root_element); | 685 return VisiblePosition::LastPositionInNode(root_element); |
687 } | 686 } |
688 | 687 |
689 } // namespace blink | 688 } // namespace blink |
OLD | NEW |