Title: [127553] trunk
- Revision
- 127553
- Author
- [email protected]
- Date
- 2012-09-04 21:53:35 -0700 (Tue, 04 Sep 2012)
Log Message
REGRESSION(r126132): MediaSlider and MediaVolumeSlider thumbs don't match mouse when dragged
https://bugs.webkit.org/show_bug.cgi?id=95701
Reviewed by Kent Tamura.
Source/WebCore:
MediaSlider and MediaVolumeSlider thumbs didn't match mouse when dragged because of the negative margin applied to the thumb.
Test: platform/chromium/media/media-volume-slider-hit-test.html
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::setPositionFromPoint): Account for margins when calculating the position.
LayoutTests:
* platform/chromium/media/media-volume-slider-hit-test-expected.txt: Added.
* platform/chromium/media/media-volume-slider-hit-test.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (127552 => 127553)
--- trunk/LayoutTests/ChangeLog 2012-09-05 04:40:29 UTC (rev 127552)
+++ trunk/LayoutTests/ChangeLog 2012-09-05 04:53:35 UTC (rev 127553)
@@ -1,3 +1,13 @@
+2012-09-04 Keishi Hattori <[email protected]>
+
+ REGRESSION(r126132): MediaSlider and MediaVolumeSlider thumbs don't match mouse when dragged
+ https://bugs.webkit.org/show_bug.cgi?id=95701
+
+ Reviewed by Kent Tamura.
+
+ * platform/chromium/media/media-volume-slider-hit-test-expected.txt: Added.
+ * platform/chromium/media/media-volume-slider-hit-test.html: Added.
+
2012-09-04 Kent Tamura <[email protected]>
[Chromium] Update test expectation
Added: trunk/LayoutTests/platform/chromium/media/media-volume-slider-hit-test-expected.txt (0 => 127553)
--- trunk/LayoutTests/platform/chromium/media/media-volume-slider-hit-test-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/media/media-volume-slider-hit-test-expected.txt 2012-09-05 04:53:35 UTC (rev 127553)
@@ -0,0 +1,7 @@
+Clicking middle of volume slider should set the value to middle.
+
+PASS volumeSlider.value is "5"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/chromium/media/media-volume-slider-hit-test.html (0 => 127553)
--- trunk/LayoutTests/platform/chromium/media/media-volume-slider-hit-test.html (rev 0)
+++ trunk/LayoutTests/platform/chromium/media/media-volume-slider-hit-test.html 2012-09-05 04:53:35 UTC (rev 127553)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description">Clicking middle of volume slider should set the value to middle.</p>
+<div id="console"></div>
+<audio controls id="audio"></audio>
+<script>
+function clickSliderMiddle(input, offsetLeft) {
+ var centerX = input.offsetLeft + input.offsetWidth / 2;
+ var centerY = input.offsetTop + input.offsetHeight / 2;
+ if (!window.eventSender)
+ return;
+ eventSender.mouseMoveTo(centerX, centerY);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+
+function getElementByShadowPseudoIdInShadowRoot(shadowRoot, pseudoId) {
+ var node = shadowRoot.firstChild;
+ while (node) {
+ if (internals.shadowPseudoId(node) === pseudoId)
+ return node;
+ node = node.nextSibling || node.firstChild;
+ }
+ return null;
+}
+
+var mediaElement = document.getElementById("audio");
+var root = internals.shadowRoot(mediaElement);
+var volumeSlider = getElementByShadowPseudoIdInShadowRoot(root, "-webkit-media-controls-volume-slider");
+volumeSlider.min = 0;
+volumeSlider.max = 10;
+volumeSlider.step = 1;
+clickSliderMiddle(volumeSlider);
+shouldBe('volumeSlider.value', '"5"');
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (127552 => 127553)
--- trunk/Source/WebCore/ChangeLog 2012-09-05 04:40:29 UTC (rev 127552)
+++ trunk/Source/WebCore/ChangeLog 2012-09-05 04:53:35 UTC (rev 127553)
@@ -1,3 +1,17 @@
+2012-09-04 Keishi Hattori <[email protected]>
+
+ REGRESSION(r126132): MediaSlider and MediaVolumeSlider thumbs don't match mouse when dragged
+ https://bugs.webkit.org/show_bug.cgi?id=95701
+
+ Reviewed by Kent Tamura.
+
+ MediaSlider and MediaVolumeSlider thumbs didn't match mouse when dragged because of the negative margin applied to the thumb.
+
+ Test: platform/chromium/media/media-volume-slider-hit-test.html
+
+ * html/shadow/SliderThumbElement.cpp:
+ (WebCore::SliderThumbElement::setPositionFromPoint): Account for margins when calculating the position.
+
2012-09-04 Tony Chang <[email protected]>
Add a const version of RenderBox::computeLogicalHeight
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (127552 => 127553)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2012-09-05 04:40:29 UTC (rev 127552)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2012-09-05 04:53:35 UTC (rev 127553)
@@ -272,13 +272,15 @@
IntRect inputBoundingBox = input->renderer()->absoluteBoundingBoxRectIgnoringTransforms();
if (isVertical) {
trackSize = trackElement->renderBox()->contentHeight();
- position = offset.y() - renderBox()->height() / 2 - trackBoundingBox.y() + inputBoundingBox.y();
+ position = offset.y() - renderBox()->height() / 2 - trackBoundingBox.y() + inputBoundingBox.y() - renderBox()->marginBottom();
currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin.y();
} else {
trackSize = trackElement->renderBox()->contentWidth();
position = offset.x() - renderBox()->width() / 2 - trackBoundingBox.x() + inputBoundingBox.x();
- if (!isLeftToRightDirection)
- position += renderBox()->width();
+ if (isLeftToRightDirection)
+ position -= renderBox()->marginLeft();
+ else
+ position += renderBox()->width() - renderBox()->marginRight();
currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x();
}
position = max<LayoutUnit>(0, min(position, trackSize));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes