Changeset 207692 in webkit


Ignore:
Timestamp:
Oct 21, 2016 12:10:41 PM (7 years ago)
Author:
dino@apple.com
Message:

SVG should not paint selection within a mask
https://bugs.webkit.org/show_bug.cgi?id=163772
<rdar://problem/28705129>

Reviewed by Simon Fraser.

Source/WebCore:

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.

LayoutTests:

  • svg/masking/mask-should-not-paint-selection-expected.html: Added.
  • svg/masking/mask-should-not-paint-selection.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207683 r207692  
     12016-10-20  Dean Jackson  <dino@apple.com>
     2
     3        SVG should not paint selection within a mask
     4        https://bugs.webkit.org/show_bug.cgi?id=163772
     5        <rdar://problem/28705129>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * svg/masking/mask-should-not-paint-selection-expected.html: Added.
     10        * svg/masking/mask-should-not-paint-selection.html: Added.
     11
    1122016-10-21  Zalan Bujtas  <zalan@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r207690 r207692  
     12016-10-20  Dean Jackson  <dino@apple.com>
     2
     3        SVG should not paint selection within a mask
     4        https://bugs.webkit.org/show_bug.cgi?id=163772
     5        <rdar://problem/28705129>
     6
     7        Reviewed by Simon Fraser.
     8
     9        When masking content, we shouldn't paint the text
     10        selection as we are rendering into the masking
     11        offscreen buffer.
     12
     13        Test: svg/masking/mask-should-not-paint-selection.html
     14
     15        * rendering/PaintPhase.h: Add a new behavior - PaintBehaviorSkipSelectionHighlight.
     16        * rendering/svg/SVGInlineTextBox.cpp:
     17        (WebCore::SVGInlineTextBox::paint): Don't update the selectionStyle if
     18        PaintBehaviorSkipSelectionHighlight is true.
     19        * rendering/svg/SVGRenderingContext.cpp:
     20        (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Add PaintBehaviorSkipSelectionHighlight
     21        to the PaintInfo.
     22
    1232016-10-21  Chris Dumez  <cdumez@apple.com>
    224
  • trunk/Source/WebCore/rendering/PaintPhase.h

    r186956 r207692  
    5555
    5656enum PaintBehaviorFlags {
    57     PaintBehaviorNormal = 0,
    58     PaintBehaviorSelectionOnly = 1 << 0,
    59     PaintBehaviorForceBlackText = 1 << 1,
    60     PaintBehaviorForceWhiteText = 1 << 2,
    61     PaintBehaviorFlattenCompositingLayers = 1 << 3,
    62     PaintBehaviorRenderingSVGMask = 1 << 4,
    63     PaintBehaviorSkipRootBackground = 1 << 5,
    64     PaintBehaviorRootBackgroundOnly = 1 << 6,
    65     PaintBehaviorSelectionAndBackgroundsOnly = 1 << 7,
     57    PaintBehaviorNormal                      = 0,
     58    PaintBehaviorSelectionOnly               = 1 << 0,
     59    PaintBehaviorSkipSelectionHighlight      = 1 << 1,
     60    PaintBehaviorForceBlackText              = 1 << 2,
     61    PaintBehaviorForceWhiteText              = 1 << 3,
     62    PaintBehaviorFlattenCompositingLayers    = 1 << 4,
     63    PaintBehaviorRenderingSVGMask            = 1 << 5,
     64    PaintBehaviorSkipRootBackground          = 1 << 6,
     65    PaintBehaviorRootBackgroundOnly          = 1 << 7,
     66    PaintBehaviorSelectionAndBackgroundsOnly = 1 << 8,
    6667};
    6768
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r205282 r207692  
    248248
    249249    bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection;
     250    bool shouldPaintSelectionHighlight = !(paintInfo.paintBehavior & PaintBehaviorSkipSelectionHighlight);
    250251    bool hasSelection = !parentRenderer.document().printing() && selectionState() != RenderObject::SelectionNone;
    251252    if (!hasSelection && paintSelectedTextOnly)
     
    263264
    264265    const RenderStyle* selectionStyle = &style;
    265     if (hasSelection) {
     266    if (hasSelection && shouldPaintSelectionHighlight) {
    266267        selectionStyle = parentRenderer.getCachedPseudoStyle(SELECTION);
    267268        if (selectionStyle) {
  • trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp

    r202927 r207692  
    296296    ASSERT(image);
    297297
    298     PaintInfo info(image->context(), LayoutRect::infiniteRect(), PaintPhaseForeground, PaintBehaviorNormal);
     298    // Rendering into a buffer implies we're being used for masking, clipping, patterns or filters. In each of these
     299    // cases we don't want to paint the selection.
     300    PaintInfo info(image->context(), LayoutRect::infiniteRect(), PaintPhaseForeground, PaintBehaviorSkipSelectionHighlight);
    299301
    300302    AffineTransform& contentTransformation = currentContentTransformation();
  • trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp

    r192020 r207692  
    5454    bool isPrinting = renderSVGText().document().printing();
    5555    bool hasSelection = !isPrinting && selectionState() != RenderObject::SelectionNone;
     56    bool shouldPaintSelectionHighlight = !(paintInfo.paintBehavior & PaintBehaviorSkipSelectionHighlight);
    5657
    5758    PaintInfo childPaintInfo(paintInfo);
    58     if (hasSelection) {
     59    if (hasSelection && shouldPaintSelectionHighlight) {
    5960        for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
    6061            if (is<SVGInlineTextBox>(*child))
Note: See TracChangeset for help on using the changeset viewer.