Title: [226753] trunk
Revision
226753
Author
[email protected]
Date
2018-01-10 19:05:10 -0800 (Wed, 10 Jan 2018)

Log Message

REGRESSION(r222507): Composition highlight doesn't render when using IME
https://bugs.webkit.org/show_bug.cgi?id=181485
<rdar://problem/35896516>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground.

Test: editing/marked-text-appearance.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintCompositionBackground):

Source/WebKit:

Add plumbing for a `suppressUnderline` argument when setting marked text.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageSetComposition):
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setCompositionForTesting):
* WebProcess/WebPage/WebPage.h:

Tools:

Add a `suppressUnderline` argument to TextInputController.setMarkedText. This suppresses the custom underlines
rendered when testing IME on iOS in WebKit2. In this new test, suppressing underline rendering is needed to
allow rendering composition backgrounds (see InlineTextBox::paint).

* DumpRenderTree/ios/TextInputControllerIOS.m:
(+[TextInputController isSelectorExcludedFromWebScript:]):
(+[TextInputController webScriptNameForSelector:]):
(-[TextInputController setMarkedText:selectedFrom:length:suppressUnderline:]):
(-[TextInputController setMarkedText:selectedFrom:length:]): Deleted.
* DumpRenderTree/mac/TextInputControllerMac.m:
(+[TextInputController isSelectorExcludedFromWebScript:]):
(+[TextInputController webScriptNameForSelector:]):
(-[TextInputController setMarkedText:selectedFrom:length:suppressUnderline:]):
(-[TextInputController setMarkedText:selectedFrom:length:]): Deleted.
* WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl:
* WebKitTestRunner/InjectedBundle/TextInputController.cpp:
(WTR::TextInputController::setMarkedText):
* WebKitTestRunner/InjectedBundle/TextInputController.h:

LayoutTests:

Add a new layout test to ensure that in the absence of custom composition underlines, a marked composition
string appears different once it is confirmed.

* editing/marked-text-appearance-expected-mismatch.html: Added.
* editing/marked-text-appearance.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (226752 => 226753)


--- trunk/LayoutTests/ChangeLog	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/LayoutTests/ChangeLog	2018-01-11 03:05:10 UTC (rev 226753)
@@ -1,3 +1,17 @@
+2018-01-10  Wenson Hsieh  <[email protected]>
+
+        REGRESSION(r222507): Composition highlight doesn't render when using IME
+        https://bugs.webkit.org/show_bug.cgi?id=181485
+        <rdar://problem/35896516>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a new layout test to ensure that in the absence of custom composition underlines, a marked composition
+        string appears different once it is confirmed.
+
+        * editing/marked-text-appearance-expected-mismatch.html: Added.
+        * editing/marked-text-appearance.html: Added.
+
 2018-01-10  Chris Dumez  <[email protected]>
 
         Multiple http/wpt/beacon/contentextensions/ test are flaky.

Added: trunk/LayoutTests/editing/marked-text-appearance-expected-mismatch.html (0 => 226753)


--- trunk/LayoutTests/editing/marked-text-appearance-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/editing/marked-text-appearance-expected-mismatch.html	2018-01-11 03:05:10 UTC (rev 226753)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<body contenteditable></body>
+<script>
+    document.body.focus();
+    if (window.textInputController) {
+        textInputController.setMarkedText("^^^^^", 0, 5, true);
+        textInputController.insertText("^^^^^");
+    }
+</script>

Added: trunk/LayoutTests/editing/marked-text-appearance.html (0 => 226753)


--- trunk/LayoutTests/editing/marked-text-appearance.html	                        (rev 0)
+++ trunk/LayoutTests/editing/marked-text-appearance.html	2018-01-11 03:05:10 UTC (rev 226753)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<body contenteditable></body>
+<script>
+    document.body.focus();
+    if (window.textInputController)
+        textInputController.setMarkedText("^^^^^", 0, 5, true);
+</script>

Modified: trunk/Source/WebCore/ChangeLog (226752 => 226753)


