Diff
Modified: branches/safari-602-branch/LayoutTests/ChangeLog (207923 => 207924)
--- branches/safari-602-branch/LayoutTests/ChangeLog 2016-10-26 23:18:13 UTC (rev 207923)
+++ branches/safari-602-branch/LayoutTests/ChangeLog 2016-10-26 23:18:17 UTC (rev 207924)
@@ -1,5 +1,20 @@
2016-10-26 Matthew Hanson <matthew_han...@apple.com>
+ Merge r207692. rdar://problem/28810751
+
+ 2016-10-20 Dean Jackson <d...@apple.com>
+
+ SVG should not paint selection within a mask
+ https://bugs.webkit.org/show_bug.cgi?id=163772
+ <rdar://problem/28705129>
+
+ Reviewed by Simon Fraser.
+
+ * svg/masking/mask-should-not-paint-selection-expected.html: Added.
+ * svg/masking/mask-should-not-paint-selection.html: Added.
+
+2016-10-26 Matthew Hanson <matthew_han...@apple.com>
+
Merge r207683. rdar://problem/28849627
2016-10-21 Zalan Bujtas <za...@apple.com>
Added: branches/safari-602-branch/LayoutTests/svg/masking/mask-should-not-paint-selection-expected.html (0 => 207924)
--- branches/safari-602-branch/LayoutTests/svg/masking/mask-should-not-paint-selection-expected.html (rev 0)
+++ branches/safari-602-branch/LayoutTests/svg/masking/mask-should-not-paint-selection-expected.html 2016-10-26 23:18:17 UTC (rev 207924)
@@ -0,0 +1,12 @@
+<body>
+<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <defs>
+ <mask id="m1" x="0" y="0" width="200" height="200">
+ <circle cx="100" cy="100" r="20" fill="white"/>
+ <text y="100" fill="white" font-size="50">
+ Text
+ </text>
+ </mask>
+ </defs>
+ <rect id="id1" mask="url(#m1)" x="10" y="10" width="180" height="180"/>
+</svg>
Added: branches/safari-602-branch/LayoutTests/svg/masking/mask-should-not-paint-selection.html (0 => 207924)
--- branches/safari-602-branch/LayoutTests/svg/masking/mask-should-not-paint-selection.html (rev 0)
+++ branches/safari-602-branch/LayoutTests/svg/masking/mask-should-not-paint-selection.html 2016-10-26 23:18:17 UTC (rev 207924)
@@ -0,0 +1,26 @@
+<style>
+text::selection{
+ color: blue;
+}
+</style>
+<script>
+window.addEventListener("load", function () {
+ var range = document.createRange();
+ var selection = document.getSelection()
+ range.setStart(m1, 0);
+ range.setEnd(id1, id1.childNodes.length);
+ selection.addRange(range);
+}, false);
+</script>
+<body>
+<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <defs>
+ <mask id="m1" x="0" y="0" width="200" height="200">
+ <circle cx="100" cy="100" r="20" fill="white"/>
+ <text y="100" fill="white" font-size="50">
+ Text
+ </text>
+ </mask>
+ </defs>
+ <rect id="id1" mask="url(#m1)" x="10" y="10" width="180" height="180"/>
+</svg>
Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (207923 => 207924)
--- branches/safari-602-branch/Source/WebCore/ChangeLog 2016-10-26 23:18:13 UTC (rev 207923)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog 2016-10-26 23:18:17 UTC (rev 207924)
@@ -1,5 +1,31 @@
2016-10-26 Matthew Hanson <matthew_han...@apple.com>
+ Merge r207692. rdar://problem/28810751
+
+ 2016-10-20 Dean Jackson <d...@apple.com>
+
+ SVG should not paint selection within a mask
+ https://bugs.webkit.org/show_bug.cgi?id=163772
+ <rdar://problem/28705129>
+
+ Reviewed by Simon Fraser.
+
+ When masking content, we shouldn't paint the text
+ selection as we are rendering into the masking
+ offscreen buffer.
+
+ Test: svg/masking/mask-should-not-paint-selection.html
+
+ * rendering/PaintPhase.h: Add a new behavior - PaintBehaviorSkipSelectionHighlight.
+ * rendering/svg/SVGInlineTextBox.cpp:
+ (WebCore::SVGInlineTextBox::paint): Don't update the selectionStyle if
+ PaintBehaviorSkipSelectionHighlight is true.
+ * rendering/svg/SVGRenderingContext.cpp:
+ (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Add PaintBehaviorSkipSelectionHighlight
+ to the PaintInfo.
+
+2016-10-26 Matthew Hanson <matthew_han...@apple.com>
+
Merge r207683. rdar://problem/28849627
2016-10-21 Zalan Bujtas <za...@apple.com>
Modified: branches/safari-602-branch/Source/WebCore/rendering/PaintPhase.h (207923 => 207924)
--- branches/safari-602-branch/Source/WebCore/rendering/PaintPhase.h 2016-10-26 23:18:13 UTC (rev 207923)
+++ branches/safari-602-branch/Source/WebCore/rendering/PaintPhase.h 2016-10-26 23:18:17 UTC (rev 207924)
@@ -54,15 +54,16 @@
};
enum PaintBehaviorFlags {
- PaintBehaviorNormal = 0,
- PaintBehaviorSelectionOnly = 1 << 0,
- PaintBehaviorForceBlackText = 1 << 1,
- PaintBehaviorForceWhiteText = 1 << 2,
- PaintBehaviorFlattenCompositingLayers = 1 << 3,
- PaintBehaviorRenderingSVGMask = 1 << 4,
- PaintBehaviorSkipRootBackground = 1 << 5,
- PaintBehaviorRootBackgroundOnly = 1 << 6,
- PaintBehaviorSelectionAndBackgroundsOnly = 1 << 7,
+ PaintBehaviorNormal = 0,
+ PaintBehaviorSelectionOnly = 1 << 0,
+ PaintBehaviorSkipSelectionHighlight = 1 << 1,
+ PaintBehaviorForceBlackText = 1 << 2,
+ PaintBehaviorForceWhiteText = 1 << 3,
+ PaintBehaviorFlattenCompositingLayers = 1 << 4,
+ PaintBehaviorRenderingSVGMask = 1 << 5,
+ PaintBehaviorSkipRootBackground = 1 << 6,
+ PaintBehaviorRootBackgroundOnly = 1 << 7,
+ PaintBehaviorSelectionAndBackgroundsOnly = 1 << 8,
};
typedef unsigned PaintBehavior;
Modified: branches/safari-602-branch/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (207923 => 207924)
--- branches/safari-602-branch/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp 2016-10-26 23:18:13 UTC (rev 207923)
+++ branches/safari-602-branch/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp 2016-10-26 23:18:17 UTC (rev 207924)
@@ -249,6 +249,7 @@
auto& parentRenderer = parent()->renderer();
bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection;
+ bool shouldPaintSelectionHighlight = !(paintInfo.paintBehavior & PaintBehaviorSkipSelectionHighlight);
bool hasSelection = !parentRenderer.document().printing() && selectionState() != RenderObject::SelectionNone;
if (!hasSelection && paintSelectedTextOnly)
return;
@@ -264,7 +265,7 @@
bool hasVisibleStroke = svgStyle.hasVisibleStroke();
const RenderStyle* selectionStyle = &style;
- if (hasSelection) {
+ if (hasSelection && shouldPaintSelectionHighlight) {
selectionStyle = parentRenderer.getCachedPseudoStyle(SELECTION);
if (selectionStyle) {
const SVGRenderStyle& svgSelectionStyle = selectionStyle->svgStyle();
Modified: branches/safari-602-branch/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (207923 => 207924)
--- branches/safari-602-branch/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2016-10-26 23:18:13 UTC (rev 207923)
+++ branches/safari-602-branch/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2016-10-26 23:18:17 UTC (rev 207924)
@@ -295,7 +295,9 @@
{
ASSERT(image);
- PaintInfo info(image->context(), LayoutRect::infiniteRect(), PaintPhaseForeground, PaintBehaviorNormal);
+ // Rendering into a buffer implies we're being used for masking, clipping, patterns or filters. In each of these
+ // cases we don't want to paint the selection.
+ PaintInfo info(image->context(), LayoutRect::infiniteRect(), PaintPhaseForeground, PaintBehaviorSkipSelectionHighlight);
AffineTransform& contentTransformation = currentContentTransformation();
AffineTransform savedContentTransformation = contentTransformation;
Modified: branches/safari-602-branch/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp (207923 => 207924)
--- branches/safari-602-branch/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp 2016-10-26 23:18:13 UTC (rev 207923)
+++ branches/safari-602-branch/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp 2016-10-26 23:18:17 UTC (rev 207924)
@@ -53,9 +53,10 @@
bool isPrinting = renderSVGText().document().printing();
bool hasSelection = !isPrinting && selectionState() != RenderObject::SelectionNone;
+ bool shouldPaintSelectionHighlight = !(paintInfo.paintBehavior & PaintBehaviorSkipSelectionHighlight);
PaintInfo childPaintInfo(paintInfo);
- if (hasSelection) {
+ if (hasSelection && shouldPaintSelectionHighlight) {
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
if (is<SVGInlineTextBox>(*child))
downcast<SVGInlineTextBox>(*child).paintSelectionBackground(childPaintInfo);