Diff
Modified: trunk/LayoutTests/ChangeLog (145097 => 145098)
--- trunk/LayoutTests/ChangeLog 2013-03-07 18:25:10 UTC (rev 145097)
+++ trunk/LayoutTests/ChangeLog 2013-03-07 18:35:02 UTC (rev 145098)
@@ -1,3 +1,17 @@
+2013-03-07 Allan Sandfeld Jensen <allan.jen...@digia.com>
+
+ REGRESSION(r143727): Clicking / selecting inside an <embed> is broken
+ https://bugs.webkit.org/show_bug.cgi?id=111217
+
+ Reviewed by Julien Chaffraix.
+
+ Test rect and point based hit-testing inside embed and object child frames.
+
+ * fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content-expected.txt: Added.
+ * fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html: Added.
+ * fast/dom/nodesFromRect/resources/nodesFromRect.js:
+ (checkPoint):
+
2013-03-07 Alexey Proskuryakov <a...@apple.com>
FormData should allow setting filename to empty
Added: trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content-expected.txt (0 => 145098)
--- trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content-expected.txt 2013-03-07 18:35:02 UTC (rev 145098)
@@ -0,0 +1,17 @@
+
+REGRESSION(r143727): Clicking / selecting inside an embed is broken - bug 111217
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Correct node found for point
+PASS Correct node found for point
+PASS Correct node found for point
+PASS Correct node found for point
+PASS All correct nodes found for rect
+PASS All correct nodes found for rect
+PASS All correct nodes found for rect
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html (0 => 145098)
--- trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html (rev 0)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html 2013-03-07 18:35:02 UTC (rev 145098)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>REGRESSION(r143727): Clicking / selecting inside an embed is broken - bug 111217</title>
+ <script src=""
+ <script src=""
+ <style>
+ body { margin: 0px; }
+ #sandbox {
+ width: 400px;
+ height: 200px;
+ }
+ #sandbox embed {
+ float: right;
+ display: block;
+ box-sizing: border-box;
+ width: 200px;
+ height: 200px;
+ border: none;
+ }
+ #sandbox object {
+ display: block;
+ box-sizing: border-box;
+ width: 200px;
+ height: 200px;
+ border: none;
+ }
+ </style>
+</head>
+<body id="body">
+ <div id=sandbox>
+ <embed id="childframe1" src=""
+ <object id="childframe2" type="text/html" data=""
+ </div>
+
+ <p id='description'></p>
+ <div id="console"></div>
+ <script type="application/_javascript_">
+ function runTest()
+ {
+ description(document.title);
+
+ // Set up shortcut access to elements
+ var e = {};
+ ['sandbox', 'layer'].forEach(function(a) {
+ e[a] = document.getElementById(a);
+ });
+
+ checkPoint(20, 20, "DIV#left");
+ checkPoint(140, 20, "DIV#right");
+
+ checkPoint(220, 20, "DIV#left");
+ checkPoint(340, 20, "DIV#right");
+
+ checkRect(25, 25, 100, 100, "DIV#right, DIV#left, HTML");
+ checkRect(250, 20, 100, 70, "DIV#right, DIV#left, HTML");
+
+ checkRect(150, 50, 100, 100, "DIV#right, HTML, #document, OBJECT#childframe2, DIV#left, HTML, #document, EMBED#childframe1, DIV#sandbox");
+
+
+ e.sandbox.display = 'none';
+ finishJSTest();
+ }
+ jsTestIsAsync = true;
+ window._onload_ = runTest;
+ </script>
+ <script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/dom/nodesFromRect/resources/nodesFromRect.js (145097 => 145098)
--- trunk/LayoutTests/fast/dom/nodesFromRect/resources/nodesFromRect.js 2013-03-07 18:25:10 UTC (rev 145097)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/resources/nodesFromRect.js 2013-03-07 18:35:02 UTC (rev 145098)
@@ -94,6 +94,23 @@
}
}
+function checkPoint(left, top, expectedNodeString, doc)
+{
+ if (!window.internals)
+ return;
+
+ if (!doc)
+ doc = document;
+
+ var nodeString = nodesFromRectAsString(doc, left, top, 0, 0, 0, 0);
+
+ if (nodeString == expectedNodeString) {
+ testPassed("Correct node found for point");
+ } else {
+ testFailed("NodesFromRect should be [" + expectedNodeString + "] was [" + nodeString + "]");
+ }
+}
+
function nodesFromRectAsString(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding)
{
var nodeString = "";
Modified: trunk/Source/WebCore/ChangeLog (145097 => 145098)
--- trunk/Source/WebCore/ChangeLog 2013-03-07 18:25:10 UTC (rev 145097)
+++ trunk/Source/WebCore/ChangeLog 2013-03-07 18:35:02 UTC (rev 145098)
@@ -1,3 +1,23 @@
+2013-03-07 Allan Sandfeld Jensen <allan.jen...@digia.com>
+
+ REGRESSION(r143727): Clicking / selecting inside an <embed> is broken
+ https://bugs.webkit.org/show_bug.cgi?id=111217
+
+ Reviewed by Julien Chaffraix.
+
+ Hit-testing into child frames need to happen in RenderPart, otherwise
+ we will miss frame views in <embed> and <object> elements.
+
+ Test: fast/dom/nodesFromRect/nodesFromRect-embedded-frame-content.html
+
+ * rendering/RenderFrameBase.cpp:
+ * rendering/RenderFrameBase.h:
+ (RenderFrameBase):
+ * rendering/RenderPart.cpp:
+ (WebCore::RenderPart::nodeAtPoint):
+ * rendering/RenderPart.h:
+ (RenderPart):
+
2013-03-07 Alexey Proskuryakov <a...@apple.com>
FormData should allow setting filename to empty
Modified: trunk/Source/WebCore/rendering/RenderFrameBase.cpp (145097 => 145098)
--- trunk/Source/WebCore/rendering/RenderFrameBase.cpp 2013-03-07 18:25:10 UTC (rev 145097)
+++ trunk/Source/WebCore/rendering/RenderFrameBase.cpp 2013-03-07 18:35:02 UTC (rev 145098)
@@ -29,8 +29,6 @@
#include "Frame.h"
#include "FrameView.h"
#include "HTMLFrameElementBase.h"
-#include "HitTestResult.h"
-#include "RenderLayer.h"
#include "RenderView.h"
namespace WebCore {
@@ -104,43 +102,4 @@
setNeedsLayout(false);
}
-bool RenderFrameBase::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
-{
- if (!request.allowsChildFrameContent())
- return RenderPart::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action);
-
- ASSERT_WITH_SECURITY_IMPLICATION(!widget() || widget()->isFrameView());
- FrameView* childFrameView = static_cast<FrameView*>(widget());
- RenderView* childRoot = childFrameView ? childFrameView->renderView() : 0;
-
- if (childRoot) {
- LayoutPoint adjustedLocation = accumulatedOffset + location();
- LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - childFrameView->scrollOffset();
- HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset);
- HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildFrameHitTest);
- HitTestResult childFrameResult(newHitTestLocation);
-
- bool isInsideChildFrame = childRoot->hitTest(newHitTestRequest, newHitTestLocation, childFrameResult);
-
- if (newHitTestLocation.isRectBasedTest())
- result.append(childFrameResult);
- else if (isInsideChildFrame)
- result = childFrameResult;
-
- if (isInsideChildFrame)
- return true;
-
- if (request.allowsFrameScrollbars()) {
- // ScrollView scrollbars are not the same as RenderLayer scrollbars tested by RenderLayer::hitTestOverflowControls,
- // so we need to test ScrollView scrollbars separately here.
- // FIXME: Consider if this test could be done unconditionally.
- Scrollbar* frameScrollbar = childFrameView->scrollbarAtPoint(newHitTestLocation.roundedPoint());
- if (frameScrollbar)
- result.setScrollbar(frameScrollbar);
- }
- }
-
- return RenderPart::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action);
}
-
-}
Modified: trunk/Source/WebCore/rendering/RenderFrameBase.h (145097 => 145098)
--- trunk/Source/WebCore/rendering/RenderFrameBase.h 2013-03-07 18:25:10 UTC (rev 145097)
+++ trunk/Source/WebCore/rendering/RenderFrameBase.h 2013-03-07 18:35:02 UTC (rev 145098)
@@ -36,7 +36,6 @@
explicit RenderFrameBase(Element*);
public:
- virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
void layoutWithFlattening(bool fixedWidth, bool fixedHeight);
};
Modified: trunk/Source/WebCore/rendering/RenderPart.cpp (145097 => 145098)
--- trunk/Source/WebCore/rendering/RenderPart.cpp 2013-03-07 18:25:10 UTC (rev 145097)
+++ trunk/Source/WebCore/rendering/RenderPart.cpp 2013-03-07 18:35:02 UTC (rev 145098)
@@ -28,7 +28,9 @@
#include "Frame.h"
#include "FrameView.h"
#include "HTMLFrameElementBase.h"
+#include "HitTestResult.h"
#include "PluginViewBase.h"
+#include "RenderLayer.h"
#include "RenderSVGRoot.h"
#include "RenderView.h"
@@ -108,4 +110,42 @@
return static_cast<FrameView*>(widget())->embeddedContentBox();
}
+bool RenderPart::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
+{
+ if (!widget() || !widget()->isFrameView() || !request.allowsChildFrameContent())
+ return RenderWidget::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action);
+
+ FrameView* childFrameView = static_cast<FrameView*>(widget());
+ RenderView* childRoot = childFrameView->renderView();
+
+ if (childRoot) {
+ LayoutPoint adjustedLocation = accumulatedOffset + location();
+ LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - childFrameView->scrollOffset();
+ HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset);
+ HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildFrameHitTest);
+ HitTestResult childFrameResult(newHitTestLocation);
+
+ bool isInsideChildFrame = childRoot->hitTest(newHitTestRequest, newHitTestLocation, childFrameResult);
+
+ if (newHitTestLocation.isRectBasedTest())
+ result.append(childFrameResult);
+ else if (isInsideChildFrame)
+ result = childFrameResult;
+
+ if (isInsideChildFrame)
+ return true;
+
+ if (request.allowsFrameScrollbars()) {
+ // ScrollView scrollbars are not the same as RenderLayer scrollbars tested by RenderLayer::hitTestOverflowControls,
+ // so we need to test ScrollView scrollbars separately here.
+ // FIXME: Consider if this test could be done unconditionally.
+ Scrollbar* frameScrollbar = childFrameView->scrollbarAtPoint(newHitTestLocation.roundedPoint());
+ if (frameScrollbar)
+ result.setScrollbar(frameScrollbar);
+ }
+ }
+
+ return RenderWidget::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action);
}
+
+}
Modified: trunk/Source/WebCore/rendering/RenderPart.h (145097 => 145098)
--- trunk/Source/WebCore/rendering/RenderPart.h 2013-03-07 18:25:10 UTC (rev 145097)
+++ trunk/Source/WebCore/rendering/RenderPart.h 2013-03-07 18:35:02 UTC (rev 145098)
@@ -43,6 +43,8 @@
virtual bool needsPreferredWidthsRecalculation() const;
virtual RenderBox* embeddedContentBox() const;
+ virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
+
protected:
#if USE(ACCELERATED_COMPOSITING)
virtual bool requiresLayer() const;