--- trunk/Source/WebCore/ChangeLog	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Source/WebCore/ChangeLog	2018-01-11 03:05:10 UTC (rev 226753)
@@ -1,3 +1,18 @@
+2018-01-10  Wenson Hsieh  <[email protected]>
+
+        REGRESSION(r222507): Composition highlight doesn't render when using IME
+        https://bugs.webkit.org/show_bug.cgi?id=181485
+        <rdar://problem/35896516>
+
+        Reviewed by Ryosuke Niwa.
+
+        Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground.
+
+        Test: editing/marked-text-appearance.html
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintCompositionBackground):
+
 2018-01-10  Youenn Fablet  <[email protected]>
 
         Use no-cache fetch mode when loading main documents with location.reload()

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (226752 => 226753)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2018-01-11 03:05:10 UTC (rev 226753)
@@ -1044,7 +1044,7 @@
 
 void InlineTextBox::paintCompositionBackground(GraphicsContext& context, const FloatPoint& boxOrigin)
 {
-    paintTextSubrangeBackground(context, boxOrigin, clampedOffset(renderer().frame().editor().compositionStart()), clampedOffset(renderer().frame().editor().compositionEnd()), Color::compositionFill);
+    paintTextSubrangeBackground(context, boxOrigin, Color::compositionFill, clampedOffset(renderer().frame().editor().compositionStart()), clampedOffset(renderer().frame().editor().compositionEnd()));
 }
 
 void InlineTextBox::paintCompositionUnderlines(GraphicsContext& context, const FloatPoint& boxOrigin) const

Modified: trunk/Source/WebKit/ChangeLog (226752 => 226753)


--- trunk/Source/WebKit/ChangeLog	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Source/WebKit/ChangeLog	2018-01-11 03:05:10 UTC (rev 226753)
@@ -1,3 +1,20 @@
+2018-01-10  Wenson Hsieh  <[email protected]>
+
+        REGRESSION(r222507): Composition highlight doesn't render when using IME
+        https://bugs.webkit.org/show_bug.cgi?id=181485
+        <rdar://problem/35896516>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add plumbing for a `suppressUnderline` argument when setting marked text.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageSetComposition):
+        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setCompositionForTesting):
+        * WebProcess/WebPage/WebPage.h:
+
 2018-01-10  Tim Horton  <[email protected]>
 
         REGRESSION (r213590): Swipe from edge to go to previous page is significantly slower than tapping back button on Twitter

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (226752 => 226753)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2018-01-11 03:05:10 UTC (rev 226753)
@@ -540,9 +540,9 @@
     return toAPI(&toImpl(pageRef)->trackedRepaintRects().leakRef());
 }
 
-void WKBundlePageSetComposition(WKBundlePageRef pageRef, WKStringRef text, int from, int length)
+void WKBundlePageSetComposition(WKBundlePageRef pageRef, WKStringRef text, int from, int length, bool suppressUnderline)
 {
-    toImpl(pageRef)->setCompositionForTesting(toWTFString(text), from, length);
+    toImpl(pageRef)->setCompositionForTesting(toWTFString(text), from, length, suppressUnderline);
 }
 
 bool WKBundlePageHasComposition(WKBundlePageRef pageRef)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h (226752 => 226753)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2018-01-11 03:05:10 UTC (rev 226753)
@@ -72,7 +72,7 @@
 WK_EXPORT void WKBundlePageResetTrackedRepaints(WKBundlePageRef page);
 WK_EXPORT WKArrayRef WKBundlePageCopyTrackedRepaintRects(WKBundlePageRef page);
 
-WK_EXPORT void WKBundlePageSetComposition(WKBundlePageRef page, WKStringRef text, int from, int length);
+WK_EXPORT void WKBundlePageSetComposition(WKBundlePageRef page, WKStringRef text, int from, int length, bool suppressUnderline);
 WK_EXPORT bool WKBundlePageHasComposition(WKBundlePageRef page);
 WK_EXPORT void WKBundlePageConfirmComposition(WKBundlePageRef page);
 WK_EXPORT void WKBundlePageConfirmCompositionWithText(WKBundlePageRef page, WKStringRef text);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (226752 => 226753)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-01-11 03:05:10 UTC (rev 226753)
