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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp

Issue 1630793002: Stop hit testing culled inlines when a match is found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simpler approach, but duplicated code Created 4 years, 10 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // FIXME: This should be an intersection when rect-based hit tests are suppo rted by nodeAtFloatPoint. 374 // FIXME: This should be an intersection when rect-based hit tests are suppo rted by nodeAtFloatPoint.
375 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip () && visualOverflowRect().contains(pointInBorderBox))) { 375 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip () && visualOverflowRect().contains(pointInBorderBox))) {
376 const AffineTransform& localToParentTransform = this->localToParentTrans form(); 376 const AffineTransform& localToParentTransform = this->localToParentTrans form();
377 if (localToParentTransform.isInvertible()) { 377 if (localToParentTransform.isInvertible()) {
378 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl oatPoint(pointInParent)); 378 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl oatPoint(pointInParent));
379 379
380 for (LayoutObject* child = lastChild(); child; child = child->previo usSibling()) { 380 for (LayoutObject* child = lastChild(); child; child = child->previo usSibling()) {
381 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. 381 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
382 if (child->nodeAtFloatPoint(result, localPoint, hitTestAction)) { 382 if (child->nodeAtFloatPoint(result, localPoint, hitTestAction)) {
383 updateHitTestResult(result, pointInBorderBox); 383 updateHitTestResult(result, pointInBorderBox);
384 if (!result.addNodeToListBasedTestResult(child->node(), loca tionInContainer)) 384 if (result.addNodeToListBasedTestResult(child->node(), locat ionInContainer) == StopHitTesting)
385 return true; 385 return true;
386 } 386 }
387 } 387 }
388 } 388 }
389 } 389 }
390 390
391 // 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. 391 // 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.
392 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil dBlockBackground) && visibleToHitTestRequest(result.hitTestRequest())) { 392 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil dBlockBackground) && visibleToHitTestRequest(result.hitTestRequest())) {
393 // Only return true here, if the last hit testing phase 'BlockBackground ' (or 'ChildBlockBackground' - depending on context) is executed. 393 // Only return true here, if the last hit testing phase 'BlockBackground ' (or 'ChildBlockBackground' - depending on context) is executed.
394 // If we'd return true in the 'Foreground' phase, hit testing would stop immediately. For SVG only trees this doesn't matter. 394 // If we'd return true in the 'Foreground' phase, hit testing would stop immediately. For SVG only trees this doesn't matter.
395 // Though when we have a <foreignObject> subtree we need to be able to d etect hits on the background of a <div> element. 395 // Though when we have a <foreignObject> subtree we need to be able to d etect hits on the background of a <div> element.
396 // If we'd return true here in the 'Foreground' phase, we are not able t o detect these hits anymore. 396 // If we'd return true here in the 'Foreground' phase, we are not able t o detect these hits anymore.
397 LayoutRect boundsRect(accumulatedOffset + location(), size()); 397 LayoutRect boundsRect(accumulatedOffset + location(), size());
398 if (locationInContainer.intersects(boundsRect)) { 398 if (locationInContainer.intersects(boundsRect)) {
399 updateHitTestResult(result, pointInBorderBox); 399 updateHitTestResult(result, pointInBorderBox);
400 if (!result.addNodeToListBasedTestResult(node(), locationInContainer , boundsRect)) 400 if (result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect) == StopHitTesting)
401 return true; 401 return true;
402 } 402 }
403 } 403 }
404 404
405 return false; 405 return false;
406 } 406 }
407 407
408 } // namespace blink 408 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698