Index: third_party/WebKit/Source/core/html/HTMLInputElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp |
index ba6302a797fa4e740cc1d7ed62c10008f4b36527..a16d39805bad93b0e246c7ad68a04ed1b763c103 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp |
@@ -340,17 +340,21 @@ bool HTMLInputElement::shouldShowFocusRingOnMouseFocus() const |
return m_inputType->shouldShowFocusRingOnMouseFocus(); |
} |
-void HTMLInputElement::updateFocusAppearance(bool restorePreviousSelection) |
+void HTMLInputElement::updateFocusAppearance(SelectionBehaviorOnFocus selectionBehavior) |
{ |
if (isTextField()) { |
- if (!restorePreviousSelection) |
+ switch (selectionBehavior) { |
+ case SelectionBehaviorOnFocus::Reset: |
select(NotDispatchSelectEvent); |
- else |
+ break; |
+ case SelectionBehaviorOnFocus::Restore: |
restoreCachedSelection(); |
+ break; |
+ } |
if (document().frame()) |
document().frame()->selection().revealSelection(); |
} else { |
- HTMLTextFormControlElement::updateFocusAppearance(restorePreviousSelection); |
+ HTMLTextFormControlElement::updateFocusAppearance(selectionBehavior); |
} |
} |
@@ -504,7 +508,7 @@ void HTMLInputElement::updateType() |
} |
if (document().focusedElement() == this) |
- document().updateFocusAppearanceSoon(true /* restore selection */); |
+ document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore); |
setTextAsOfLastFormControlChangeEvent(value()); |
setChangedSinceLastFormControlChangeEvent(false); |
@@ -831,7 +835,7 @@ void HTMLInputElement::attach(const AttachContext& context) |
m_inputType->countUsage(); |
if (document().focusedElement() == this) |
- document().updateFocusAppearanceSoon(true /* restore selection */); |
+ document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore); |
} |
void HTMLInputElement::detach(const AttachContext& context) |