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

Side by Side Diff: Source/core/testing/Internals.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 LocalFrame* frame = document->frame(); 1354 LocalFrame* frame = document->frame();
1355 FrameView* frameView = document->view(); 1355 FrameView* frameView = document->view();
1356 RenderView* renderView = document->renderView(); 1356 RenderView* renderView = document->renderView();
1357 1357
1358 if (!renderView) 1358 if (!renderView)
1359 return nullptr; 1359 return nullptr;
1360 1360
1361 float zoomFactor = frame->pageZoomFactor(); 1361 float zoomFactor = frame->pageZoomFactor();
1362 LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + fra meView->scrollX(), centerY * zoomFactor + frameView->scrollY())); 1362 LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + fra meView->scrollX(), centerY * zoomFactor + frameView->scrollY()));
1363 1363
1364 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active; 1364 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active | HitTestRequest::ListBased;
1365 if (ignoreClipping) 1365 if (ignoreClipping)
1366 hitType |= HitTestRequest::IgnoreClipping; 1366 hitType |= HitTestRequest::IgnoreClipping;
1367 if (allowChildFrameContent) 1367 if (allowChildFrameContent)
1368 hitType |= HitTestRequest::AllowChildFrameContent; 1368 hitType |= HitTestRequest::AllowChildFrameContent;
1369 1369
1370 HitTestRequest request(hitType); 1370 HitTestRequest request(hitType);
1371 1371
1372 // When ignoreClipping is false, this method returns null for coordinates ou tside of the viewport. 1372 // When ignoreClipping is false, this method returns null for coordinates ou tside of the viewport.
1373 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects (HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l eftPadding))) 1373 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects (HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l eftPadding)))
1374 return nullptr; 1374 return nullptr;
1375 1375
1376 WillBeHeapVector<RefPtrWillBeMember<Node> > matches; 1376 WillBeHeapVector<RefPtrWillBeMember<Node> > matches;
1377 1377 HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPad ding);
1378 // Need padding to trigger a rect based hit test, but we want to return a No deList 1378 renderView->hitTest(request, result);
1379 // so we special case this. 1379 copyToVector(result.listBasedTestResult(), matches);
1380 if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) {
1381 HitTestResult result(point);
1382 renderView->hitTest(request, result);
1383
1384 if (Node* innerNode = result.innerNode()) {
1385 if (innerNode->isInShadowTree())
1386 innerNode = innerNode->shadowHost();
1387 matches.append(innerNode);
1388 }
1389 } else {
1390 HitTestResult result(point, topPadding, rightPadding, bottomPadding, lef tPadding);
1391 renderView->hitTest(request, result);
1392 copyToVector(result.rectBasedTestResult(), matches);
1393 }
1394 1380
1395 return StaticNodeList::adopt(matches); 1381 return StaticNodeList::adopt(matches);
1396 } 1382 }
1397 1383
1398 bool Internals::hasSpellingMarker(Document* document, int from, int length) 1384 bool Internals::hasSpellingMarker(Document* document, int from, int length)
1399 { 1385 {
1400 ASSERT(document); 1386 ASSERT(document);
1401 if (!document->frame()) 1387 if (!document->frame())
1402 return 0; 1388 return 0;
1403 1389
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 { 2343 {
2358 ThreadState::current()->scheduleGC(); 2344 ThreadState::current()->scheduleGC();
2359 } 2345 }
2360 2346
2361 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc eptionState&) 2347 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc eptionState&)
2362 { 2348 {
2363 return new InternalsIterationSource(); 2349 return new InternalsIterationSource();
2364 } 2350 }
2365 2351
2366 } // namespace blink 2352 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698