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 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 if (!renderView()) | 1186 if (!renderView()) |
1187 return 0; | 1187 return 0; |
1188 | 1188 |
1189 return TreeScope::elementFromPoint(x, y); | 1189 return TreeScope::elementFromPoint(x, y); |
1190 } | 1190 } |
1191 | 1191 |
1192 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) | 1192 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) |
1193 { | 1193 { |
1194 if (!renderView()) | 1194 if (!renderView()) |
1195 return 0; | 1195 return 0; |
1196 LayoutPoint localPoint; | 1196 HitTestResult result = hitTestInDocument(*this, x, y); |
1197 RenderObject* renderer = rendererFromPoint(this, x, y, &localPoint); | 1197 RenderObject* renderer = result.renderer(); |
1198 if (!renderer) | 1198 if (!renderer) |
1199 return 0; | 1199 return 0; |
1200 | 1200 |
1201 Node* node = renderer->node(); | 1201 Node* node = renderer->node(); |
| 1202 if (node->isPseudoElement()) |
| 1203 return 0; |
1202 Node* shadowAncestorNode = ancestorInThisScope(node); | 1204 Node* shadowAncestorNode = ancestorInThisScope(node); |
1203 if (shadowAncestorNode != node) { | 1205 if (shadowAncestorNode != node) { |
1204 unsigned offset = shadowAncestorNode->nodeIndex(); | 1206 unsigned offset = shadowAncestorNode->nodeIndex(); |
1205 ContainerNode* container = shadowAncestorNode->parentNode(); | 1207 ContainerNode* container = shadowAncestorNode->parentNode(); |
1206 return Range::create(*this, container, offset, container, offset); | 1208 return Range::create(*this, container, offset, container, offset); |
1207 } | 1209 } |
1208 | 1210 |
1209 PositionWithAffinity positionWithAffinity = renderer->positionForPoint(local
Point); | 1211 PositionWithAffinity positionWithAffinity = result.position(); |
1210 if (positionWithAffinity.position().isNull()) | 1212 if (positionWithAffinity.position().isNull()) |
1211 return 0; | 1213 return 0; |
1212 | 1214 |
1213 Position rangeCompliantPosition = positionWithAffinity.position().parentAnch
oredEquivalent(); | 1215 Position rangeCompliantPosition = positionWithAffinity.position().parentAnch
oredEquivalent(); |
1214 return Range::create(*this, rangeCompliantPosition, rangeCompliantPosition); | 1216 return Range::create(*this, rangeCompliantPosition, rangeCompliantPosition); |
1215 } | 1217 } |
1216 | 1218 |
1217 /* | 1219 /* |
1218 * Performs three operations: | 1220 * Performs three operations: |
1219 * 1. Convert control characters to spaces | 1221 * 1. Convert control characters to spaces |
(...skipping 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5223 } | 5225 } |
5224 | 5226 |
5225 FastTextAutosizer* Document::fastTextAutosizer() | 5227 FastTextAutosizer* Document::fastTextAutosizer() |
5226 { | 5228 { |
5227 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5229 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
5228 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5230 m_fastTextAutosizer = FastTextAutosizer::create(this); |
5229 return m_fastTextAutosizer.get(); | 5231 return m_fastTextAutosizer.get(); |
5230 } | 5232 } |
5231 | 5233 |
5232 } // namespace WebCore | 5234 } // namespace WebCore |
OLD | NEW |