@@ -4417,7 +4417,7 @@
     mouseEvent(WebMouseEvent(WebMouseEvent::MouseMove, WebMouseEvent::NoButton, 0, position, position, 0, 0, 0, 0, WebMouseEvent::Modifiers(), time, 0, WebMouseEvent::NoTap));
 }
 
-void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length)
+void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length, bool suppressUnderline)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     if (!frame.editor().canEdit())
@@ -4424,7 +4424,9 @@
         return;
 
     Vector<CompositionUnderline> underlines;
-    underlines.append(CompositionUnderline(0, compositionString.length(), CompositionUnderlineColor::TextColor, Color(Color::black), false));
+    if (!suppressUnderline)
+        underlines.append(CompositionUnderline(0, compositionString.length(), CompositionUnderlineColor::TextColor, Color(Color::black), false));
+
     frame.editor().setComposition(compositionString, underlines, from, from + length);
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (226752 => 226753)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2018-01-11 03:05:10 UTC (rev 226753)
@@ -735,7 +735,7 @@
     void updateAccessibilityTree();
 #endif
 
-    void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
+    void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length, bool suppressUnderline);
     bool hasCompositionForTesting();
     void confirmCompositionForTesting(const String& compositionString);
 

Modified: trunk/Tools/ChangeLog (226752 => 226753)


--- trunk/Tools/ChangeLog	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Tools/ChangeLog	2018-01-11 03:05:10 UTC (rev 226753)
@@ -1,3 +1,30 @@
+2018-01-10  Wenson Hsieh  <[email protected]>
+
+        REGRESSION(r222507): Composition highlight doesn't render when using IME
+        https://bugs.webkit.org/show_bug.cgi?id=181485
+        <rdar://problem/35896516>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a `suppressUnderline` argument to TextInputController.setMarkedText. This suppresses the custom underlines
+        rendered when testing IME on iOS in WebKit2. In this new test, suppressing underline rendering is needed to
+        allow rendering composition backgrounds (see InlineTextBox::paint).
+
+        * DumpRenderTree/ios/TextInputControllerIOS.m:
+        (+[TextInputController isSelectorExcludedFromWebScript:]):
+        (+[TextInputController webScriptNameForSelector:]):
+        (-[TextInputController setMarkedText:selectedFrom:length:suppressUnderline:]):
+        (-[TextInputController setMarkedText:selectedFrom:length:]): Deleted.
+        * DumpRenderTree/mac/TextInputControllerMac.m:
+        (+[TextInputController isSelectorExcludedFromWebScript:]):
+        (+[TextInputController webScriptNameForSelector:]):
+        (-[TextInputController setMarkedText:selectedFrom:length:suppressUnderline:]):
+        (-[TextInputController setMarkedText:selectedFrom:length:]): Deleted.
+        * WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl:
+        * WebKitTestRunner/InjectedBundle/TextInputController.cpp:
+        (WTR::TextInputController::setMarkedText):
+        * WebKitTestRunner/InjectedBundle/TextInputController.h:
+
 2018-01-10  JF Bastien  <[email protected]>
 
         Poison small JSObject derivatives which only contain pointers

Modified: trunk/Tools/DumpRenderTree/ios/TextInputControllerIOS.m (226752 => 226753)


