Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 869813003: Implement elementsFromPoint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix typeo Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1241 }
1242 1242
1243 Element* Document::elementFromPoint(int x, int y) const 1243 Element* Document::elementFromPoint(int x, int y) const
1244 { 1244 {
1245 if (!renderView()) 1245 if (!renderView())
1246 return 0; 1246 return 0;
1247 1247
1248 return TreeScope::elementFromPoint(x, y); 1248 return TreeScope::elementFromPoint(x, y);
1249 } 1249 }
1250 1250
1251 Vector<Element*> Document::elementsFromPoint(int x, int y) const
1252 {
1253 if (!renderView())
1254 return Vector<Element*>();
1255
1256 return TreeScope::elementsFromPoint(x, y);
1257 }
1258
1251 PassRefPtrWillBeRawPtr<Range> Document::caretRangeFromPoint(int x, int y) 1259 PassRefPtrWillBeRawPtr<Range> Document::caretRangeFromPoint(int x, int y)
1252 { 1260 {
1253 if (!renderView()) 1261 if (!renderView())
1254 return nullptr; 1262 return nullptr;
1255 HitTestResult result = hitTestInDocument(this, x, y); 1263 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
1264 HitTestResult result = hitTestInDocument(this, x, y, request);
1256 RenderObject* renderer = result.renderer(); 1265 RenderObject* renderer = result.renderer();
1257 if (!renderer) 1266 if (!renderer)
1258 return nullptr; 1267 return nullptr;
1259 1268
1260 Node* node = renderer->node(); 1269 Node* node = renderer->node();
1261 Node* shadowAncestorNode = ancestorInThisScope(node); 1270 Node* shadowAncestorNode = ancestorInThisScope(node);
1262 if (shadowAncestorNode != node) { 1271 if (shadowAncestorNode != node) {
1263 unsigned offset = shadowAncestorNode->nodeIndex(); 1272 unsigned offset = shadowAncestorNode->nodeIndex();
1264 ContainerNode* container = shadowAncestorNode->parentNode(); 1273 ContainerNode* container = shadowAncestorNode->parentNode();
1265 return Range::create(*this, container, offset, container, offset); 1274 return Range::create(*this, container, offset, container, offset);
(...skipping 4505 matching lines...) Expand 10 before | Expand all | Expand 10 after
5771 #ifndef NDEBUG 5780 #ifndef NDEBUG
5772 using namespace blink; 5781 using namespace blink;
5773 void showLiveDocumentInstances() 5782 void showLiveDocumentInstances()
5774 { 5783 {
5775 WeakDocumentSet& set = liveDocumentSet(); 5784 WeakDocumentSet& set = liveDocumentSet();
5776 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5785 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5777 for (Document* document : set) 5786 for (Document* document : set)
5778 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5787 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5779 } 5788 }
5780 #endif 5789 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698