Commit 349d8e84 authored by keishi@webkit.org's avatar keishi@webkit.org

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 98ae2179
2012-09-04 Keishi Hattori <keishi@webkit.org>
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 <tkent@chromium.org>
[Chromium] Update test expectation
Clicking middle of volume slider should set the value to middle.
PASS volumeSlider.value is "5"
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<script src=media-file.js></script>
<script src="../../../fast/js/resources/js-test-pre.js"></script>
</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="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
2012-09-04 Keishi Hattori <keishi@webkit.org>
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 <tony@chromium.org>
Add a const version of RenderBox::computeLogicalHeight
......@@ -272,13 +272,15 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point)
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));
......
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