Title: [232120] trunk
- Revision
- 232120
- Author
- [email protected]
- Date
- 2018-05-23 11:38:42 -0700 (Wed, 23 May 2018)
Log Message
AX: setValue on contenteditable should preserve whitespace
https://bugs.webkit.org/show_bug.cgi?id=185897
Reviewed by Chris Fleizach.
Source/WebCore:
RenderText is using its parent renderer's style to determine if
whitespace collapsing is necessary. So when setting the innerText
of the element in setValue, let's also set its style in order to
preserve whitespaces.
Modified an existing test to cover this change.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::setValue):
LayoutTests:
* accessibility/mac/set-value-editable-types-expected.txt:
* accessibility/mac/set-value-editable-types.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (232119 => 232120)
--- trunk/LayoutTests/ChangeLog 2018-05-23 17:54:01 UTC (rev 232119)
+++ trunk/LayoutTests/ChangeLog 2018-05-23 18:38:42 UTC (rev 232120)
@@ -1,3 +1,13 @@
+2018-05-23 Nan Wang <[email protected]>
+
+ AX: setValue on contenteditable should preserve whitespace
+ https://bugs.webkit.org/show_bug.cgi?id=185897
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/set-value-editable-types-expected.txt:
+ * accessibility/mac/set-value-editable-types.html:
+
2018-05-23 Antti Koivisto <[email protected]>
Increase the simulated memory size on PLATFORM(IOS_SIMULATOR) from 512MB to 1024MB
Modified: trunk/LayoutTests/accessibility/mac/set-value-editable-types-expected.txt (232119 => 232120)
--- trunk/LayoutTests/accessibility/mac/set-value-editable-types-expected.txt 2018-05-23 17:54:01 UTC (rev 232119)
+++ trunk/LayoutTests/accessibility/mac/set-value-editable-types-expected.txt 2018-05-23 18:38:42 UTC (rev 232120)
@@ -9,7 +9,7 @@
Value: AXValue: current1
Writable: true
Value change notification received
-Updated Value: AXValue: new value
+Updated Value: AXValue: leading and trailing spaces
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/accessibility/mac/set-value-editable-types.html (232119 => 232120)
--- trunk/LayoutTests/accessibility/mac/set-value-editable-types.html 2018-05-23 17:54:01 UTC (rev 232119)
+++ trunk/LayoutTests/accessibility/mac/set-value-editable-types.html 2018-05-23 18:38:42 UTC (rev 232120)
@@ -37,7 +37,7 @@
var writable = axElement.isAttributeSettable("AXValue");
debug("Writable: " + writable);
- axElement.setValue("new value");
+ axElement.setValue(" leading and trailing spaces ");
}
debug("\nContenteditable");
Modified: trunk/Source/WebCore/ChangeLog (232119 => 232120)
--- trunk/Source/WebCore/ChangeLog 2018-05-23 17:54:01 UTC (rev 232119)
+++ trunk/Source/WebCore/ChangeLog 2018-05-23 18:38:42 UTC (rev 232120)
@@ -1,3 +1,20 @@
+2018-05-23 Nan Wang <[email protected]>
+
+ AX: setValue on contenteditable should preserve whitespace
+ https://bugs.webkit.org/show_bug.cgi?id=185897
+
+ Reviewed by Chris Fleizach.
+
+ RenderText is using its parent renderer's style to determine if
+ whitespace collapsing is necessary. So when setting the innerText
+ of the element in setValue, let's also set its style in order to
+ preserve whitespaces.
+
+ Modified an existing test to cover this change.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::setValue):
+
2018-05-23 Michael Catanzaro <[email protected]>
[GTK] Silence GCC 8 warnings
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (232119 => 232120)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2018-05-23 17:54:01 UTC (rev 232119)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2018-05-23 18:38:42 UTC (rev 232120)
@@ -1777,8 +1777,17 @@
downcast<HTMLInputElement>(element).setValue(string);
else if (renderer.isTextArea() && is<HTMLTextAreaElement>(element))
downcast<HTMLTextAreaElement>(element).setValue(string);
- else if (is<HTMLElement>(element) && contentEditableAttributeIsEnabled(&element))
+ 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(PRE);
+ renderElement.setStyleInternal(WTFMove(style));
+ }
downcast<HTMLElement>(element).setInnerText(string);
+ }
}
bool AccessibilityRenderObject::supportsARIAOwns() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes