WebKit Bugzilla
Attachment 360037 Details for
Bug 193758
: [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
v2
bug-193758-20190124142203.patch (text/plain), 10.15 KB, created by
Wenson Hsieh
on 2019-01-24 14:22:03 PST
(
hide
)
Description:
v2
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-01-24 14:22:03 PST
Size:
10.15 KB
patch
obsolete
>Subversion Revision: 240352 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7f2118b95d5b512794c91cd7ae3c2f90e69a9b65..df3768b174f792bf5e21886ffc3d9010e45de170 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,37 @@ >+2019-01-24 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site >+ https://bugs.webkit.org/show_bug.cgi?id=193758 >+ <rdar://problem/43614978> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ CodeMirror's script adds a repeating timer that periodically normalizes the logical selection in the editor >+ (this is distinct from the actual DOM selection, which is inside a hidden textarea element). This script defines >+ a helper method to select all the text inside of a text form control, called `selectInput`, which normally >+ invokes `node.select()`. However, in the case of iOS, the script works around broken `select()` behavior by >+ setting `selectionStart` and `selectionEnd` to encompass all the content in the form control. When requesting >+ the desktop version of the site, CodeMirror no longer attempts to apply its iOS workaround. >+ >+ This iOS-specific behavior was introduced to fix <rdar://problem/4901923>. However, the original bug no longer >+ reproduces even without this quirk. To fix CodeMirror, we make two adjustments: >+ >+ 1. Roll out this ancient demo hack, in favor of standardized behavior. >+ 2. Note that `select()` is also used when focusing an input. However, when focusing an input element on iOS, we >+ want to match the platform (i.e. UITextField behavior) and move focus to the end of the text field. To >+ achieve this, we introduce a new helper on HTMLInputElement that is called when setting the default >+ selection of a text input after focus; on iOS, this helper method moves the selection to the end of the >+ input, but everywhere else, it selects all the text in the input element. >+ >+ This causes 6 existing layout tests to begin passing on iOS. >+ >+ * html/HTMLInputElement.cpp: >+ (WebCore::HTMLInputElement::updateFocusAppearance): >+ (WebCore::HTMLInputElement::setDefaultSelectionAfterFocus): >+ * html/HTMLInputElement.h: >+ * html/HTMLTextFormControlElement.cpp: >+ (WebCore::HTMLTextFormControlElement::select): >+ > 2019-01-23 Wenson Hsieh <wenson_hsieh@apple.com> > > Need a way for JavaScript (or bundle) code to participate in undo >diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp >index bcf89c7755be4bdf0b5978269f0f1ae7de990c73..43ae3b4668a1161d5199b8e4eb7ae5df3f0f42c0 100644 >--- a/Source/WebCore/html/HTMLInputElement.cpp >+++ b/Source/WebCore/html/HTMLInputElement.cpp >@@ -459,13 +459,27 @@ void HTMLInputElement::updateFocusAppearance(SelectionRestorationMode restoratio > { > if (isTextField()) { > if (restorationMode == SelectionRestorationMode::SetDefault || !hasCachedSelection()) >- select(revealMode, Element::defaultFocusTextStateChangeIntent()); >+ setDefaultSelectionAfterFocus(revealMode); > else > restoreCachedSelection(revealMode); > } else > HTMLTextFormControlElement::updateFocusAppearance(restorationMode, revealMode); > } > >+void HTMLInputElement::setDefaultSelectionAfterFocus(SelectionRevealMode revealMode) >+{ >+ ASSERT(isTextField()); >+#if PLATFORM(IOS_FAMILY) >+ // We don't want to select all the text on iOS when focusing a field. Instead, match platform behavior by going to the end of the line. >+ int start = std::numeric_limits<int>::max(); >+ auto direction = SelectionHasForwardDirection; >+#else >+ int start = 0; >+ auto direction = SelectionHasNoDirection; >+#endif >+ setSelectionRange(start, std::numeric_limits<int>::max(), direction, revealMode, Element::defaultFocusTextStateChangeIntent()); >+} >+ > void HTMLInputElement::endEditing() > { > if (!isTextField()) >diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h >index a5ea709a298254eb599e834bf49e21167de67e87..281f2679abef9f4f981c8174468c75eb1fed109b 100644 >--- a/Source/WebCore/html/HTMLInputElement.h >+++ b/Source/WebCore/html/HTMLInputElement.h >@@ -454,6 +454,8 @@ private: > void addToRadioButtonGroup(); > void removeFromRadioButtonGroup(); > >+ void setDefaultSelectionAfterFocus(SelectionRevealMode); >+ > AtomicString m_name; > String m_valueIfDirty; > unsigned m_size; >diff --git a/Source/WebCore/html/HTMLTextFormControlElement.cpp b/Source/WebCore/html/HTMLTextFormControlElement.cpp >index 15bf27192df73065530f812a06b30c6f7888a1e0..8136933ad554c5a1f7e0c6ca7879d965efc3dca9 100644 >--- a/Source/WebCore/html/HTMLTextFormControlElement.cpp >+++ b/Source/WebCore/html/HTMLTextFormControlElement.cpp >@@ -189,14 +189,7 @@ void HTMLTextFormControlElement::setSelectionDirection(const String& direction) > > void HTMLTextFormControlElement::select(SelectionRevealMode revealMode, const AXTextStateChangeIntent& intent) > { >- // FIXME: We should abstract the selection behavior into an EditingBehavior function instead >- // of hardcoding the behavior using a macro define. >-#if PLATFORM(IOS_FAMILY) >- // We don't want to select all the text on iOS. Instead use the standard textfield behavior of going to the end of the line. >- setSelectionRange(std::numeric_limits<int>::max(), std::numeric_limits<int>::max(), SelectionHasForwardDirection, revealMode, intent); >-#else > setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirection, revealMode, intent); >-#endif > } > > String HTMLTextFormControlElement::selectedText() const >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 3a251f673d8380d8d828528c33299d1e349db02d..be8ec82a3eca46b88e59f1dd96f478f8ab2c458b 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-24 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site >+ https://bugs.webkit.org/show_bug.cgi?id=193758 >+ <rdar://problem/43614978> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Mark some existing layout tests as passing on iOS. Additionally, remove failing expectations for another >+ existing layout test on iOS. >+ >+ * platform/ios/TestExpectations: >+ * platform/ios/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt: Removed. >+ > 2019-01-23 Wenson Hsieh <wenson_hsieh@apple.com> > > Need a way for JavaScript (or bundle) code to participate in undo >diff --git a/LayoutTests/platform/ios/TestExpectations b/LayoutTests/platform/ios/TestExpectations >index 2b3325b9a27ec5da26f0d071c48b5b48c17b1aff..c8a606f6e767c859e9ec712412cab5f1abaa868a 100644 >--- a/LayoutTests/platform/ios/TestExpectations >+++ b/LayoutTests/platform/ios/TestExpectations >@@ -1682,7 +1682,6 @@ fast/forms/hidpi-textfield-background-bleeding.html [ ImageOnlyFailure ] > fast/forms/input-baseline.html [ Failure ] > fast/forms/input-live-pseudo-selectors.html [ Failure ] > fast/forms/input-no-renderer.html [ Failure ] >-fast/forms/input-select-webkit-user-select-none.html [ Failure ] > fast/forms/input-set-composition-scroll.html [ Failure ] > fast/forms/input-textarea-padding-match.html [ ImageOnlyFailure ] > fast/forms/listbox-clip.html [ Failure ] >@@ -1707,12 +1706,10 @@ fast/forms/select-live-pseudo-selectors.html [ Failure ] > fast/forms/select-overflow-scroll-inherited.html [ Failure ] > fast/forms/select-overflow-scroll.html [ Failure ] > fast/forms/select/option-selecting.html [ Failure ] >-fast/forms/shadow-tree-exposure.html [ Failure ] > fast/forms/textarea-input-event.html [ Failure ] > fast/forms/textarea-live-pseudo-selectors.html [ Failure ] > fast/forms/textarea-metrics.html [ Failure ] > fast/forms/textarea-placeholder-wrapping.html [ ImageOnlyFailure ] >-fast/forms/textarea-set-defaultvalue-after-value.html [ Failure ] > fast/forms/textfield-overflow-by-value-update.html [ Failure ] > fast/frames/calculate-fixed.html [ Failure ] > fast/frames/calculate-order.html [ Failure ] >@@ -2117,7 +2114,6 @@ editing/pasteboard/copy-backslash-with-euc.html [ Failure ] > editing/pasteboard/copy-in-password-field.html [ Failure ] > editing/pasteboard/copy-inside-h1-preserves-h1.html [ Failure ] > editing/pasteboard/copy-text-with-backgroundcolor.html [ Failure ] >-editing/pasteboard/copy-two-pasteboard-types-both-work.html [ Failure ] > webkit.org/b/177961 editing/pasteboard/data-transfer-items.html [ Skip ] > editing/pasteboard/dataTransfer-setData-getData.html [ Failure ] > editing/pasteboard/display-block-on-spans.html [ Failure ] >@@ -2137,7 +2133,6 @@ editing/pasteboard/paste-before-tab-span.html [ Failure ] > editing/pasteboard/paste-blockquote-3.html [ Failure ] > editing/pasteboard/paste-global-selection.html [ Failure ] > editing/pasteboard/paste-list-004.html [ Failure ] >-editing/pasteboard/paste-placeholder-input.html [ Failure ] > editing/pasteboard/paste-plaintext-user-select-none.html [ Failure ] > editing/pasteboard/paste-sanitize-crash-1.html [ Failure ] > editing/pasteboard/paste-sanitize-crash-2.html [ Failure ] >diff --git a/LayoutTests/platform/ios/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt b/LayoutTests/platform/ios/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt >deleted file mode 100644 >index c2d243280a89bde348fe1f5995bbac2861aac516..0000000000000000000000000000000000000000 >--- a/LayoutTests/platform/ios/editing/text-iterator/hidden-textarea-selection-quirk-expected.txt >+++ /dev/null >@@ -1,11 +0,0 @@ >- >- >-FAIL Selecting in barely visible textarea assert_equals: expected "test text" but got "" >-PASS Selecting in barely visible div >-PASS Selecting in textarea hidden by container >-PASS Selecting in div hidden by container >-FAIL Selecting in absolute positioned textarea hidden by container assert_equals: expected "test text" but got "" >-PASS Selecting in absolute positioned div hidden by container >-FAIL Selecting in absolute positioned zero content width textarea hidden by container (quirk behavior) assert_equals: expected "test text" but got "" >-PASS Selecting in absolute positioned zero content width div hidden by container >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193758
:
359995
| 360037 |
361025
|
361054
|
361112
|
361117