Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Side by Side Diff: Source/core/dom/PositionIterator.cpp

Issue 19098002: Introduce isHTMLHtmlElement and toHTMLHtmlElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
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/dom/PositionIterator.h" 27 #include "core/dom/PositionIterator.h"
28 28
29 #include "HTMLNames.h" 29 #include "HTMLNames.h"
30 #include "core/dom/Node.h" 30 #include "core/dom/Node.h"
31 #include "core/editing/htmlediting.h" 31 #include "core/editing/htmlediting.h"
32 #include "core/html/HTMLHtmlElement.h"
32 #include "core/rendering/RenderBlock.h" 33 #include "core/rendering/RenderBlock.h"
33 34
34 namespace WebCore { 35 namespace WebCore {
35 36
36 using namespace HTMLNames; 37 using namespace HTMLNames;
37 38
38 PositionIterator::operator Position() const 39 PositionIterator::operator Position() const
39 { 40 {
40 if (m_nodeAfterPositionInAnchor) { 41 if (m_nodeAfterPositionInAnchor) {
41 ASSERT(m_nodeAfterPositionInAnchor->parentNode() == m_anchorNode); 42 ASSERT(m_nodeAfterPositionInAnchor->parentNode() == m_anchorNode);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 153
153 if (renderer->isBR()) 154 if (renderer->isBR())
154 return !m_offsetInAnchor && !Position::nodeIsUserSelectNone(m_anchorNode ->parentNode()); 155 return !m_offsetInAnchor && !Position::nodeIsUserSelectNone(m_anchorNode ->parentNode());
155 156
156 if (renderer->isText()) 157 if (renderer->isText())
157 return !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this). inRenderedText(); 158 return !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this). inRenderedText();
158 159
159 if (isTableElement(m_anchorNode) || editingIgnoresContent(m_anchorNode)) 160 if (isTableElement(m_anchorNode) || editingIgnoresContent(m_anchorNode))
160 return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelect None(m_anchorNode->parentNode()); 161 return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelect None(m_anchorNode->parentNode());
161 162
162 if (!m_anchorNode->hasTagName(htmlTag) && renderer->isBlockFlow()) { 163 if (!isHTMLHtmlElement(m_anchorNode) && renderer->isBlockFlow()) {
163 if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName (bodyTag)) { 164 if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName (bodyTag)) {
164 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer )) 165 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer ))
165 return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anch orNode); 166 return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anch orNode);
166 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSe lectNone(m_anchorNode) && Position(*this).atEditingBoundary(); 167 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSe lectNone(m_anchorNode) && Position(*this).atEditingBoundary();
167 } 168 }
168 } 169 }
169 170
170 return false; 171 return false;
171 } 172 }
172 173
173 } // namespace WebCore 174 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698