OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 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 10 matching lines...) Expand all Loading... |
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 "sky/engine/config.h" | 26 #include "sky/engine/config.h" |
27 #include "sky/engine/core/dom/PositionIterator.h" | 27 #include "sky/engine/core/dom/PositionIterator.h" |
28 | 28 |
29 #include "sky/engine/core/editing/htmlediting.h" | 29 #include "sky/engine/core/editing/htmlediting.h" |
30 #include "sky/engine/core/rendering/RenderBlock.h" | 30 #include "sky/engine/core/rendering/RenderBlock.h" |
| 31 #include "sky/engine/core/rendering/RenderParagraph.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 PositionIterator::operator Position() const | 35 PositionIterator::operator Position() const |
35 { | 36 { |
36 if (m_nodeAfterPositionInAnchor) { | 37 if (m_nodeAfterPositionInAnchor) { |
37 ASSERT(m_nodeAfterPositionInAnchor->parentNode() == m_anchorNode); | 38 ASSERT(m_nodeAfterPositionInAnchor->parentNode() == m_anchorNode); |
38 // FIXME: This check is inadaquete because any ancestor could be ignored
by editing | 39 // FIXME: This check is inadaquete because any ancestor could be ignored
by editing |
39 if (editingIgnoresContent(m_nodeAfterPositionInAnchor->parentNode())) | 40 if (editingIgnoresContent(m_nodeAfterPositionInAnchor->parentNode())) |
40 return positionBeforeNode(m_anchorNode); | 41 return positionBeforeNode(m_anchorNode); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 RenderObject* renderer = m_anchorNode->renderer(); | 143 RenderObject* renderer = m_anchorNode->renderer(); |
143 if (!renderer) | 144 if (!renderer) |
144 return false; | 145 return false; |
145 | 146 |
146 if (renderer->isText()) | 147 if (renderer->isText()) |
147 return !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).
inRenderedText(); | 148 return !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).
inRenderedText(); |
148 | 149 |
149 if (editingIgnoresContent(m_anchorNode)) | 150 if (editingIgnoresContent(m_anchorNode)) |
150 return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelect
None(m_anchorNode->parentNode()); | 151 return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelect
None(m_anchorNode->parentNode()); |
151 | 152 |
152 if (renderer->isRenderBlockFlow()) { | 153 if (renderer->isRenderParagraph()) { |
153 if (toRenderBlock(renderer)->logicalHeight()) { | 154 if (toRenderParagraph(renderer)->logicalHeight()) { |
154 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer
)) | 155 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer
)) |
155 return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anch
orNode); | 156 return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anch
orNode); |
156 return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSele
ctNone(m_anchorNode) && Position(*this).atEditingBoundary(); | 157 return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSele
ctNone(m_anchorNode) && Position(*this).atEditingBoundary(); |
157 } | 158 } |
158 } | 159 } |
159 | 160 |
160 return false; | 161 return false; |
161 } | 162 } |
162 | 163 |
163 } // namespace blink | 164 } // namespace blink |
OLD | NEW |