OLD | NEW |
---|---|
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 Loading... | |
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 RenderObject* renderer = this->renderer(); | |
125 return renderer ? renderer->positionForPoint(localPoint()) : Position(); | |
ojan
2013/12/02 22:39:54
Nit: I'd write this as follows:
if (RenderObject*
yosin_UTC9
2013/12/03 05:13:00
Done.
| |
126 } | |
127 | |
120 RenderObject* HitTestResult::renderer() const | 128 RenderObject* HitTestResult::renderer() const |
121 { | 129 { |
122 if (!m_innerNode) | 130 if (!m_innerPossiblyPseudoNode) |
123 return 0; | 131 return 0; |
124 RenderObject* renderer = m_innerNode->renderer(); | 132 RenderObject* renderer = m_innerPossiblyPseudoNode->renderer(); |
125 if (!m_isFirstLetter || !renderer || !renderer->isText() || !toRenderText(re nderer)->isTextFragment()) | 133 if (!m_isFirstLetter || !renderer || !renderer->isText() || !toRenderText(re nderer)->isTextFragment()) |
126 return renderer; | 134 return renderer; |
127 return toRenderTextFragment(renderer)->firstRenderTextInFirstLetter(); | 135 return toRenderTextFragment(renderer)->firstRenderTextInFirstLetter(); |
128 } | 136 } |
129 | 137 |
130 void HitTestResult::setToNodesInDocumentTreeScope() | 138 void HitTestResult::setToNodesInDocumentTreeScope() |
131 { | 139 { |
132 if (Node* node = innerNode()) { | 140 if (Node* node = innerNode()) { |
133 node = node->document().ancestorInThisScope(node); | 141 node = node->document().ancestorInThisScope(node); |
134 setInnerNode(node); | 142 setInnerNode(node); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 { | 515 { |
508 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) { | 516 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) { |
509 if (node->isElementNode()) | 517 if (node->isElementNode()) |
510 return toElement(node); | 518 return toElement(node); |
511 } | 519 } |
512 | 520 |
513 return 0; | 521 return 0; |
514 } | 522 } |
515 | 523 |
516 } // namespace WebCore | 524 } // namespace WebCore |
OLD | NEW |