OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 if (!renderView()) | 1181 if (!renderView()) |
1182 return 0; | 1182 return 0; |
1183 | 1183 |
1184 return TreeScope::elementFromPoint(x, y); | 1184 return TreeScope::elementFromPoint(x, y); |
1185 } | 1185 } |
1186 | 1186 |
1187 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) | 1187 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) |
1188 { | 1188 { |
1189 if (!renderView()) | 1189 if (!renderView()) |
1190 return 0; | 1190 return 0; |
1191 LayoutPoint localPoint; | 1191 HitTestResult result = hitTestInDocument(*this, x, y); |
1192 RenderObject* renderer = rendererFromPoint(this, x, y, &localPoint); | 1192 RenderObject* renderer = result.renderer(); |
1193 if (!renderer) | 1193 if (!renderer) |
1194 return 0; | 1194 return 0; |
1195 | 1195 |
1196 Node* node = renderer->node(); | 1196 Node* node = renderer->node(); |
| 1197 if (node->isPseudoElement()) |
| 1198 return 0; |
1197 Node* shadowAncestorNode = ancestorInThisScope(node); | 1199 Node* shadowAncestorNode = ancestorInThisScope(node); |
1198 if (shadowAncestorNode != node) { | 1200 if (shadowAncestorNode != node) { |
1199 unsigned offset = shadowAncestorNode->nodeIndex(); | 1201 unsigned offset = shadowAncestorNode->nodeIndex(); |
1200 ContainerNode* container = shadowAncestorNode->parentNode(); | 1202 ContainerNode* container = shadowAncestorNode->parentNode(); |
1201 return Range::create(*this, container, offset, container, offset); | 1203 return Range::create(*this, container, offset, container, offset); |
1202 } | 1204 } |
1203 | 1205 |
1204 PositionWithAffinity positionWithAffinity = renderer->positionForPoint(local
Point); | 1206 PositionWithAffinity positionWithAffinity = result.position(); |
1205 if (positionWithAffinity.position().isNull()) | 1207 if (positionWithAffinity.position().isNull()) |
1206 return 0; | 1208 return 0; |
1207 | 1209 |
1208 Position rangeCompliantPosition = positionWithAffinity.position().parentAnch
oredEquivalent(); | 1210 Position rangeCompliantPosition = positionWithAffinity.position().parentAnch
oredEquivalent(); |
1209 return Range::create(*this, rangeCompliantPosition, rangeCompliantPosition); | 1211 return Range::create(*this, rangeCompliantPosition, rangeCompliantPosition); |
1210 } | 1212 } |
1211 | 1213 |
1212 /* | 1214 /* |
1213 * Performs three operations: | 1215 * Performs three operations: |
1214 * 1. Convert control characters to spaces | 1216 * 1. Convert control characters to spaces |
(...skipping 4002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5217 } | 5219 } |
5218 | 5220 |
5219 FastTextAutosizer* Document::fastTextAutosizer() | 5221 FastTextAutosizer* Document::fastTextAutosizer() |
5220 { | 5222 { |
5221 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5223 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
5222 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5224 m_fastTextAutosizer = FastTextAutosizer::create(this); |
5223 return m_fastTextAutosizer.get(); | 5225 return m_fastTextAutosizer.get(); |
5224 } | 5226 } |
5225 | 5227 |
5226 } // namespace WebCore | 5228 } // namespace WebCore |
OLD | NEW |