From c19c0bf05fae49b0ca08ae592c967e230b9cd74a Mon Sep 17 00:00:00 2001 From: "tdanderson@chromium.org" Date: Tue, 14 Jan 2014 18:31:46 +0000 Subject: Revert of Make ancestors of modal inert (https://codereview.chromium.org/133393002/) Reason for revert: This patch is the most probable cause of the failing content_browsertests: AccessibilityModalDialogInIframeOpened AccessibilityModalDialogOpened AccessibilityModalDialogStack See: http://build.chromium.org/p/chromium.webkit/builders/Win7%20Tests/builds/529 http://build.chromium.org/p/chromium.webkit/builders/Win7%20%28dbg%29/builds/13227 http://build.chromium.org/p/chromium.webkit/builders/Mac10.6%20Tests/builds/22361 http://build.chromium.org/p/chromium.webkit/builders/Mac10.8%20Tests/builds/5388 I could not reach the patch author on IRC due to the time zone difference. Original issue's description: > Make ancestors of modal inert > > As per spec change: http://html5.org/r/8343 > > Now, document.body is also inert. Previously events that > "skipped" an inert node were fired on document.body; now, > they are fired on document. > > Test: modal-dialog-ancestor-is-inert.html > Also, other tests cover some of this behavior and have > expectations updated. > > BUG=329407 > > Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165040 TBR=esprehn@chromium.org,falken@chromium.org NOTREECHECKS=true NOTRY=true BUG=329407 Review URL: https://codereview.chromium.org/138183003 git-svn-id: svn://svn.chromium.org/blink/trunk@165086 bbb929c8-8fbe-4397-9dbb-9b2b20218538 --- .../inert-node-is-not-highlighted-expected.html | 3 +- .../fast/dom/HTMLDialogElement/inert-inlines.html | 6 +- .../inert-node-is-unfocusable-expected.txt | 4 +- .../inert-node-is-unfocusable.html | 6 +- .../modal-dialog-ancestor-is-inert-expected.txt | 19 ---- .../modal-dialog-ancestor-is-inert.html | 111 --------------------- .../modal-dialog-blocks-mouse-events-expected.txt | 8 +- .../modal-dialog-blocks-mouse-events.html | 44 ++++---- third_party/WebKit/Source/core/dom/Node.cpp | 2 +- 9 files changed, 40 insertions(+), 163 deletions(-) delete mode 100644 third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-ancestor-is-inert-expected.txt delete mode 100644 third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-ancestor-is-inert.html diff --git a/third_party/WebKit/LayoutTests/dialog/inert-node-is-not-highlighted-expected.html b/third_party/WebKit/LayoutTests/dialog/inert-node-is-not-highlighted-expected.html index 3aaeb5f..64796e7 100644 --- a/third_party/WebKit/LayoutTests/dialog/inert-node-is-not-highlighted-expected.html +++ b/third_party/WebKit/LayoutTests/dialog/inert-node-is-not-highlighted-expected.html @@ -24,8 +24,7 @@ none (crbug.com/147490).

diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html index 8d95ae6..2b9c920 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html @@ -53,8 +53,8 @@ inertElements.forEach(function(id) { element.addEventListener('mousemove', eventFiredOnInertElement); }); -document.addEventListener('click', function(e) { - document.firedOn = true; +document.body.addEventListener('click', function(e) { + document.body.firedOn = true; }); document.getElementById('dialog-parent').addEventListener('click', function(e) { @@ -63,7 +63,7 @@ document.getElementById('dialog-parent').addEventListener('click', function(e) { document.querySelector('dialog').showModal(); inertElements.forEach(function(id) { - expectedTarget = document; + expectedTarget = document.body; if (id == 'dialog-sibling') expectedTarget = document.getElementById('dialog-parent') element = document.getElementById(id); diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable-expected.txt index 0151288..71d1f6e 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable-expected.txt @@ -1,9 +1,9 @@ -Test that inert nodes are not focusable. The test passses if only the topmost dialog and its button are focusable. +Test that inert nodes are not focusable. The test passses if only the document body and the topmost dialog and its button are focusable. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS "body"; focusedElement === theElement is false +PASS "body"; focusedElement === theElement is true PASS "top-dialog"; focusedElement === theElement is true PASS "top-dialog-button"; focusedElement === theElement is true PASS "bottom-dialog"; focusedElement === theElement is false diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable.html index 631e6d4..66da1580 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable.html +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable.html @@ -21,8 +21,8 @@ Link - - -
- -
- - - diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-blocks-mouse-events-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-blocks-mouse-events-expected.txt index 23785d3..6268bb2 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-blocks-mouse-events-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-blocks-mouse-events-expected.txt @@ -4,11 +4,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE Clicking on inert box -PASS inertDivHandledEvent is false -PASS Object.keys(handledEvents.document).length is expectedEventCountForDocument +PASS inertDiv.firedOn is false +PASS Object.keys(body.firedOnEvents).length is events.length Clicking on non-inert box -PASS inertDivHandledEvent is false -PASS Object.keys(handledEvents.dialogDiv).length is events.length +PASS inertDiv.firedOn is false +PASS Object.keys(dialogDiv.firedOnEvents).length is events.length PASS successfullyParsed is true TEST COMPLETE diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-blocks-mouse-events.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-blocks-mouse-events.html index a725e10..2d1ec44 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-blocks-mouse-events.html +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/modal-dialog-blocks-mouse-events.html @@ -40,8 +40,17 @@ function clickOn(element) { if (!window.eventSender) return; - var rect = element.getBoundingClientRect(); - eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2); + + var absoluteTop = 0; + var absoluteLeft = 0; + for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) { + absoluteLeft += parentNode.offsetLeft; + absoluteTop += parentNode.offsetTop; + } + + var x = absoluteLeft + element.offsetWidth / 2; + var y = absoluteTop + element.offsetHeight / 2; + eventSender.mouseMoveTo(x, y); eventSender.mouseDown(); eventSender.mouseUp(); eventSender.mouseMoveTo(0, 0); @@ -52,46 +61,45 @@ if (window.testRunner) dialog.showModal(); -inertDivHandledEvent = false; inertDiv = document.getElementById('inert-div'); +inertDiv.firedOn = false; eventFiredOnInertNode = function(event) { - inertDivHandledEvent = true; + inertDiv.firedOn = true; inertDiv.style.backgroundColor = 'red'; }; events = ['mousedown', 'mouseup', 'click', 'mousemove', 'mouseover', 'mouseout']; dialogDiv = document.getElementById('dialog-div'); -handledEvents = {}; -handledEvents.dialogDiv = {}; +dialogDiv.firedOnEvents = {}; eventFiredOnDialog = function(event) { - handledEvents.dialogDiv[event.type] = true; - if (Object.keys(handledEvents.dialogDiv).length == events.length) + dialogDiv.firedOnEvents[event.type] = true; + if (Object.keys(dialogDiv.firedOnEvents).length == events.length) dialogDiv.style.backgroundColor = 'green'; }; -handledEvents.document = {}; -expectedEventCountForDocument = events.length - 1; // document won't get 'mouseout' -eventFiredOnDocument = function(event) { - handledEvents.document[event.type] = true; - if (Object.keys(handledEvents.document).length == document.expectedEventCount && !inertDivHandledEvent) +body = document.body; +body.firedOnEvents = {}; +eventFiredOnBody = function(event) { + body.firedOnEvents[event.type] = true; + if (Object.keys(body.firedOnEvents).length == events.length && !inertDiv.firedOn) inertDiv.style.backgroundColor = 'green'; }; for (var i = 0; i < events.length; ++i) { inertDiv.addEventListener(events[i], eventFiredOnInertNode); dialogDiv.addEventListener(events[i], eventFiredOnDialog); - document.addEventListener(events[i], eventFiredOnDocument); + document.body.addEventListener(events[i], eventFiredOnBody); } debug('Clicking on inert box'); clickOn(inertDiv); -shouldBeFalse('inertDivHandledEvent'); -shouldBe('Object.keys(handledEvents.document).length', 'expectedEventCountForDocument'); +shouldBeFalse('inertDiv.firedOn'); +shouldBe('Object.keys(body.firedOnEvents).length', 'events.length'); debug('Clicking on non-inert box'); clickOn(dialogDiv); -shouldBeFalse('inertDivHandledEvent'); -shouldBe('Object.keys(handledEvents.dialogDiv).length', 'events.length'); +shouldBeFalse('inertDiv.firedOn'); +shouldBe('Object.keys(dialogDiv.firedOnEvents).length', 'events.length'); diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index 5e1deff..2c1dc4c 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp @@ -792,7 +792,7 @@ bool Node::shouldHaveFocusAppearance() const bool Node::isInert() const { const HTMLDialogElement* dialog = document().activeModalDialog(); - if (dialog && this != document() && !dialog->containsIncludingShadowDOM(this)) + if (dialog && !containsIncludingShadowDOM(dialog) && !dialog->containsIncludingShadowDOM(this)) return true; return document().ownerElement() && document().ownerElement()->isInert(); } -- cgit v1.1