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

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

Issue 196933006: Do not dispatch 'change' events during pressing spin buttons for input[type=number]. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Replaced detach functionality when input loses focus Created 6 years, 9 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/SpinButtonElement.cpp
diff --git a/Source/core/html/shadow/SpinButtonElement.cpp b/Source/core/html/shadow/SpinButtonElement.cpp
index 22f4255e658a0f763186abbf5bdb8323c2437bd8..b14209b53b6cddb51c26b8ff7c0777e814e0382a 100644
--- a/Source/core/html/shadow/SpinButtonElement.cpp
+++ b/Source/core/html/shadow/SpinButtonElement.cpp
@@ -60,10 +60,11 @@ PassRefPtr<SpinButtonElement> SpinButtonElement::create(Document& document, Spin
return element.release();
}
-void SpinButtonElement::detach(const AttachContext& context)
+void SpinButtonElement::setFocus(bool status)
{
- releaseCapture();
- HTMLDivElement::detach(context);
+ if (!status)
+ releaseCapture();
tkent 2014/04/04 01:31:46 I think this code won't work. SpinButtonElement ne
Habib Virji 2014/04/04 09:24:05 Done.
+ ContainerNode::setFocus(status);
}
void SpinButtonElement::defaultEventHandler(Event* event)
@@ -106,12 +107,14 @@ void SpinButtonElement::defaultEventHandler(Event* event)
// chance to cancel the timer.
startRepeatingTimer();
doStepAction(m_upDownState == Up ? 1 : -1);
+ if (m_spinButtonOwner)
+ m_spinButtonOwner->spinButtonDidReleaseMouseCapture();
}
}
event->setDefaultHandled();
}
} else if (mouseEvent->type() == EventTypeNames::mouseup && mouseEvent->button() == LeftButton) {
- stopRepeatingTimer();
+ releaseCapture();
} else if (event->type() == EventTypeNames::mousemove) {
if (box->pixelSnappedBorderBoxRect().contains(local)) {
if (!m_capturing) {
@@ -130,6 +133,11 @@ void SpinButtonElement::defaultEventHandler(Event* event)
releaseCapture();
m_upDownState = Indeterminate;
}
+ } else if (event->type() == EventTypeNames::mouseout) {
tkent 2014/04/04 01:31:46 Why is this block necessary? Doesn't the above rel
Habib Virji 2014/04/04 09:24:05 Done.
+ if (m_capturing) { // In order to check that spin button is under focus
+ if (m_spinButtonOwner)
+ m_spinButtonOwner->spinButtonDidReleaseMouseCapture();
+ }
}
if (!event->defaultHandled())
@@ -198,6 +206,9 @@ void SpinButtonElement::releaseCapture()
page->chrome().unregisterPopupOpeningObserver(this);
}
}
+ if (m_spinButtonOwner)
+ m_spinButtonOwner->spinButtonDidReleaseMouseCapture();
+
}
bool SpinButtonElement::matchesReadOnlyPseudoClass() const
« Source/core/html/forms/TextFieldInputType.cpp ('K') | « Source/core/html/shadow/SpinButtonElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698