Diff
Modified: branches/safari-609.1.17.0-branch/LayoutTests/ChangeLog (256553 => 256554)
--- branches/safari-609.1.17.0-branch/LayoutTests/ChangeLog 2020-02-13 22:52:46 UTC (rev 256553)
+++ branches/safari-609.1.17.0-branch/LayoutTests/ChangeLog 2020-02-13 22:52:49 UTC (rev 256554)
@@ -1,5 +1,67 @@
2020-02-13 Russell Epstein <repst...@apple.com>
+ Cherry-pick r256485. rdar://problem/59430261
+
+ Composition highlight rects should be rounded and inset
+ https://bugs.webkit.org/show_bug.cgi?id=207655
+ <rdar://problem/59362474>
+
+ Reviewed by Tim Horton.
+
+ Source/WebCore:
+
+ Apply a couple of minor adjustments to the appearance of composition highlight rects that appear behind marked
+ text, in the case where the client specifies attributed marked text with background colors.
+
+ Test: editing/input/composition-highlights.html
+
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintMarkedTextBackground):
+ (WebCore::InlineTextBox::paintCompositionBackground):
+
+ In the case where custom composition rects are specified, add a half-pixel inset to all sides of the background
+ rect, and add a slight corner radius around each background rect.
+
+ * rendering/InlineTextBox.h:
+
+ Source/WebKit:
+
+ Stitch adjacent highlight rects together if they have the same highlight color; this minimizes the number of
+ composition highlight rects we hand to the web process when changing the marked text.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (compositionHighlights):
+
+ LayoutTests:
+
+ Make this existing layout test work with the new composition highlight appearance by covering up the edges of
+ the composition highlight rect with a black border. Due to subpixel insets around the composition highlight
+ rect, the reference image would be offset by a half pixel without this change (even when changing the spans to
+ have a `border-radius`).
+
+ * editing/input/composition-highlights-expected.html:
+ * editing/input/composition-highlights.html:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-02-12 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Composition highlight rects should be rounded and inset
+ https://bugs.webkit.org/show_bug.cgi?id=207655
+ <rdar://problem/59362474>
+
+ Reviewed by Tim Horton.
+
+ Make this existing layout test work with the new composition highlight appearance by covering up the edges of
+ the composition highlight rect with a black border. Due to subpixel insets around the composition highlight
+ rect, the reference image would be offset by a half pixel without this change (even when changing the spans to
+ have a `border-radius`).
+
+ * editing/input/composition-highlights-expected.html:
+ * editing/input/composition-highlights.html:
+
+2020-02-13 Russell Epstein <repst...@apple.com>
+
Cherry-pick r255603. rdar://problem/59299321
[iOS 13] Dragging on-screen volume control on a YouTube video selects text around the panel
Modified: branches/safari-609.1.17.0-branch/LayoutTests/editing/input/composition-highlights-expected.html (256553 => 256554)
--- branches/safari-609.1.17.0-branch/LayoutTests/editing/input/composition-highlights-expected.html 2020-02-13 22:52:46 UTC (rev 256553)
+++ branches/safari-609.1.17.0-branch/LayoutTests/editing/input/composition-highlights-expected.html 2020-02-13 22:52:49 UTC (rev 256554)
@@ -3,15 +3,59 @@
<head>
<style>
div[contenteditable] {
+ top: 0;
+ left: 0;
+ position: absolute;
font-size: 20px;
}
+
+.container {
+ position: relative;
+}
+
+#red, #green, #blue {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ z-index: -1;
+ box-sizing: border-box;
+}
+
#red { background-color: #FF000033; }
#green { background-color: #00FF0033; }
#blue { background-color: #0000FF33; }
+
+#overlay {
+ position: fixed;
+ font-size: 20px;
+ visibility: hidden;
+ top: 0;
+ left: 0;
+}
+
+.container {
+ position: relative;
+}
+
+.box {
+ visibility: visible;
+ width: calc(100% + 4px);
+ height: calc(100% + 4px);
+ border: 4px solid black;
+ box-sizing: border-box;
+ left: -2px;
+ top: -2px;
+ position: absolute;
+}
+
+.description {
+ margin-top: 100px;
+}
</style>
</head>
<body>
-This test verifies that highlights can be specified when setting marked text.
-<div contenteditable>Test: <span id="red">one</span><span id="green">two</span><span id="blue">three</span></div>
+<div contenteditable>Test <span class="container"><span id="red"></span>one</span><span class="container"><span id="green"></span>two</span><span class="container"><span id="blue"></span>three</span></div>
+<p class="description">This test verifies that highlights can be specified when setting marked text.</p>
+<div id="overlay">Test <span class="container"><span class="box"></span>one</span><span class="container"><span class="box"></span>two</span><span class="container"><span class="box"></span>three</span></div>
</body>
</html>
Modified: branches/safari-609.1.17.0-branch/LayoutTests/editing/input/composition-highlights.html (256553 => 256554)
--- branches/safari-609.1.17.0-branch/LayoutTests/editing/input/composition-highlights.html 2020-02-13 22:52:46 UTC (rev 256553)
+++ branches/safari-609.1.17.0-branch/LayoutTests/editing/input/composition-highlights.html 2020-02-13 22:52:49 UTC (rev 256554)
@@ -3,15 +3,46 @@
<head>
<style>
div[contenteditable] {
+ top: 0;
+ left: 0;
+ position: absolute;
font-size: 20px;
outline: none;
caret-color: transparent;
}
+
+#overlay {
+ position: fixed;
+ font-size: 20px;
+ visibility: hidden;
+ top: 0;
+ left: 0;
+}
+
+.container {
+ position: relative;
+}
+
+.box {
+ visibility: visible;
+ width: calc(100% + 4px);
+ height: calc(100% + 4px);
+ border: 4px solid black;
+ box-sizing: border-box;
+ left: -2px;
+ top: -2px;
+ position: absolute;
+}
+
+.description {
+ margin-top: 100px;
+}
</style>
</head>
<body>
-This test verifies that highlights can be specified when setting marked text.
-<div contenteditable>Test: </div>
+<div contenteditable>Test </div>
+<p class="description">This test verifies that highlights can be specified when setting marked text.</p>
+<div id="overlay">Test <span class="container"><span class="box"></span>one</span><span class="container"><span class="box"></span>two</span><span class="container"><span class="box"></span>three</span></div>
<script>
const editor = document.querySelector("div[contenteditable]");
Modified: branches/safari-609.1.17.0-branch/Source/WebCore/ChangeLog (256553 => 256554)
--- branches/safari-609.1.17.0-branch/Source/WebCore/ChangeLog 2020-02-13 22:52:46 UTC (rev 256553)
+++ branches/safari-609.1.17.0-branch/Source/WebCore/ChangeLog 2020-02-13 22:52:49 UTC (rev 256554)
@@ -1,5 +1,73 @@
2020-02-13 Russell Epstein <repst...@apple.com>
+ Cherry-pick r256485. rdar://problem/59430261
+
+ Composition highlight rects should be rounded and inset
+ https://bugs.webkit.org/show_bug.cgi?id=207655
+ <rdar://problem/59362474>
+
+ Reviewed by Tim Horton.
+
+ Source/WebCore:
+
+ Apply a couple of minor adjustments to the appearance of composition highlight rects that appear behind marked
+ text, in the case where the client specifies attributed marked text with background colors.
+
+ Test: editing/input/composition-highlights.html
+
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintMarkedTextBackground):
+ (WebCore::InlineTextBox::paintCompositionBackground):
+
+ In the case where custom composition rects are specified, add a half-pixel inset to all sides of the background
+ rect, and add a slight corner radius around each background rect.
+
+ * rendering/InlineTextBox.h:
+
+ Source/WebKit:
+
+ Stitch adjacent highlight rects together if they have the same highlight color; this minimizes the number of
+ composition highlight rects we hand to the web process when changing the marked text.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (compositionHighlights):
+
+ LayoutTests:
+
+ Make this existing layout test work with the new composition highlight appearance by covering up the edges of
+ the composition highlight rect with a black border. Due to subpixel insets around the composition highlight
+ rect, the reference image would be offset by a half pixel without this change (even when changing the spans to
+ have a `border-radius`).
+
+ * editing/input/composition-highlights-expected.html:
+ * editing/input/composition-highlights.html:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-02-12 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Composition highlight rects should be rounded and inset
+ https://bugs.webkit.org/show_bug.cgi?id=207655
+ <rdar://problem/59362474>
+
+ Reviewed by Tim Horton.
+
+ Apply a couple of minor adjustments to the appearance of composition highlight rects that appear behind marked
+ text, in the case where the client specifies attributed marked text with background colors.
+
+ Test: editing/input/composition-highlights.html
+
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintMarkedTextBackground):
+ (WebCore::InlineTextBox::paintCompositionBackground):
+
+ In the case where custom composition rects are specified, add a half-pixel inset to all sides of the background
+ rect, and add a slight corner radius around each background rect.
+
+ * rendering/InlineTextBox.h:
+
+2020-02-13 Russell Epstein <repst...@apple.com>
+
Cherry-pick r256005. rdar://problem/59299335
macCatalyst: Unnecessary I-beam over images in editable areas
Modified: branches/safari-609.1.17.0-branch/Source/WebCore/rendering/InlineTextBox.cpp (256553 => 256554)
--- branches/safari-609.1.17.0-branch/Source/WebCore/rendering/InlineTextBox.cpp 2020-02-13 22:52:46 UTC (rev 256553)
+++ branches/safari-609.1.17.0-branch/Source/WebCore/rendering/InlineTextBox.cpp 2020-02-13 22:52:49 UTC (rev 256554)
@@ -1086,7 +1086,7 @@
}
}
-void InlineTextBox::paintMarkedTextBackground(PaintInfo& paintInfo, const FloatPoint& boxOrigin, const Color& color, unsigned clampedStartOffset, unsigned clampedEndOffset)
+void InlineTextBox::paintMarkedTextBackground(PaintInfo& paintInfo, const FloatPoint& boxOrigin, const Color& color, unsigned clampedStartOffset, unsigned clampedEndOffset, MarkedTextBackgroundStyle style)
{
if (clampedStartOffset >= clampedEndOffset)
return;
@@ -1112,7 +1112,15 @@
lineFont().adjustSelectionRectForText(textRun, selectionRect, clampedStartOffset, clampedEndOffset);
// FIXME: Support painting combined text. See <https://bugs.webkit.org/show_bug.cgi?id=180993>.
- context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr()), color);
+ auto backgroundRect = snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr());
+ if (style == MarkedTextBackgroundStyle::Rounded) {
+ backgroundRect.expand(-1, -1);
+ backgroundRect.move(0.5, 0.5);
+ context.fillRoundedRect(FloatRoundedRect { backgroundRect, FloatRoundedRect::Radii { 2 } }, color);
+ return;
+ }
+
+ context.fillRect(backgroundRect, color);
}
void InlineTextBox::paintMarkedTextForeground(PaintInfo& paintInfo, const FloatRect& boxRect, const StyledMarkedText& markedText)
@@ -1225,7 +1233,7 @@
if (highlight.startOffset >= end())
break;
- paintMarkedTextBackground(paintInfo, boxOrigin, highlight.color, clampedOffset(highlight.startOffset), clampedOffset(highlight.endOffset));
+ paintMarkedTextBackground(paintInfo, boxOrigin, highlight.color, clampedOffset(highlight.startOffset), clampedOffset(highlight.endOffset), MarkedTextBackgroundStyle::Rounded);
if (highlight.endOffset > end())
break;
Modified: branches/safari-609.1.17.0-branch/Source/WebCore/rendering/InlineTextBox.h (256553 => 256554)
--- branches/safari-609.1.17.0-branch/Source/WebCore/rendering/InlineTextBox.h 2020-02-13 22:52:46 UTC (rev 256553)
+++ branches/safari-609.1.17.0-branch/Source/WebCore/rendering/InlineTextBox.h 2020-02-13 22:52:49 UTC (rev 256554)
@@ -193,7 +193,8 @@
void paintCompositionUnderlines(PaintInfo&, const FloatPoint& boxOrigin) const;
void paintCompositionUnderline(PaintInfo&, const FloatPoint& boxOrigin, const CompositionUnderline&) const;
- void paintMarkedTextBackground(PaintInfo&, const FloatPoint& boxOrigin, const Color&, unsigned clampedStartOffset, unsigned clampedEndOffset);
+ enum class MarkedTextBackgroundStyle : bool { Default, Rounded };
+ void paintMarkedTextBackground(PaintInfo&, const FloatPoint& boxOrigin, const Color&, unsigned clampedStartOffset, unsigned clampedEndOffset, MarkedTextBackgroundStyle = MarkedTextBackgroundStyle::Default);
void paintMarkedTextForeground(PaintInfo&, const FloatRect& boxRect, const StyledMarkedText&);
void paintMarkedTextDecoration(PaintInfo&, const FloatRect& boxRect, const FloatRect& clipOutRect, const StyledMarkedText&);
Modified: branches/safari-609.1.17.0-branch/Source/WebKit/ChangeLog (256553 => 256554)
--- branches/safari-609.1.17.0-branch/Source/WebKit/ChangeLog 2020-02-13 22:52:46 UTC (rev 256553)
+++ branches/safari-609.1.17.0-branch/Source/WebKit/ChangeLog 2020-02-13 22:52:49 UTC (rev 256554)
@@ -1,5 +1,65 @@
2020-02-13 Russell Epstein <repst...@apple.com>
+ Cherry-pick r256485. rdar://problem/59430261
+
+ Composition highlight rects should be rounded and inset
+ https://bugs.webkit.org/show_bug.cgi?id=207655
+ <rdar://problem/59362474>
+
+ Reviewed by Tim Horton.
+
+ Source/WebCore:
+
+ Apply a couple of minor adjustments to the appearance of composition highlight rects that appear behind marked
+ text, in the case where the client specifies attributed marked text with background colors.
+
+ Test: editing/input/composition-highlights.html
+
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintMarkedTextBackground):
+ (WebCore::InlineTextBox::paintCompositionBackground):
+
+ In the case where custom composition rects are specified, add a half-pixel inset to all sides of the background
+ rect, and add a slight corner radius around each background rect.
+
+ * rendering/InlineTextBox.h:
+
+ Source/WebKit:
+
+ Stitch adjacent highlight rects together if they have the same highlight color; this minimizes the number of
+ composition highlight rects we hand to the web process when changing the marked text.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (compositionHighlights):
+
+ LayoutTests:
+
+ Make this existing layout test work with the new composition highlight appearance by covering up the edges of
+ the composition highlight rect with a black border. Due to subpixel insets around the composition highlight
+ rect, the reference image would be offset by a half pixel without this change (even when changing the spans to
+ have a `border-radius`).
+
+ * editing/input/composition-highlights-expected.html:
+ * editing/input/composition-highlights.html:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-02-12 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Composition highlight rects should be rounded and inset
+ https://bugs.webkit.org/show_bug.cgi?id=207655
+ <rdar://problem/59362474>
+
+ Reviewed by Tim Horton.
+
+ Stitch adjacent highlight rects together if they have the same highlight color; this minimizes the number of
+ composition highlight rects we hand to the web process when changing the marked text.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (compositionHighlights):
+
+2020-02-13 Russell Epstein <repst...@apple.com>
+
Cherry-pick r256433. rdar://problem/59412971
macCatalyst: Unable to grab scrollbar on editable text field
Modified: branches/safari-609.1.17.0-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (256553 => 256554)
--- branches/safari-609.1.17.0-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-02-13 22:52:46 UTC (rev 256553)
+++ branches/safari-609.1.17.0-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-02-13 22:52:49 UTC (rev 256554)
@@ -4527,7 +4527,25 @@
highlightColor = WebCore::colorFromUIColor(uiColor);
highlights.append({ static_cast<unsigned>(range.location), static_cast<unsigned>(NSMaxRange(range)), highlightColor });
}];
- return highlights;
+
+ std::sort(highlights.begin(), highlights.end(), [](auto& a, auto& b) {
+ if (a.startOffset < b.startOffset)
+ return true;
+ if (a.startOffset > b.startOffset)
+ return false;
+ return a.endOffset < b.endOffset;
+ });
+
+ Vector<WebCore::CompositionHighlight> mergedHighlights;
+ mergedHighlights.reserveInitialCapacity(highlights.size());
+ for (auto& highlight : highlights) {
+ if (mergedHighlights.isEmpty() || mergedHighlights.last().color != highlight.color)
+ mergedHighlights.append(highlight);
+ else
+ mergedHighlights.last().endOffset = highlight.endOffset;
+ }
+
+ return mergedHighlights;
}
- (void)setAttributedMarkedText:(NSAttributedString *)markedText selectedRange:(NSRange)selectedRange