Commit 997cf6a0 authored by dglazkov@chromium.org's avatar dglazkov@chromium.org

2011-02-08 Dimitri Glazkov <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        REGRESSION(r71934): Shadow DOM nodes leak via relatedTarget
        https://bugs.webkit.org/show_bug.cgi?id=52065

        * fast/events/shadow-boundary-crossing.html: Added relatedTarget retargeting test.
2011-02-08  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        REGRESSION(r71934): Shadow DOM nodes leak via relatedTarget
        https://bugs.webkit.org/show_bug.cgi?id=52065

        * dom/Node.cpp:
        (WebCore::pullOutOfShadow): Added a helper to move a node to the outermost
            boundary of shadow DOM.
        (WebCore::Node::dispatchMouseEvent): Changed to use pullOutOfShadow.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3874b0ec
2011-02-08 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Darin Adler.
REGRESSION(r71934): Shadow DOM nodes leak via relatedTarget
https://bugs.webkit.org/show_bug.cgi?id=52065
* fast/events/shadow-boundary-crossing.html: Added relatedTarget retargeting test.
2011-02-09 Martin Robinson <mrobinson@igalia.com>
Add more results for many tests in the fast directory missing results.
......@@ -6,6 +6,7 @@ Mutation events should not propagate out of the shadow DOM: PASS
The selectstart event should not propagate out of the shadow DOM: PASS
Label should look beyond shadow boundary to detect if it encloses its associated element: PASS
Events for default event handler should not be retargeted: PASS
Event's relatedTarget should be retargeted: PASS
Other events should be retargeted: PASS
After event dispatch, the event object should not reveal shadow DOM: PASS
Focusing same shadow DOM element repeatedly should not trigger multiple focus/blur events: PASS
......@@ -9,7 +9,7 @@ function log(msg, success)
logDiv.appendChild(document.createElement('div')).textContent = msg + ': ' + (success ? 'PASS' : 'FAIL');
}
function clickOn(element)
function moveOver(element)
{
if (!window.eventSender)
return;
......@@ -17,6 +17,11 @@ function clickOn(element)
var x = element.offsetLeft + element.offsetWidth / 2;
var y = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
}
function clickOn(element)
{
moveOver(element);
eventSender.mouseDown();
eventSender.mouseUp();
}
......@@ -100,6 +105,22 @@ var tests = {
document.body.removeEventListener('DOMActivate', counter, false);
fileInput.parentNode.removeChild(fileInput);
},
relatedTargetRetargeting: function()
{
var count = 0;
var textInput = document.body.appendChild(document.createElement('input'));
var counter = function(evt)
{
if (evt.relatedTarget && !evt.relatedTarget.parentNode)
count++;
}
moveOver(textInput);
document.body.addEventListener("mouseover", counter, false);
moveOver(document.body);
document.body.removeEventListener("mouseover", counter, false);
log("Event's relatedTarget should be retargeted", count == 0);
textInput.parentNode.removeChild(textInput);
},
eventInProgress: function()
{
var textInput = document.body.appendChild(document.createElement('input'));
......
2011-02-08 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Darin Adler.
REGRESSION(r71934): Shadow DOM nodes leak via relatedTarget
https://bugs.webkit.org/show_bug.cgi?id=52065
* dom/Node.cpp:
(WebCore::pullOutOfShadow): Added a helper to move a node to the outermost
boundary of shadow DOM.
(WebCore::Node::dispatchMouseEvent): Changed to use pullOutOfShadow.
2011-02-09 Yael Aharon <yael.aharon@nokia.com>
Reviewed by Darin Adler.
......@@ -2839,6 +2839,18 @@ void Node::dispatchSimulatedClick(PassRefPtr<Event> event, bool sendMouseEvents,
gNodesDispatchingSimulatedClicks->remove(this);
}
// FIXME: Once https://bugs.webkit.org/show_bug.cgi?id=52963 lands, this should
// be greatly improved. See https://bugs.webkit.org/show_bug.cgi?id=54025.
static Node* pullOutOfShadow(Node* node)
{
Node* outermostShadowBoundary = node;
for (Node* n = node; n; n = n->parentOrHostNode()) {
if (n->isShadowRoot())
outermostShadowBoundary = n->parentOrHostNode();
}
return outermostShadowBoundary;
}
bool Node::dispatchMouseEvent(const AtomicString& eventType, int button, int detail,
int pageX, int pageY, int screenX, int screenY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
......@@ -2861,7 +2873,7 @@ bool Node::dispatchMouseEvent(const AtomicString& eventType, int button, int det
bool swallowEvent = false;
// Attempting to dispatch with a non-EventTarget relatedTarget causes the relatedTarget to be silently ignored.
RefPtr<Node> relatedTarget = relatedTargetArg;
RefPtr<Node> relatedTarget = pullOutOfShadow(relatedTargetArg);
int adjustedPageX = pageX;
int adjustedPageY = pageY;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment