Diff
Modified: trunk/LayoutTests/ChangeLog (191112 => 191113)
--- trunk/LayoutTests/ChangeLog 2015-10-15 15:12:39 UTC (rev 191112)
+++ trunk/LayoutTests/ChangeLog 2015-10-15 16:08:24 UTC (rev 191113)
@@ -1,3 +1,31 @@
+2015-10-15 Daniel Bates <daba...@apple.com>
+
+ [iOS] DOM click event may not be dispatched when page has :active style and <input type="search">
+ https://bugs.webkit.org/show_bug.cgi?id=144451
+ <rdar://problem/23099482>
+
+ Reviewed by Simon Fraser.
+
+ Add a test to ensure that a DOM click event is dispatched to an element in a subframe on a page
+ with a search field and that specifies a CSS :active pseudo-class that changes the tap highlight
+ color.
+
+ Additionally, add tests to ensure we update the cancel button visibility whenever the visibility
+ of the search field changes.
+
+ * fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field-expected.txt: Added.
+ * fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field.html: Added.
+ * fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled-expected.html: Added.
+ * fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled.html: Added.
+ * fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly-expected.html: Added.
+ * fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly.html: Added.
+ * fast/forms/search/search-cancel-in-formerly-invisible-element-expected.html: Added.
+ * fast/forms/search/search-cancel-in-formerly-invisible-element.html: Added.
+ * fast/forms/search/search-cancel-toggle-visibility-initially-hidden-expected.html: Added.
+ * fast/forms/search/search-cancel-toggle-visibility-initially-hidden.html: Added.
+ * fast/forms/search/search-cancel-toggle-visibility-initially-visible-expected.html: Added.
+ * fast/forms/search/search-cancel-toggle-visibility-initially-visible.html: Added.
+
2015-10-15 Carlos Garcia Campos <cgar...@igalia.com>
Unreviewed GTK+ gardening. Unskip several tests that are passing now.
Added: trunk/LayoutTests/fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field-expected.txt (0 => 191113)
--- trunk/LayoutTests/fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field-expected.txt 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,9 @@
+Test that an element, with an onclick handler and an empty ontouchstart attribute, in an <iframe> on a page with a search field and specifies an :active pseudo-class for <body> receives a DOM click event when tapped. To run this test by hand, click the blue square below.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS clicked blue square
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field.html (0 => 191113)
--- trunk/LayoutTests/fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field.html (rev 0)
+++ trunk/LayoutTests/fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+body:active {
+ /* Must be non-empty. */
+ -webkit-tap-highlight-color: yellow;
+}
+</style>
+<script>
+window.jsTestIsAsync = true;
+
+function notifyPass()
+{
+ testPassed("clicked blue square");
+
+ var testContainer = document.getElementById("test-container");
+ testContainer.parentNode.removeChild(testContainer);
+ finishJSTest();
+}
+
+function runTest()
+{
+ if (!window.testRunner)
+ return;
+ var iframe = document.getElementById("iframe");
+ var square = iframe.contentDocument.getElementById("square");
+ var x = iframe.offsetLeft + square.offsetLeft + Math.floor(square.offsetWidth / 2);
+ var y = iframe.offsetTop + square.offsetTop + Math.floor(square.offsetHeight / 2);
+ if (testRunner.runUIScript && window.TouchEvent)
+ testRunner.runUIScript("(function() { uiController.singleTapAtPoint(" + x + ", " + y + "); })()");
+ else if (window.eventSender) {
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+}
+</script>
+</head>
+<body>
+<div id="description"></div>
+<div id="test-container">
+ <p><input type="search" placeholder="Do not click me"></p>
+ <iframe id="iframe" width="128" height="128" _onload_="runTest()" srcdoc='
+ <style>
+ body {
+ margin: 0;
+ padding 0;
+ }
+ #square {
+ -webkit-box-align: center;
+ -webkit-box-pack: center;
+ -webkit-user-select: none;
+ background-color: blue;
+ color: white;
+ cursor: pointer;
+ display: -webkit-box;
+ height: 128px;
+ width: 128px;
+ }
+ </style>
+ <div id="square" _ontouchstart_="" _onclick_="window.parent.notifyPass()">Click me</div><!-- Intentionally empty attribute ontouchstart. -->
+ '></iframe>
+</div>
+<div id="console"></div>
+<script>
+description("Test that an element, with an onclick handler and an empty ontouchstart attribute, in an <iframe> on a page with a search field and specifies an <code>:active</code> pseudo-class for <body> receives a DOM click event when tapped. To run this test by hand, click the blue square below.");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled-expected.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled-expected.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that the search cancel button renders when the field becomes disabled (no change).</p>
+<input type="search" value="search" disabled>
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that the search cancel button renders when the field becomes disabled (no change).</p>
+<input type="search" id="search" value="search">
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+var search = document.getElementById("search");
+
+function makeFieldDisabledAndNotifyDone()
+{
+ search.disabled = true;
+ if (window.internals)
+ internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+window.setTimeout(makeFieldDisabledAndNotifyDone, 0);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly-expected.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly-expected.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that the search cancel button renders when the field becomes read only (no change).</p>
+<input type="search" value="search" readonly>
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that the search cancel button renders when the field becomes read only (no change).</p>
+<input type="search" id="search" value="search">
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+var search = document.getElementById("search");
+
+function makeFieldReadOnlyAndNotifyDone()
+{
+ search.readOnly = true;
+ if (window.internals)
+ internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+window.setTimeout(makeFieldReadOnlyAndNotifyDone, 0);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-in-formerly-invisible-element-expected.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-in-formerly-invisible-element-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-in-formerly-invisible-element-expected.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<input type="search" value="search">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-in-formerly-invisible-element.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-in-formerly-invisible-element.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-in-formerly-invisible-element.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+<input type="search" id="search" value="search" style="visibility: hidden">
+<script>
+document.getElementById("search").style.visibility = "visible";
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-hidden-expected.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-hidden-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-hidden-expected.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.width-200px {
+ width: 200px;
+}
+</style>
+<body>
+<p>Tests that the search cancel button is not shown after changing the visibility of <input type="search"> from hidden to visible to hidden. This test passed if you do not see the search cancel button in the blue outlined box (below).</p>
+<div class="width-200px" style="border: 1px solid blue">
+ <input type="search" value="search" class="width-200px" style="visibility: hidden">
+</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-hidden.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-hidden.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-hidden.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.width-200px {
+ width: 200px;
+}
+</style>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+</script>
+</head>
+<body>
+<p>Tests that the search cancel button is not shown after changing the visibility of <input type="search"> from hidden to visible to hidden. This test passed if you do not see the search cancel button in the blue outlined box (below).</p>
+<div class="width-200px" style="border: 1px solid blue">
+ <input type="search" id="search" value="search" class="width-200px" style="visibility: hidden">
+</div>
+<script>
+var search = document.getElementById("search");
+search.style.visibility = "visible";
+function done() {
+ search.style.visibility = "hidden";
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+window.setTimeout(done, 0);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-visible-expected.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-visible-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-visible-expected.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.width-200px {
+ width: 200px;
+}
+</style>
+<body>
+<p>Tests that the search cancel button is not shown after changing the visibility of <input type="search"> from visible to hidden to visible. This test passed if you see the search cancel button in the blue outlined box (below).</p>
+<div class="width-200px" style="border: 1px solid blue">
+ <input type="search" value="search" class="width-200px">
+</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-visible.html (0 => 191113)
--- trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-visible.html (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-cancel-toggle-visibility-initially-visible.html 2015-10-15 16:08:24 UTC (rev 191113)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.width-200px {
+ width: 200px;
+}
+</style>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+</script>
+</head>
+<body>
+<p>Tests that the search cancel button is not shown after changing the visibility of <input type="search"> from visible to hidden to visible. This test passed if you see the search cancel button in the blue outlined box (below).</p>
+<div class="width-200px" style="border: 1px solid blue">
+ <input type="search" id="search" value="search" class="width-200px">
+</div>
+<script>
+var search = document.getElementById("search");
+search.style.visibility = "hidden";
+function done() {
+ search.style.visibility = "visible";
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+window.setTimeout(done, 0);
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (191112 => 191113)
--- trunk/Source/WebCore/ChangeLog 2015-10-15 15:12:39 UTC (rev 191112)
+++ trunk/Source/WebCore/ChangeLog 2015-10-15 16:08:24 UTC (rev 191113)
@@ -1,3 +1,40 @@
+2015-10-15 Daniel Bates <daba...@apple.com>
+
+ [iOS] DOM click event may not be dispatched when page has :active style and <input type="search">
+ https://bugs.webkit.org/show_bug.cgi?id=144451
+ <rdar://problem/23099482>
+
+ Reviewed by Simon Fraser.
+
+ Fixes an issue where a DOM click event is not dispatched to an element in a subframe on a page
+ that has a <input type="search"> and defines a CSS :active pseudo-class for the HTML body element.
+
+ On iOS we only dispatch a DOM click event if the content does not change as part
+ of dispatching a DOM mousemove event at the tapped element. In particular, we do not
+ dispatch a DOM click event if there is a visibility change to some element on the page
+ as part of dispatching a mousemove event at the tapped element. For a web page
+ that specifies CSS :active pseudo-class and contains a search field, applying/unapplying
+ this pseudo-class as part of dispatching a DOM mousemove event may cause the
+ visibility of the search field cancel button to change; => a DOM click event will not
+ be dispatched to the tapped element.
+
+ Tests: fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field.html
+ fast/forms/search/search-cancel-button-visible-when-input-becomes-disabled.html
+ fast/forms/search/search-cancel-button-visible-when-input-becomes-readonly.html
+ fast/forms/search/search-cancel-in-formerly-invisible-element.html
+ fast/forms/search/search-cancel-toggle-visibility-initially-hidden.html
+ fast/forms/search/search-cancel-toggle-visibility-initially-visible.html
+
+ * rendering/RenderSearchField.cpp:
+ (WebCore::RenderSearchField::updateCancelButtonVisibility): Write logic for determining
+ whether the visibility of the cancel button changed in terms of m_isCancelButtonVisible
+ instead of querying for the current style data as the latter is overwritten on a full
+ style recalculation.
+ (WebCore::RenderSearchField::RenderSearchField): Deleted.
+ (WebCore::RenderSearchField::visibilityForCancelButton): Deleted.
+ * rendering/RenderSearchField.h: Define instance variable m_isCancelButtonVisible to
+ store the visibility state of the cancel button.
+
2015-10-15 Antti Koivisto <an...@apple.com>
Implement iterator for traversing composed ancestors
Modified: trunk/Source/WebCore/rendering/RenderSearchField.cpp (191112 => 191113)
--- trunk/Source/WebCore/rendering/RenderSearchField.cpp 2015-10-15 15:12:39 UTC (rev 191112)
+++ trunk/Source/WebCore/rendering/RenderSearchField.cpp 2015-10-15 16:08:24 UTC (rev 191113)
@@ -52,8 +52,6 @@
RenderSearchField::RenderSearchField(HTMLInputElement& element, Ref<RenderStyle>&& style)
: RenderTextControlSingleLine(element, WTF::move(style))
- , m_searchPopupIsVisible(false)
- , m_searchPopup(0)
{
ASSERT(element.isSearchField());
}
@@ -167,27 +165,22 @@
m_searchPopup->popupMenu()->updateFromElement();
}
-void RenderSearchField::updateCancelButtonVisibility() const
+void RenderSearchField::updateCancelButtonVisibility()
{
RenderElement* cancelButtonRenderer = cancelButtonElement()->renderer();
if (!cancelButtonRenderer)
return;
- const RenderStyle& curStyle = cancelButtonRenderer->style();
- EVisibility buttonVisibility = visibilityForCancelButton();
- if (curStyle.visibility() == buttonVisibility)
+ bool wasCancelButtonVisible = m_isCancelButtonVisible;
+ m_isCancelButtonVisible = style().visibility() == VISIBLE && !inputElement().value().isEmpty();
+ if (wasCancelButtonVisible == m_isCancelButtonVisible)
return;
- auto cancelButtonStyle = RenderStyle::clone(&curStyle);
- cancelButtonStyle.get().setVisibility(buttonVisibility);
+ auto cancelButtonStyle = RenderStyle::clone(&cancelButtonRenderer->style());
+ cancelButtonStyle.get().setVisibility(m_isCancelButtonVisible ? VISIBLE : HIDDEN);
cancelButtonRenderer->setStyle(WTF::move(cancelButtonStyle));
}
-EVisibility RenderSearchField::visibilityForCancelButton() const
-{
- return (style().visibility() == HIDDEN || inputElement().value().isEmpty()) ? HIDDEN : VISIBLE;
-}
-
const AtomicString& RenderSearchField::autosaveName() const
{
return inputElement().fastGetAttribute(autosaveAttr);
Modified: trunk/Source/WebCore/rendering/RenderSearchField.h (191112 => 191113)
--- trunk/Source/WebCore/rendering/RenderSearchField.h 2015-10-15 15:12:39 UTC (rev 191112)
+++ trunk/Source/WebCore/rendering/RenderSearchField.h 2015-10-15 16:08:24 UTC (rev 191113)
@@ -36,7 +36,7 @@
RenderSearchField(HTMLInputElement&, Ref<RenderStyle>&&);
virtual ~RenderSearchField();
- void updateCancelButtonVisibility() const;
+ void updateCancelButtonVisibility();
void addSearchResult();
void stopSearchEventTimer();
@@ -50,7 +50,6 @@
virtual LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const override;
virtual LayoutUnit computeLogicalHeightLimit() const override;
virtual void updateFromElement() override;
- EVisibility visibilityForCancelButton() const;
const AtomicString& autosaveName() const;
// PopupMenuClient methods
@@ -85,7 +84,8 @@
HTMLElement* resultsButtonElement() const;
HTMLElement* cancelButtonElement() const;
- bool m_searchPopupIsVisible;
+ bool m_searchPopupIsVisible { false };
+ bool m_isCancelButtonVisible { false };
RefPtr<SearchPopupMenu> m_searchPopup;
Vector<RecentSearch> m_recentSearches;
};