Changeset 151555 in webkit


Ignore:
Timestamp:
Jun 13, 2013 9:50:40 AM (11 years ago)
Author:
mvujovic@adobe.com
Message:

[CSS Regions] -webkit-background-clip: text; does not clip the background in regions
https://bugs.webkit.org/show_bug.cgi?id=117566

Reviewed by Alexandru Chiculita.

Source/WebCore:

This patch enables -webkit-background-clip: text; on regions.

Test: fast/regions/webkit-background-clip-text.html

  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::paintFlowThreadPortionInRegion):

Force black text if we're in the text clip paint phase. This makes sure the text's alpha
channel does not affect the final opacity of the background clipping result. Rather,
the text's alpha channel affects the amount of blending between the text color
and the background.

  • rendering/RenderRegion.cpp:

(WebCore::shouldPaintRegionContentsInPhase):

Factor out a function to check if we should paint the region contents in a particular
phase. Add "PaintPhaseTextClip" so that we draw the contents in the text clipping phase.

(WebCore::RenderRegion::paintObject):

Call shouldPaintRegionContentsInPhase instead of doing the phase checks directly in this
function. Move, update, and clarify the surrounding comments.

LayoutTests:

  • fast/regions/webkit-background-clip-text-expected.html: Added.
  • fast/regions/webkit-background-clip-text.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r151549 r151555  
     12013-06-13  Max Vujovic  <mvujovic@adobe.com>
     2
     3        [CSS Regions] -webkit-background-clip: text; does not clip the background in regions
     4        https://bugs.webkit.org/show_bug.cgi?id=117566
     5
     6        Reviewed by Alexandru Chiculita.
     7
     8        * fast/regions/webkit-background-clip-text-expected.html: Added.
     9        * fast/regions/webkit-background-clip-text.html: Added.
     10
    1112013-06-13  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r151554 r151555  
     12013-06-13  Max Vujovic  <mvujovic@adobe.com>
     2
     3        [CSS Regions] -webkit-background-clip: text; does not clip the background in regions
     4        https://bugs.webkit.org/show_bug.cgi?id=117566
     5
     6        Reviewed by Alexandru Chiculita.
     7
     8        This patch enables -webkit-background-clip: text; on regions.
     9
     10        Test: fast/regions/webkit-background-clip-text.html
     11
     12        * rendering/RenderFlowThread.cpp:
     13        (WebCore::RenderFlowThread::paintFlowThreadPortionInRegion):
     14            Force black text if we're in the text clip paint phase. This makes sure the text's alpha
     15            channel does not affect the final opacity of the background clipping result. Rather,
     16            the text's alpha channel affects the amount of blending between the text color
     17            and the background.
     18        * rendering/RenderRegion.cpp:
     19        (WebCore::shouldPaintRegionContentsInPhase):
     20            Factor out a function to check if we should paint the region contents in a particular
     21            phase. Add "PaintPhaseTextClip" so that we draw the contents in the text clipping phase.
     22        (WebCore::RenderRegion::paintObject):
     23            Call shouldPaintRegionContentsInPhase instead of doing the phase checks directly in this
     24            function. Move, update, and clarify the surrounding comments.
     25
    1262013-06-13  Anton Obzhirov  <a.obzhirov@samsung.com>
    227
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r151309 r151555  
    304304        info.rect.moveBy(-adjustedPaintOffset);
    305305       
    306         layer()->paint(context, info.rect, 0, 0, region, RenderLayer::PaintLayerTemporaryClipRects);
     306        PaintBehavior paintBehavior = 0;
     307        if (info.phase == PaintPhaseTextClip)
     308            paintBehavior |= PaintBehaviorForceBlackText;
     309
     310        layer()->paint(context, info.rect, paintBehavior, 0, region, RenderLayer::PaintLayerTemporaryClipRects);
    307311
    308312        context->restore();
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r151554 r151555  
    152152}
    153153
     154static bool shouldPaintRegionContentsInPhase(PaintPhase phase)
     155{
     156    return phase == PaintPhaseBlockBackground
     157        || phase == PaintPhaseChildBlockBackground
     158        || phase == PaintPhaseSelection
     159        || phase == PaintPhaseTextClip;
     160}
     161
    154162void RenderRegion::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
    155163{
     
    162170        return;
    163171
    164     // Delegate painting of content in region to RenderFlowThread.
    165     // RenderFlowThread is a self painting layer (being a positioned object) who is painting its children, the collected objects.
    166     // Since we do not want to paint the flow thread content multiple times (for each painting phase of the region object),
    167     // we allow the flow thread painting only for the selection and the background phase.
    168     if (paintInfo.phase != PaintPhaseBlockBackground && paintInfo.phase != PaintPhaseChildBlockBackground && paintInfo.phase != PaintPhaseSelection)
    169         return;
    170 
     172    // We do not want to paint a region's contents multiple times (for each paint phase of the region object).
     173    // Thus, we only paint the region's contents in certain phases.
     174    if (!shouldPaintRegionContentsInPhase(paintInfo.phase))
     175        return;
     176
     177    // Delegate the painting of a region's contents to RenderFlowThread.
     178    // RenderFlowThread is a self painting layer because it's a positioned object.
     179    // RenderFlowThread paints its children, the collected objects.
    171180    setRegionObjectsRegionStyle();
    172181    m_flowThread->paintFlowThreadPortionInRegion(paintInfo, this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), LayoutPoint(paintOffset.x() + borderLeft() + paddingLeft(), paintOffset.y() + borderTop() + paddingTop()));
Note: See TracChangeset for help on using the changeset viewer.