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

Side by Side Diff: Source/core/rendering/svg/RenderSVGRoot.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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 // FIXME: This should be an intersection when rect-based hit tests are suppo rted by nodeAtFloatPoint. 406 // FIXME: This should be an intersection when rect-based hit tests are suppo rted by nodeAtFloatPoint.
407 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip () && visualOverflowRect().contains(pointInBorderBox))) { 407 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip () && visualOverflowRect().contains(pointInBorderBox))) {
408 const AffineTransform& localToParentTransform = this->localToParentTrans form(); 408 const AffineTransform& localToParentTransform = this->localToParentTrans form();
409 if (localToParentTransform.isInvertible()) { 409 if (localToParentTransform.isInvertible()) {
410 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl oatPoint(pointInParent)); 410 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl oatPoint(pointInParent));
411 411
412 for (RenderObject* child = lastChild(); child; child = child->previo usSibling()) { 412 for (RenderObject* child = lastChild(); child; child = child->previo usSibling()) {
413 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. 413 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
414 if (child->nodeAtFloatPoint(request, result, localPoint, hitTest Action)) { 414 if (child->nodeAtFloatPoint(request, result, localPoint, hitTest Action)) {
415 updateHitTestResult(result, pointInBorderBox); 415 updateHitTestResult(result, pointInBorderBox);
416 if (!result.addNodeToRectBasedTestResult(child->node(), requ est, locationInContainer)) 416 if (!result.addNodeToListBasedTestResult(child->node(), requ est, locationInContainer))
417 return true; 417 return true;
418 } 418 }
419 } 419 }
420 } 420 }
421 } 421 }
422 422
423 // If we didn't early exit above, we've just hit the container <svg> element . Unlike SVG 1.1, 2nd Edition allows container elements to be hit. 423 // If we didn't early exit above, we've just hit the container <svg> element . Unlike SVG 1.1, 2nd Edition allows container elements to be hit.
424 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil dBlockBackground) && visibleToHitTestRequest(request)) { 424 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil dBlockBackground) && visibleToHitTestRequest(request)) {
425 // Only return true here, if the last hit testing phase 'BlockBackground ' (or 'ChildBlockBackground' - depending on context) is executed. 425 // Only return true here, if the last hit testing phase 'BlockBackground ' (or 'ChildBlockBackground' - depending on context) is executed.
426 // If we'd return true in the 'Foreground' phase, hit testing would stop immediately. For SVG only trees this doesn't matter. 426 // If we'd return true in the 'Foreground' phase, hit testing would stop immediately. For SVG only trees this doesn't matter.
427 // Though when we have a <foreignObject> subtree we need to be able to d etect hits on the background of a <div> element. 427 // Though when we have a <foreignObject> subtree we need to be able to d etect hits on the background of a <div> element.
428 // If we'd return true here in the 'Foreground' phase, we are not able t o detect these hits anymore. 428 // If we'd return true here in the 'Foreground' phase, we are not able t o detect these hits anymore.
429 LayoutRect boundsRect(accumulatedOffset + location(), size()); 429 LayoutRect boundsRect(accumulatedOffset + location(), size());
430 if (locationInContainer.intersects(boundsRect)) { 430 if (locationInContainer.intersects(boundsRect)) {
431 updateHitTestResult(result, pointInBorderBox); 431 updateHitTestResult(result, pointInBorderBox);
432 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect)) 432 if (!result.addNodeToListBasedTestResult(node(), request, locationIn Container, boundsRect))
433 return true; 433 return true;
434 } 434 }
435 } 435 }
436 436
437 return false; 437 return false;
438 } 438 }
439 439
440 } 440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698