diff --git a/content/html/content/src/HTMLInputElement.cpp b/content/html/content/src/HTMLInputElement.cpp
index 6b8dba389143..93f299215ae5 100644
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -3295,15 +3295,6 @@ HTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
// nsIFormControlFrame::SetFocus, we handle focus here.
nsIFrame* frame = GetPrimaryFrame();
if (frame) {
- if (aVisitor.mEvent->message == NS_FOCUS_CONTENT) {
- // Tell our frame it's getting focus so that it can make sure focus
- // is moved to our anonymous text control.
- nsNumberControlFrame* numberControlFrame =
- do_QueryFrame(GetPrimaryFrame());
- if (numberControlFrame) {
- numberControlFrame->HandleFocusEvent(aVisitor.mEvent);
- }
- }
frame->InvalidateFrameSubtree();
}
}
@@ -3342,6 +3333,21 @@ HTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
StopNumberControlSpinnerSpin();
}
}
+ if (aVisitor.mEvent->message == NS_FOCUS_CONTENT ||
+ aVisitor.mEvent->message == NS_BLUR_CONTENT) {
+ nsIFrame* frame = GetPrimaryFrame();
+ if (frame) {
+ if (aVisitor.mEvent->message == NS_FOCUS_CONTENT) {
+ // Tell our frame it's getting focus so that it can make sure focus
+ // is moved to our anonymous text control.
+ nsNumberControlFrame* numberControlFrame =
+ do_QueryFrame(GetPrimaryFrame());
+ if (numberControlFrame) {
+ numberControlFrame->HandleFocusEvent(aVisitor.mEvent);
+ }
+ }
+ }
+ }
}
nsresult rv = nsGenericHTMLFormElementWithState::PreHandleEvent(aVisitor);