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

Side by Side Diff: Source/core/rendering/HitTestResult.cpp

Issue 96483003: CANCEL: Make Document::caretRangeFromPoint() to work with :before style Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-12-03T12:38:54 Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 m_scrollbar = other.scrollbar(); 110 m_scrollbar = other.scrollbar();
111 m_isFirstLetter = other.m_isFirstLetter; 111 m_isFirstLetter = other.m_isFirstLetter;
112 m_isOverWidget = other.isOverWidget(); 112 m_isOverWidget = other.isOverWidget();
113 113
114 // Only copy the NodeSet in case of rect hit test. 114 // Only copy the NodeSet in case of rect hit test.
115 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(* other.m_rectBasedTestResult) : 0); 115 m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(* other.m_rectBasedTestResult) : 0);
116 116
117 return *this; 117 return *this;
118 } 118 }
119 119
120 PositionWithAffinity HitTestResult::position() const
121 {
122 if (!m_innerPossiblyPseudoNode)
123 return Position();
124 if (RenderObject* renderer = this->renderer())
125 return renderer->positionForPoint(localPoint());
126 return Position();
127 }
128
120 RenderObject* HitTestResult::renderer() const 129 RenderObject* HitTestResult::renderer() const
121 { 130 {
122 if (!m_innerNode) 131 if (!m_innerPossiblyPseudoNode)
123 return 0; 132 return 0;
124 RenderObject* renderer = m_innerNode->renderer(); 133 RenderObject* renderer = m_innerPossiblyPseudoNode->renderer();
125 if (!m_isFirstLetter || !renderer || !renderer->isText() || !toRenderText(re nderer)->isTextFragment()) 134 if (!m_isFirstLetter || !renderer || !renderer->isText() || !toRenderText(re nderer)->isTextFragment())
126 return renderer; 135 return renderer;
127 return toRenderTextFragment(renderer)->firstRenderTextInFirstLetter(); 136 return toRenderTextFragment(renderer)->firstRenderTextInFirstLetter();
128 } 137 }
129 138
130 void HitTestResult::setToNodesInDocumentTreeScope() 139 void HitTestResult::setToNodesInDocumentTreeScope()
131 { 140 {
132 if (Node* node = innerNode()) { 141 if (Node* node = innerNode()) {
133 node = node->document().ancestorInThisScope(node); 142 node = node->document().ancestorInThisScope(node);
134 setInnerNode(node); 143 setInnerNode(node);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 { 516 {
508 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) { 517 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) {
509 if (node->isElementNode()) 518 if (node->isElementNode())
510 return toElement(node); 519 return toElement(node);
511 } 520 }
512 521
513 return 0; 522 return 0;
514 } 523 }
515 524
516 } // namespace WebCore 525 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698