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

Unified Diff: Source/core/dom/Document.cpp

Issue 13824008: Move nodesFromRect from Document to Internals (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/testing/Internals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index d4899823de51d810c236569a9a1cd5f9a8d2d397..245548683d376cd198e7b55d261954ee2230c531 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -106,7 +106,6 @@
#include "ScriptedAnimationController.h"
#include "SelectorQuery.h"
#include "ShadowRoot.h"
-#include "StaticHashSetNodeList.h"
#include "StylePropertySet.h"
#include "StyleResolver.h"
#include "StyleSheetContents.h"
@@ -1291,58 +1290,6 @@ String Document::suggestedMIMEType() const
return String();
}
-// FIXME: We need to discuss the DOM API here at some point. Ideas:
-// * making it receive a rect as parameter, i.e. nodesFromRect(x, y, w, h);
-// * making it receive the expading size of each direction separately,
-// i.e. nodesFromRect(x, y, topSize, rightSize, bottomSize, leftSize);
-PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, HitTestRequest::HitTestRequestType hitType) const
-{
- // FIXME: Share code between this, elementFromPoint and caretRangeFromPoint.
- if (!renderer())
- return 0;
- Frame* frame = this->frame();
- if (!frame)
- return 0;
- FrameView* frameView = frame->view();
- if (!frameView)
- return 0;
-
- float zoomFactor = frame->pageZoomFactor();
- LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + view()->scrollX(), centerY * zoomFactor + view()->scrollY()));
-
- HitTestRequest request(hitType);
-
- // When ignoreClipping is false, this method returns null for coordinates outside of the viewport.
- if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, leftPadding)))
- return 0;
-
- // Passing a zero padding will trigger a rect hit test, however for the purposes of nodesFromRect,
- // we special handle this case in order to return a valid NodeList.
- if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) {
- HitTestResult result(point);
- return handleZeroPadding(request, result);
- }
-
- HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding);
- renderView()->hitTest(request, result);
-
- return StaticHashSetNodeList::adopt(result.rectBasedTestResult());
-}
-
-PassRefPtr<NodeList> Document::handleZeroPadding(const HitTestRequest& request, HitTestResult& result) const
-{
- renderView()->hitTest(request, result);
-
- Node* node = result.innerNode();
- if (!node)
- return 0;
-
- node = node->deprecatedShadowAncestorNode();
- ListHashSet<RefPtr<Node> > list;
- list.add(node);
- return StaticHashSetNodeList::adopt(list);
-}
-
Element* Document::elementFromPoint(int x, int y) const
{
if (!renderer())
« no previous file with comments | « no previous file | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698