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

Unified Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 1420693006: Introduce a struct to store arguments of Element::focus(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: 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)
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.h ('k') | third_party/WebKit/Source/core/html/HTMLLabelElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698