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

Unified Diff: third_party/WebKit/Source/core/html/HTMLTextFormControlElement.h

Issue 2277903003: Fix selectionDirection after setting value of TEXTAREA/INPUT. (Closed)
Patch Set: Revert DCHECK_LE Created 4 years, 4 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: third_party/WebKit/Source/core/html/HTMLTextFormControlElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.h b/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.h
index b4e03dfba403de8dae408db3ade09efab1ee7c6e..15b0a696bc1599df33051a36df623320cd68477a 100644
--- a/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.h
@@ -70,11 +70,11 @@ public:
void select(NeedToDispatchSelectEvent = DispatchSelectEvent);
virtual void setRangeText(const String& replacement, ExceptionState&);
virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState&);
- // Web-exposed setSelectionRange() function. This translates "none"
- // direction to "forward" if necessary.
+ // Web-exposed setSelectionRange() function. This schedule to dispatch
+ // 'select' event.
void setSelectionRangeForBinding(int start, int end, const String& direction = "none");
- // Blink-internal version of setSelectionRange(). This never translates
- // "none" direction.
+ // Blink-internal version of setSelectionRange(). This translates "none"
+ // direction to "forward" on platforms without "none" direction.
void setSelectionRange(int start, int end, TextFieldSelectionDirection = SelectionHasNoDirection, NeedToDispatchSelectEvent = DispatchSelectEvent);
Range* selection() const;
@@ -115,14 +115,6 @@ protected:
void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicString&) override;
- void cacheSelection(int start, int end, TextFieldSelectionDirection direction)
- {
- DCHECK_GE(start, 0);
- m_cachedSelectionStart = start;
- m_cachedSelectionEnd = end;
- m_cachedSelectionDirection = direction;
- }
-
void restoreCachedSelection();
void defaultEventHandler(Event*) override;
@@ -139,6 +131,15 @@ private:
int computeSelectionStart() const;
int computeSelectionEnd() const;
TextFieldSelectionDirection computeSelectionDirection() const;
+ void cacheSelection(int start, int end, TextFieldSelectionDirection direction)
+ {
+ DCHECK_GE(start, 0);
+ // TODO(tkent): Add DCHECK_LE(start, end). It breaks
+ // editing/selection/select-across-readonly-input-{1,4}.html
+ m_cachedSelectionStart = start;
+ m_cachedSelectionEnd = end;
+ m_cachedSelectionDirection = direction;
+ }
void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDeviceCapabilities* sourceCapabilities) final;
void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDeviceCapabilities* sourceCapabilities) final;

Powered by Google App Engine
This is Rietveld 408576698