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