WebKit Bugzilla
Attachment 341369 Details for
Bug 185897
: AX: setValue on contenteditable should preserve whitespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
patch.txt (text/plain), 6.17 KB, created by
Nan Wang
on 2018-05-25 18:03:50 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Nan Wang
Created:
2018-05-25 18:03:50 PDT
Size:
6.17 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 232219) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2018-05-25 Nan Wang <n_wang@apple.com> >+ >+ AX: setValue on contenteditable should preserve whitespace >+ https://bugs.webkit.org/show_bug.cgi?id=185897 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We should mimic typing when setting value to a contenteditable from accessibility >+ instead of mutating the DOM by using setInnerText. >+ >+ Updated tests to cover this change. >+ >+ * accessibility/AccessibilityRenderObject.cpp: >+ (WebCore::AccessibilityRenderObject::setValue): >+ > 2018-05-25 Timothy Hatcher <timothy@apple.com> > > Setting drawsBackground to YES on a WKView doesn't take effect immediately >Index: Source/WebCore/accessibility/AccessibilityRenderObject.cpp >=================================================================== >--- Source/WebCore/accessibility/AccessibilityRenderObject.cpp (revision 232197) >+++ Source/WebCore/accessibility/AccessibilityRenderObject.cpp (working copy) >@@ -98,6 +98,7 @@ > #include "Text.h" > #include "TextControlInnerElements.h" > #include "TextIterator.h" >+#include "TypingCommand.h" > #include "VisibleUnits.h" > #include <wtf/NeverDestroyed.h> > #include <wtf/StdLibExtras.h> >@@ -1778,15 +1779,15 @@ void AccessibilityRenderObject::setValue > else if (renderer.isTextArea() && is<HTMLTextAreaElement>(element)) > downcast<HTMLTextAreaElement>(element).setValue(string); > else if (is<HTMLElement>(element) && contentEditableAttributeIsEnabled(&element)) { >- // Set the style to the element so the child Text node won't collapse spaces >- if (is<RenderElement>(renderer)) { >- RenderElement& renderElement = downcast<RenderElement>(renderer); >- auto style = RenderStyle::create(); >- style.inheritFrom(renderElement.style()); >- style.setWhiteSpace(WhiteSpace::Pre); >- renderElement.setStyleInternal(WTFMove(style)); >+ // We should use the typing command to mimic typing into the contenteditable field. >+ // Also only do this when the field is in editing mode. >+ if (Frame* frame = renderer.document().frame()) { >+ Editor& editor = frame->editor(); >+ if (element.shouldUseInputMethod()) { >+ editor.clearText(); >+ TypingCommand::insertText(node()->document(), string, 0); >+ } > } >- downcast<HTMLElement>(element).setInnerText(string); > } > } > >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 232197) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2018-05-25 Nan Wang <n_wang@apple.com> >+ >+ AX: setValue on contenteditable should preserve whitespace >+ https://bugs.webkit.org/show_bug.cgi?id=185897 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * accessibility/mac/AOM-event-accessiblesetvalue-expected.txt: >+ * accessibility/mac/AOM-event-accessiblesetvalue.html: >+ * accessibility/mac/set-value-editable-types-expected.txt: >+ * accessibility/mac/set-value-editable-types.html: >+ > 2018-05-25 Antoine Quint <graouts@apple.com> > > [Web Animations] WebAnimation objects never get destroyed >Index: LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue-expected.txt >=================================================================== >--- LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue-expected.txt (revision 232197) >+++ LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue-expected.txt (working copy) >@@ -13,6 +13,7 @@ combobox accessible set value to: combob > > Test Contenteditable. > contenteditable accessible set value to: contenteditable new value >+PASS axNode.stringValue is 'AXValue: contenteditable new value' > > Test Slider. > slider accessible set value to: 70 >Index: LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue.html >=================================================================== >--- LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue.html (revision 232197) >+++ LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue.html (working copy) >@@ -63,8 +63,16 @@ > axNode = accessibilityController.accessibleElementById("contenteditable"); > node.onaccessiblesetvalue = function(event) { > debug("contenteditable accessible set value to: " + event.value); >- testSlider(); > }; >+ accessibilityController.addNotificationListener(function(element, notification) { >+ if (notification == "AXValueChanged") { >+ shouldBe("axNode.stringValue", "'AXValue: contenteditable new value'"); >+ node.blur(); >+ accessibilityController.removeNotificationListener(); >+ testSlider(); >+ } >+ }); >+ node.focus(); > axNode.setValue("contenteditable new value"); > } > >Index: LayoutTests/accessibility/mac/set-value-editable-types-expected.txt >=================================================================== >--- LayoutTests/accessibility/mac/set-value-editable-types-expected.txt (revision 232197) >+++ LayoutTests/accessibility/mac/set-value-editable-types-expected.txt (working copy) >@@ -9,7 +9,7 @@ Role: AXRole: AXTextArea > Value: AXValue: current1 > Writable: true > Value change notification received >-Updated Value: AXValue: leading and trailing spaces >+Updated Value: AXValue:   leading and trailing spaces   > PASS successfullyParsed is true > > TEST COMPLETE >Index: LayoutTests/accessibility/mac/set-value-editable-types.html >=================================================================== >--- LayoutTests/accessibility/mac/set-value-editable-types.html (revision 232197) >+++ LayoutTests/accessibility/mac/set-value-editable-types.html (working copy) >@@ -37,6 +37,8 @@ > var writable = axElement.isAttributeSettable("AXValue"); > debug("Writable: " + writable); > >+ document.getElementById(idValue).focus(); >+ > axElement.setValue(" leading and trailing spaces "); > } >
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
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185897
:
341053
|
341054
|
341062
|
341068
|
341369
|
341376
|
341377
|
341385