Changeset 170841 in webkit
- Timestamp:
- Jul 7, 2014 12:16:04 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r170837 r170841 1 2014-07-07 Ion Rosca <rosca@adobe.com> 2 3 [CSS Blending]The background images set on the root element will blend on an initial white backdrop. 4 https://bugs.webkit.org/show_bug.cgi?id=134342 5 6 Reviewed by Dean Jackson. 7 8 * css3/blending/background-blend-mode-body-image-expected.html: Added. 9 * css3/blending/background-blend-mode-body-image.html: Added. 10 * css3/blending/background-blend-mode-body-transparent-color-and-image-expected.html: Added. 11 * css3/blending/background-blend-mode-body-transparent-color-and-image.html: Added. 12 * css3/blending/background-blend-mode-body-transparent-image-expected.html: Added. 13 * css3/blending/background-blend-mode-body-transparent-image.html: Added. 14 1 15 2014-07-06 Yoav Weiss <yoav@yoav.ws> 2 16 -
trunk/Source/WebCore/ChangeLog
r170837 r170841 1 2014-07-07 Ion Rosca <rosca@adobe.com> 2 3 [CSS Blending]The background images set on the root element will blend on an initial white backdrop. 4 https://bugs.webkit.org/show_bug.cgi?id=134342 5 6 Reviewed by Dean Jackson. 7 8 Tests: css3/blending/background-blend-mode-body-image.html 9 css3/blending/background-blend-mode-body-transparent-color-and-image.html 10 css3/blending/background-blend-mode-body-transparent-image.html 11 12 * rendering/RenderBox.cpp: 13 (WebCore::RenderBox::paintFillLayers): 14 If the background layers have blend modes, we paint the base background color first, 15 before starting a new transparency layer. After creating the transparency layer, 16 the base background will be skipped, and the background layers will blend on top of 17 a transparent backdrop. 18 (WebCore::RenderBox::paintFillLayer): 19 * rendering/RenderBox.h: 20 * rendering/RenderBoxModelObject.cpp: 21 (WebCore::RenderBoxModelObject::paintFillLayerExtended): 22 This method is able to paint only the base background color (BaseBackgroundColorOnly), 23 skipping the background-color and background-images. This option is available only 24 on bottom layer of the root renderer and only if the background color is not opaque, 25 otherwise the method will return early. 26 Another option is to paint the root background without using the base background color 27 (BaseBackgroundColorSkip). 28 * rendering/RenderBoxModelObject.h: 29 Adding the BaseBackgroundColorUsage enum. 30 1 31 2014-07-06 Yoav Weiss <yoav@yoav.ws> 2 32 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r170817 r170841 1566 1566 if (!context) 1567 1567 shouldDrawBackgroundInSeparateBuffer = false; 1568 if (shouldDrawBackgroundInSeparateBuffer) 1568 1569 BaseBackgroundColorUsage baseBgColorUsage = BaseBackgroundColorUse; 1570 1571 if (shouldDrawBackgroundInSeparateBuffer) { 1572 paintFillLayer(paintInfo, c, *layers.rbegin(), rect, bleedAvoidance, op, backgroundObject, BaseBackgroundColorOnly); 1573 baseBgColorUsage = BaseBackgroundColorSkip; 1569 1574 context->beginTransparencyLayer(1); 1575 } 1570 1576 1571 1577 Vector<const FillLayer*>::const_reverse_iterator topLayer = layers.rend(); 1572 1578 for (Vector<const FillLayer*>::const_reverse_iterator it = layers.rbegin(); it != topLayer; ++it) 1573 paintFillLayer(paintInfo, c, *it, rect, bleedAvoidance, op, backgroundObject );1579 paintFillLayer(paintInfo, c, *it, rect, bleedAvoidance, op, backgroundObject, baseBgColorUsage); 1574 1580 1575 1581 if (shouldDrawBackgroundInSeparateBuffer) … … 1578 1584 1579 1585 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, 1580 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderElement* backgroundObject )1581 { 1582 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, LayoutSize(), op, backgroundObject );1586 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderElement* backgroundObject, BaseBackgroundColorUsage baseBgColorUsage) 1587 { 1588 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, LayoutSize(), op, backgroundObject, baseBgColorUsage); 1583 1589 } 1584 1590 -
trunk/Source/WebCore/rendering/RenderBox.h
r169407 r170841 634 634 void paintBackground(const PaintInfo&, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone); 635 635 636 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderElement* backgroundObject );636 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderElement* backgroundObject, BaseBackgroundColorUsage = BaseBackgroundColorUse); 637 637 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderElement* backgroundObject = nullptr); 638 638 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r170774 r170841 619 619 620 620 void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const LayoutRect& rect, 621 BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* box, const LayoutSize& boxSize, CompositeOperator op, RenderElement* backgroundObject )621 BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* box, const LayoutSize& boxSize, CompositeOperator op, RenderElement* backgroundObject, BaseBackgroundColorUsage baseBgColorUsage) 622 622 { 623 623 GraphicsContext* context = paintInfo.context; … … 660 660 } 661 661 } 662 663 bool baseBgColorOnly = (baseBgColorUsage == BaseBackgroundColorOnly); 664 if (baseBgColorOnly && (!isRoot || bgLayer->next() || (bgColor.isValid() && !bgColor.hasAlpha()))) 665 return; 662 666 663 667 bool colorVisible = bgColor.isValid() && bgColor.alpha(); … … 802 806 Color baseColor; 803 807 bool shouldClearBackground = false; 804 if ( isOpaqueRoot) {808 if ((baseBgColorUsage != BaseBackgroundColorSkip) && isOpaqueRoot) { 805 809 baseColor = view().frameView().baseBackgroundColor(); 806 810 if (!baseColor.alpha()) … … 814 818 FloatRect backgroundRectForPainting = pixelSnappedForPainting(backgroundRect, deviceScaleFactor); 815 819 if (baseColor.alpha()) { 816 if ( bgColor.alpha())820 if (!baseBgColorOnly && bgColor.alpha()) 817 821 baseColor = baseColor.blend(bgColor); 818 822 819 823 context->fillRect(backgroundRectForPainting, baseColor, style().colorSpace(), CompositeCopy); 820 } else if ( bgColor.alpha()) {824 } else if (!baseBgColorOnly && bgColor.alpha()) { 821 825 CompositeOperator operation = shouldClearBackground ? CompositeCopy : context->compositeOperation(); 822 826 context->fillRect(backgroundRectForPainting, bgColor, style().colorSpace(), operation); … … 827 831 828 832 // no progressive loading of the background image 829 if ( shouldPaintBackgroundImage) {833 if (!baseBgColorOnly && shouldPaintBackgroundImage) { 830 834 BackgroundImageGeometry geometry; 831 835 calculateBackgroundImageGeometry(paintInfo.paintContainer, bgLayer, scrolledPaintRect, geometry, backgroundObject); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r169408 r170841 42 42 }; 43 43 44 enum BaseBackgroundColorUsage { 45 BaseBackgroundColorUse, 46 BaseBackgroundColorOnly, 47 BaseBackgroundColorSkip 48 }; 49 44 50 enum ContentChangeType { 45 51 ImageChanged, … … 171 177 bool paintNinePieceImage(GraphicsContext*, const LayoutRect&, const RenderStyle&, const NinePieceImage&, CompositeOperator = CompositeSourceOver); 172 178 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle&, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 173 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderElement* backgroundObject = 0 );179 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderElement* backgroundObject = 0, BaseBackgroundColorUsage = BaseBackgroundColorUse); 174 180 175 181 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox* = 0) const;
Note: See TracChangeset
for help on using the changeset viewer.