Source/WebCore/ChangeLog

 12012-06-26 Allan Sandfeld Jensen <allan.jensen@nokia.com>
 2
 3 NodesFromRect doesn't work on SVG root elements.
 4 https://bugs.webkit.org/show_bug.cgi?id=89990
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Test: fast/dom/nodesFromRect-svg.html
 9
 10 * rendering/svg/RenderSVGRoot.cpp:
 11 (WebCore::RenderSVGRoot::nodeAtPoint):
 12
1132012-06-26 Huang Dongsung <luxtella@company100.net>
214
315 [Texmap] Bug fix typo about computing bytesPerLine in BitmapTextureGL.

Source/WebCore/rendering/svg/RenderSVGRoot.cpp

@@void RenderSVGRoot::updateCachedBoundaries()
418418bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
419419{
420420 LayoutPoint pointInParent = pointInContainer.point() - toLayoutSize(accumulatedOffset);
421  LayoutPoint pointInBorderBox(pointInParent.x() - x(), pointInParent.y() - y());
422 
423  // Note: For now, we're ignoring hits to border and padding for <svg>
424  if (!contentBoxRect().contains(pointInBorderBox))
425  return false;
426 
427  FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent));
428 
429  for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
430  if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {
431  // FIXME: CSS/HTML assumes the local point is relative to the border box, right?
432  updateHitTestResult(result, pointInBorderBox);
433  // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
434  result.addNodeToRectBasedTestResult(child->node(), pointInContainer);
435  return true;
 421 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location());
 422
 423 // Only test SVG content if the point is in our content box.
 424 // FIXME: This should be an intersection when rect-based hit tests are supported by nodeAtFloatPoint.
 425 if (contentBoxRect().contains(pointInBorderBox)) {
 426 FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent));
 427
 428 for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
 429 if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {
 430 updateHitTestResult(result, pointInBorderBox);
 431 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
 432 result.addNodeToRectBasedTestResult(child->node(), pointInContainer);
 433 return true;
 434 }
436435 }
437436 }
438437
439438 // 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.
440  if (hitTestAction == HitTestBlockBackground && style()->pointerEvents() != PE_NONE) {
 439 if (visibleToHitTesting() && hitTestAction == HitTestBlockBackground) {
441440 // Only return true here, if the last hit testing phase 'BlockBackground' is executed. If we'd return true in the 'Foreground' phase,
442441 // hit testing would stop immediately. For SVG only trees this doesn't matter. Though when we have a <foreignObject> subtree we need
443442 // to be able to detect hits on the background of a <div> element. If we'd return true here in the 'Foreground' phase, we are not able
444443 // to detect these hits anymore.
445  updateHitTestResult(result, roundedLayoutPoint(localPoint));
446  return true;
 444 LayoutRect boundsRect(accumulatedOffset + location(), size());
 445 if (pointInContainer.intersects(boundsRect)) {
 446 updateHitTestResult(result, pointInBorderBox);
 447 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
 448 return true;
 449 }
447450 }
448451
449452 return false;

LayoutTests/ChangeLog

112012-06-26 Allan Sandfeld Jensen <allan.jensen@nokia.com>
22
 3 NodesFromRect doesn't work on SVG root elements.
 4 https://bugs.webkit.org/show_bug.cgi?id=89990
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Test nodesFromRect on SVG root elements.
 9
 10 * fast/dom/nodesFromRect-svg-expected.txt: Added.
 11 * fast/dom/nodesFromRect-svg.html: Added.
 12
 132012-06-26 Allan Sandfeld Jensen <allan.jensen@nokia.com>
 14
315 [Qt] Baseline missing for 3D transforms tests.
416 https://bugs.webkit.org/show_bug.cgi?id=89973
517

LayoutTests/fast/dom/nodesFromRect-svg-expected.txt

 1Document::nodesFromRect : Rect-based hit-testing on SVG elements - bug ?
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Check area hits fully inside SVG element
 7PASS All correct nodes found for rect
 8PASS All correct nodes found for rect
 9PASS All correct nodes found for rect
 10PASS All correct nodes found for rect
 11
 12The following tests will likely FAIL and will need to be updated once rect-based
 13hit tests are supported inside SVG elements:
 14
 15Check area hits overlapping SVG element
 16PASS All correct nodes found for rect
 17PASS All correct nodes found for rect
 18Check area hits across SVG elements
 19PASS All correct nodes found for rect
 20
 21PASS successfullyParsed is true
 22
 23TEST COMPLETE
 24

LayoutTests/fast/dom/nodesFromRect-svg.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<title>Document::nodesFromRect : Rect-based hit-testing on SVG elements - bug ?</title>
 5<style type="text/css">
 6 #sandbox {
 7 position: absolute;
 8 left: 0px;
 9 top: 0px;
 10 width: 600px;
 11 height: 800px;
 12 }
 13 .svg {
 14 width: 40px;
 15 height: 20px;
 16 margin: 10px;
 17 padding: 2px;
 18 box-sizing: border-box;
 19 }
 20</style>
 21<script src="../js/resources/js-test-pre.js"></script>
 22<script src="resources/nodesFromRect.js"></script>
 23</head>
 24
 25<body>
 26 <div id=sandbox>
 27 <div class=svg id=div1>
 28 <svg id=svg1 height=16 xmlns="http://www.w3.org/2000/svg">
 29 <circle id="red" cx="8" cy="8" r="5" fill="red" />
 30 </svg>
 31 </div>
 32 <div class=svg id=div2>
 33 <svg id=svg2 height=16 xmlns="http://www.w3.org/2000/svg">
 34 <circle id="yellow" cx="8" cy="8" r="5" fill="yellow" />
 35 </svg>
 36 </div>
 37 <div class=svg id=div3>
 38 <svg id=svg3 height=16 xmlns="http://www.w3.org/2000/svg">
 39 <circle id="green" cx="8" cy="8" r="5" fill="green" />
 40 </svg>
 41 </div>
 42 </div>
 43
 44 <script>
 45 function runTest()
 46 {
 47 description(document.title);
 48 var e = {};
 49
 50 // Set up shortcut access to elements
 51 ['sandbox', 'div1', 'div2', 'div3', 'div4',
 52 'svg1', 'svg2', 'svg3', 'svg4',
 53 'red', 'yellow', 'green'].forEach(function(a) {
 54 e[a] = document.getElementById(a);
 55 });
 56
 57 window.scrollTo(0, 0);
 58
 59 debug('Check area hits fully inside SVG element');
 60 check(20, 20, 4, 4, 4, 4, [e.red]);
 61 check(20, 52, 4, 4, 4, 4, [e.yellow]);
 62 check(18, 80, 4, 4, 4, 4, [e.green]);
 63 check(14, 14, 2, 2, 2, 2, [e.svg1]);
 64
 65 debug('\nThe following tests will likely FAIL and will need to be updated once rect-based')
 66 debug('hit tests are supported inside SVG elements:\n');
 67
 68 debug('Check area hits overlapping SVG element');
 69 check(12, 12, 2, 2, 2, 2, [e.svg1, e.div1]);
 70 check(6, 50, 5, 20, 5, 5, [e.svg2, e.div2, e.sandbox]);
 71
 72 debug('Check area hits across SVG elements');
 73 check(20, 30, 20, 10, 30, 10, [e.svg2, e.div2, e.svg1, e.div1, e.sandbox]);
 74
 75 debug('');
 76 }
 77
 78 runTest();
 79 </script>
 80
 81 <p id='description'></p>
 82 <span id="console"></span>
 83 <script src="../js/resources/js-test-post.js"></script>
 84</body>
 85</html>
 86