diff options
author | stavila@adobe.com <stavila@adobe.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-06-12 17:18:01 +0000 |
---|---|---|
committer | stavila@adobe.com <stavila@adobe.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-06-12 17:18:01 +0000 |
commit | e71e32fcb52ad30a637f6734063205ecd687c30b (patch) | |
tree | fedb4c1f4e794e5a417cf0f999d1a6b5f5f15289 /third_party/WebKit/LayoutTests/fast/css/hover-display-block-inline.html | |
parent | 299057b7d049e1b778d010c33afcfe097e80643d (diff) | |
download | chromium_src-e71e32fcb52ad30a637f6734063205ecd687c30b.zip chromium_src-e71e32fcb52ad30a637f6734063205ecd687c30b.tar.gz chromium_src-e71e32fcb52ad30a637f6734063205ecd687c30b.tar.bz2 |
Migrated from WebKit Bugzilla: https://bugs.webkit.org/show_bug.cgi?id=7555
:hover style not applied on hover if its display property is different from original style's
Properly apply the :hover pseudo-class when reattaching is required (e.g. when changing the display type)
A new AttachContext class was created to be passed along as an optional parameter to the attach/detach/reattach methods.
This new parameter is used to:
- prevent the element from being removed from the list of hovered/active elements upon detach when a reattach is in progress
- prevent the style from being incorrectly computed (due to the previous point)
- prevent the style from being computed twice (the attach() method used to recompute it)
Special care was required to the case when display:none is specified in the :hover class. Enabling the :hover style was leaving the element without a renderer, which was causing it to remain stuck in the :hover state (subsequent mouseMove events were not able to reset the element to its normal style due to the fact that it had no renderer).
The DragController::startDrag method was updated to properly handle the case when dragImage is NULL (for instance by setting display:none inside the -webkit-drag pseudo-class).
New tests:
- fast/regions/hover-display-block-inline.html
- fast/regions/hover-display-block-none.html
BUG=247375
Review URL: https://chromiumcodereview.appspot.com/16599003
git-svn-id: svn://svn.chromium.org/blink/trunk@152289 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/css/hover-display-block-inline.html')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/css/hover-display-block-inline.html | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/css/hover-display-block-inline.html b/third_party/WebKit/LayoutTests/fast/css/hover-display-block-inline.html new file mode 100644 index 0000000..8c12f8d --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/css/hover-display-block-inline.html @@ -0,0 +1,78 @@ +<!doctype html> +<html lang="en"> +<head> + <title>Switch between display block and inline on :hover</title> + <style> + .box { + width: 100px; + height: 100px; + } + #dummy { + background-color: black; + } + #hoverTest { + border: 5px solid green; + border-left: 100px solid green; + color: black; + display: block; + } + #hoverTest:hover { + border-color: darkred; + display: inline; + } + #after_hoverTest { + background-color: blue; + color: white; + padding: 10px; + } + </style> + + <script src="../js/resources/js-test-pre.js"></script> +</head> + +<body> + <div id="dummy" class="box"></div> + <div id="hoverTest" class="box">When hovered, this box's display will switch from <b>block</b> to <b>inline</b></div> + <div id="after_hoverTest" class="box">This is here to show the layout being recomputed</div> + + <script type="text/javascript"> + if (window.testRunner) + testRunner.waitUntilDone(); + + function beginTest() { + if (window.eventSender) { + var hoverTest = document.getElementById("hoverTest"); + + // move mouse on the hover test object + eventSender.mouseMoveTo(hoverTest.offsetLeft + 50, hoverTest.offsetTop + 10); + eventSender.mouseDown(0); + + release(); + } + } + + function release() { + if (window.eventSender) { + var hoverTest = document.getElementById("hoverTest"); + var displayMode = window.getComputedStyle(hoverTest).getPropertyValue("display"); + + if (displayMode == "inline") + testPassed("Setting display to inline on hover processed OK."); + else + testFailed("Setting display to inline on hover FAILED." + " (expected 'inline', got '" + displayMode + "')"); + + var elementsToHide = document.getElementsByClassName('box'); + for (var element, i = 0; element = elementsToHide[i]; i++) + element.style.visibility = "hidden"; + + eventSender.mouseUp(0); + + if (window.testRunner) + testRunner.notifyDone(); + } + } + + beginTest(); + </script> +</body> +</html>
\ No newline at end of file |