Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: Source/core/html/shadow/SliderThumbElement.cpp

Issue 1156993013: New media playback UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: minor decrufting. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/shadow/SliderThumbElement.cpp
diff --git a/Source/core/html/shadow/SliderThumbElement.cpp b/Source/core/html/shadow/SliderThumbElement.cpp
index 39043fdfaee819c22262c81b6e86d99c67c3ac6c..d5071c2917bd75bc3acf827c3caf371f5e8038b1 100644
--- a/Source/core/html/shadow/SliderThumbElement.cpp
+++ b/Source/core/html/shadow/SliderThumbElement.cpp
@@ -62,6 +62,7 @@ inline static bool hasVerticalAppearance(HTMLInputElement* input)
inline SliderThumbElement::SliderThumbElement(Document& document)
: HTMLDivElement(document)
, m_inDragMode(false)
+ , m_didDragAnywhere(false)
{
}
@@ -169,6 +170,10 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point)
input->setValueFromRenderer(valueString);
if (layoutObject())
layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::SliderValueChanged);
+
+ // We actually changed the value as part of a drag.
+ if (m_inDragMode)
+ m_didDragAnywhere = true;
}
void SliderThumbElement::startDragging()
@@ -176,6 +181,7 @@ void SliderThumbElement::startDragging()
if (LocalFrame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(this);
m_inDragMode = true;
+ m_didDragAnywhere = false;
}
}
@@ -217,10 +223,19 @@ void SliderThumbElement::defaultEventHandler(Event* event)
// MediaControlTimelineElement::defaultEventHandler() wants to handle these
// mouse events.
if (eventType == EventTypeNames::mousedown && isLeftButton) {
+
+ m_mouseDownLocation = mouseEvent->absoluteLocation();
startDragging();
return;
} else if (eventType == EventTypeNames::mouseup && isLeftButton) {
+ if (m_inDragMode && !m_didDragAnywhere && isMediaSlider()) {
+ // We got a down / up with no drag in between, and we're a media
philipj_slow 2015/07/21 12:02:21 I don't think this is quite right. When you click
liberato (no reviews please) 2015/07/27 20:26:09 i agree in principle, but i don't have enough expe
philipj_slow 2015/07/28 15:23:49 It definitely is possible that the change will res
liberato (no reviews please) 2015/07/30 05:54:23 i've reverted all of this, since we're now shippin
+ // slider. Jump to the touch down.
+ setPositionFromPoint(m_mouseDownLocation);
+ }
+
stopDragging();
+
return;
} else if (eventType == EventTypeNames::mousemove) {
if (m_inDragMode)
@@ -277,11 +292,11 @@ static const AtomicString& mediaSliderThumbShadowPartId()
return mediaSliderThumb;
}
-const AtomicString& SliderThumbElement::shadowPseudoId() const
+bool SliderThumbElement::isMediaSlider() const
{
HTMLInputElement* input = hostInput();
if (!input || !input->layoutObject())
- return sliderThumbShadowPartId();
+ return false;
const ComputedStyle& sliderStyle = input->layoutObject()->styleRef();
switch (sliderStyle.appearance()) {
@@ -291,12 +306,19 @@ const AtomicString& SliderThumbElement::shadowPseudoId() const
case MediaVolumeSliderThumbPart:
case MediaFullScreenVolumeSliderPart:
case MediaFullScreenVolumeSliderThumbPart:
- return mediaSliderThumbShadowPartId();
+ return true;
default:
- return sliderThumbShadowPartId();
+ return false;
}
}
+const AtomicString& SliderThumbElement::shadowPseudoId() const
+{
+ if (isMediaSlider())
+ return mediaSliderThumbShadowPartId();
+ return sliderThumbShadowPartId();
+}
+
// --------------------------------
inline SliderContainerElement::SliderContainerElement(Document& document)

Powered by Google App Engine
This is Rietveld 408576698