Title: [232259] trunk
- Revision
- 232259
- Author
- n_w...@apple.com
- Date
- 2018-05-29 09:19:09 -0700 (Tue, 29 May 2018)
Log Message
AX: setValue on contenteditable should preserve whitespace
https://bugs.webkit.org/show_bug.cgi?id=185897
Reviewed by Ryosuke Niwa.
Source/WebCore:
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):
LayoutTests:
* 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:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (232258 => 232259)
--- trunk/LayoutTests/ChangeLog 2018-05-29 16:12:22 UTC (rev 232258)
+++ trunk/LayoutTests/ChangeLog 2018-05-29 16:19:09 UTC (rev 232259)
@@ -1,3 +1,15 @@
+2018-05-29 Nan Wang <n_w...@apple.com>
+
+ AX: setValue on contenteditable should preserve whitespace
+ https://bugs.webkit.org/show_bug.cgi?id=185897
+
+ Reviewed by Ryosuke Niwa.
+
+ * 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-29 Antoine Quint <grao...@apple.com>
[Web Animations] Handle relative length units
Modified: trunk/LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue-expected.txt (232258 => 232259)
--- trunk/LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue-expected.txt 2018-05-29 16:12:22 UTC (rev 232258)
+++ trunk/LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue-expected.txt 2018-05-29 16:19:09 UTC (rev 232259)
@@ -13,6 +13,7 @@
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
Modified: trunk/LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue.html (232258 => 232259)
--- trunk/LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue.html 2018-05-29 16:12:22 UTC (rev 232258)
+++ trunk/LayoutTests/accessibility/mac/AOM-event-accessiblesetvalue.html 2018-05-29 16:19:09 UTC (rev 232259)
@@ -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");
}
Modified: trunk/LayoutTests/accessibility/mac/set-value-editable-types-expected.txt (232258 => 232259)
--- trunk/LayoutTests/accessibility/mac/set-value-editable-types-expected.txt 2018-05-29 16:12:22 UTC (rev 232258)
+++ trunk/LayoutTests/accessibility/mac/set-value-editable-types-expected.txt 2018-05-29 16:19:09 UTC (rev 232259)
@@ -9,7 +9,7 @@
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
Modified: trunk/LayoutTests/accessibility/mac/set-value-editable-types.html (232258 => 232259)
--- trunk/LayoutTests/accessibility/mac/set-value-editable-types.html 2018-05-29 16:12:22 UTC (rev 232258)
+++ trunk/LayoutTests/accessibility/mac/set-value-editable-types.html 2018-05-29 16:19:09 UTC (rev 232259)
@@ -37,6 +37,8 @@
var writable = axElement.isAttributeSettable("AXValue");
debug("Writable: " + writable);
+ document.getElementById(idValue).focus();
+
axElement.setValue(" leading and trailing spaces ");
}
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (232258 => 232259)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2018-05-29 16:12:22 UTC (rev 232258)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2018-05-29 16:19:09 UTC (rev 232259)
@@ -514,6 +514,8 @@
webkit.org/b/183023 accessibility/mac/AOM-events-all.html [ Skip ]
webkit.org/b/183352 accessibility/ios-simulator/AOM-dismiss-event.html [ Skip ]
webkit.org/b/184742 accessibility/mac/async-increment-decrement-action.html [ Skip ]
+webkit.org/b/185897 accessibility/mac/AOM-event-accessiblesetvalue.html [ Skip ]
+webkit.org/b/185897 accessibility/mac/set-value-editable-types.html [ Skip ]
webkit.org/b/182752 accessibility/mac/accessibility-make-first-responder.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (232258 => 232259)
--- trunk/Source/WebCore/ChangeLog 2018-05-29 16:12:22 UTC (rev 232258)
+++ trunk/Source/WebCore/ChangeLog 2018-05-29 16:19:09 UTC (rev 232259)
@@ -1,3 +1,18 @@
+2018-05-29 Nan Wang <n_w...@apple.com>
+
+ AX: setValue on contenteditable should preserve whitespace
+ https://bugs.webkit.org/show_bug.cgi?id=185897
+
+ Reviewed by Ryosuke Niwa.
+
+ 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-29 Zalan Bujtas <za...@apple.com>
[LFC] Miscellaneous fixes to ensure no assertion in LayoutContext::layout
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (232258 => 232259)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2018-05-29 16:12:22 UTC (rev 232258)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2018-05-29 16:19:09 UTC (rev 232259)
@@ -1778,15 +1778,15 @@
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 editor's insertText 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();
+ editor.insertText(string, nullptr);
+ }
}
- downcast<HTMLElement>(element).setInnerText(string);
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes