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

Unified Diff: Source/core/html/HTMLTextFormControlElement.cpp

Issue 222023002: focus() behaviour differs depending on how value is set (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebasing Created 6 years, 8 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
« no previous file with comments | « Source/core/html/HTMLTextFormControlElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTextFormControlElement.cpp
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index 0781759d04a5a740c31d43df427078267356a4dc..c3f751a63f54d4eb643bdb97275b0ecbe1ae555c 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -53,8 +53,8 @@ using namespace std;
HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName& tagName, Document& doc, HTMLFormElement* form)
: HTMLFormControlElementWithState(tagName, doc, form)
, m_lastChangeWasUserEdit(false)
- , m_cachedSelectionStart(-1)
- , m_cachedSelectionEnd(-1)
+ , m_cachedSelectionStart(0)
+ , m_cachedSelectionEnd(0)
, m_cachedSelectionDirection(SelectionHasNoDirection)
{
}
@@ -335,7 +335,7 @@ int HTMLTextFormControlElement::selectionStart() const
{
if (!isTextFormControl())
return 0;
- if (document().focusedElement() != this && hasCachedSelection())
+ if (document().focusedElement() != this)
return m_cachedSelectionStart;
return computeSelectionStart();
@@ -355,7 +355,7 @@ int HTMLTextFormControlElement::selectionEnd() const
{
if (!isTextFormControl())
return 0;
- if (document().focusedElement() != this && hasCachedSelection())
+ if (document().focusedElement() != this)
return m_cachedSelectionEnd;
return computeSelectionEnd();
}
@@ -393,7 +393,7 @@ const AtomicString& HTMLTextFormControlElement::selectionDirection() const
{
if (!isTextFormControl())
return directionString(SelectionHasNoDirection);
- if (document().focusedElement() != this && hasCachedSelection())
+ if (document().focusedElement() != this)
return directionString(m_cachedSelectionDirection);
return directionString(computeSelectionDirection());
@@ -423,7 +423,7 @@ static inline void setContainerAndOffsetForRange(Node* node, int offset, Node*&
PassRefPtrWillBeRawPtr<Range> HTMLTextFormControlElement::selection() const
{
- if (!renderer() || !isTextFormControl() || !hasCachedSelection())
+ if (!renderer() || !isTextFormControl())
return nullptr;
int start = m_cachedSelectionStart;
« no previous file with comments | « Source/core/html/HTMLTextFormControlElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698