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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 return 0; | 1200 return 0; |
1201 | 1201 |
1202 return TreeScope::elementFromPoint(x, y); | 1202 return TreeScope::elementFromPoint(x, y); |
1203 } | 1203 } |
1204 | 1204 |
1205 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) | 1205 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) |
1206 { | 1206 { |
1207 if (!renderer()) | 1207 if (!renderer()) |
1208 return 0; | 1208 return 0; |
1209 LayoutPoint localPoint; | 1209 LayoutPoint localPoint; |
1210 Node* node = nodeFromPoint(this, x, y, &localPoint); | 1210 RenderObject* renderer = rendererFromPoint(this, x, y, &localPoint); |
1211 if (!node) | 1211 if (!renderer) |
1212 return 0; | 1212 return 0; |
1213 | 1213 |
| 1214 Node* node = renderer->node(); |
1214 Node* shadowAncestorNode = ancestorInThisScope(node); | 1215 Node* shadowAncestorNode = ancestorInThisScope(node); |
1215 if (shadowAncestorNode != node) { | 1216 if (shadowAncestorNode != node) { |
1216 unsigned offset = shadowAncestorNode->nodeIndex(); | 1217 unsigned offset = shadowAncestorNode->nodeIndex(); |
1217 ContainerNode* container = shadowAncestorNode->parentNode(); | 1218 ContainerNode* container = shadowAncestorNode->parentNode(); |
1218 return Range::create(*this, container, offset, container, offset); | 1219 return Range::create(*this, container, offset, container, offset); |
1219 } | 1220 } |
1220 | 1221 |
1221 RenderObject* renderer = node->renderer(); | |
1222 if (!renderer) | |
1223 return 0; | |
1224 PositionWithAffinity positionWithAffinity = renderer->positionForPoint(local
Point); | 1222 PositionWithAffinity positionWithAffinity = renderer->positionForPoint(local
Point); |
1225 if (positionWithAffinity.position().isNull()) | 1223 if (positionWithAffinity.position().isNull()) |
1226 return 0; | 1224 return 0; |
1227 | 1225 |
1228 Position rangeCompliantPosition = positionWithAffinity.position().parentAnch
oredEquivalent(); | 1226 Position rangeCompliantPosition = positionWithAffinity.position().parentAnch
oredEquivalent(); |
1229 return Range::create(*this, rangeCompliantPosition, rangeCompliantPosition); | 1227 return Range::create(*this, rangeCompliantPosition, rangeCompliantPosition); |
1230 } | 1228 } |
1231 | 1229 |
1232 /* | 1230 /* |
1233 * Performs three operations: | 1231 * Performs three operations: |
(...skipping 4088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5322 { | 5320 { |
5323 return DocumentLifecycleNotifier::create(this); | 5321 return DocumentLifecycleNotifier::create(this); |
5324 } | 5322 } |
5325 | 5323 |
5326 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5324 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5327 { | 5325 { |
5328 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); | 5326 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); |
5329 } | 5327 } |
5330 | 5328 |
5331 } // namespace WebCore | 5329 } // namespace WebCore |
OLD | NEW |