--- trunk/Tools/DumpRenderTree/ios/TextInputControllerIOS.m	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Tools/DumpRenderTree/ios/TextInputControllerIOS.m	2018-01-11 03:05:10 UTC (rev 226753)
@@ -39,7 +39,7 @@
 + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
 {
     if (aSelector == @selector(insertText:)
-        || aSelector == @selector(setMarkedText:selectedFrom:length:)
+        || aSelector == @selector(setMarkedText:selectedFrom:length:suppressUnderline:)
         || aSelector == @selector(markedRange))
         return NO;
 
@@ -50,7 +50,7 @@
 {
     if (aSelector == @selector(insertText:))
         return @"insertText";
-    if (aSelector == @selector(setMarkedText:selectedFrom:length:))
+    if (aSelector == @selector(setMarkedText:selectedFrom:length:suppressUnderline:))
         return @"setMarkedText";
     if (aSelector == @selector(markedRange))
         return @"markedRange";
@@ -83,7 +83,7 @@
     [[webView mainFrame] confirmMarkedText:text];
 }
 
-- (void)setMarkedText:(NSString *)text selectedFrom:(NSInteger)selectionStart length:(NSInteger)selectionLength
+- (void)setMarkedText:(NSString *)text selectedFrom:(NSInteger)selectionStart length:(NSInteger)selectionLength suppressUnderline:(BOOL)suppressUnderline
 {
     if (selectionStart == -1)
         selectionStart = NSNotFound;

Modified: trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m (226752 => 226753)


--- trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m	2018-01-11 03:05:10 UTC (rev 226753)
@@ -223,7 +223,7 @@
 {
     if (aSelector == @selector(insertText:)
         || aSelector == @selector(doCommand:)
-        || aSelector == @selector(setMarkedText:selectedFrom:length:)
+        || aSelector == @selector(setMarkedText:selectedFrom:length:suppressUnderline:)
         || aSelector == @selector(unmarkText)
         || aSelector == @selector(hasMarkedText)
         || aSelector == @selector(conversationIdentifier)
@@ -249,7 +249,7 @@
         return @"insertText";
     if (aSelector == @selector(doCommand:))
         return @"doCommand";
-    if (aSelector == @selector(setMarkedText:selectedFrom:length:))
+    if (aSelector == @selector(setMarkedText:selectedFrom:length:suppressUnderline:))
         return @"setMarkedText";
     if (aSelector == @selector(substringFrom:length:))
         return @"substringFromRange";
@@ -312,7 +312,7 @@
         [textInput doCommandBySelector:NSSelectorFromString(aCommand)];
 }
 
-- (void)setMarkedText:(NSString *)aString selectedFrom:(int)from length:(int)length
+- (void)setMarkedText:(NSString *)aString selectedFrom:(int)from length:(int)length suppressUnderline:(BOOL)suppressUnderline
 {
     NSObject <NSTextInput> *textInput = [self textInput];
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl (226752 => 226753)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl	2018-01-11 03:05:10 UTC (rev 226753)
@@ -24,7 +24,7 @@
  */
 
 interface TextInputController {
-    void setMarkedText(DOMString string, long from, long length);
+    void setMarkedText(DOMString string, long from, long length, boolean suppressUnderline);
     boolean hasMarkedText();
     void unmarkText();
     void insertText(DOMString string);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp (226752 => 226753)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp	2018-01-11 03:05:10 UTC (rev 226753)
@@ -57,9 +57,9 @@
     setProperty(context, windowObject, "textInputController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
 }
 
-void TextInputController::setMarkedText(JSStringRef text, int from, int length)
+void TextInputController::setMarkedText(JSStringRef text, int from, int length, bool suppressUnderline)
 {
-    WKBundlePageSetComposition(InjectedBundle::singleton().page()->page(), toWK(text).get(), from, length);
+    WKBundlePageSetComposition(InjectedBundle::singleton().page()->page(), toWK(text).get(), from, length, suppressUnderline);
 }
 
 bool TextInputController::hasMarkedText()

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TextInputController.h (226752 => 226753)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TextInputController.h	2018-01-11 03:03:35 UTC (rev 226752)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TextInputController.h	2018-01-11 03:05:10 UTC (rev 226753)
@@ -40,7 +40,7 @@
 
     void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
 
-    void setMarkedText(JSStringRef text, int from, int length);
+    void setMarkedText(JSStringRef text, int from, int length, bool suppressUnderline);
     bool hasMarkedText();
     void unmarkText();
     void insertText(JSStringRef text);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to