| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 | 734 |
| 735 // Now do a paint with the root layer shifted to be us. | 735 // Now do a paint with the root layer shifted to be us. |
| 736 LayerPaintingInfo transformedPaintingInfo(layer(), enclosingIntRect(transfor
m.inverse().mapRect(paintingInfo.paintDirtyRect)), | 736 LayerPaintingInfo transformedPaintingInfo(layer(), enclosingIntRect(transfor
m.inverse().mapRect(paintingInfo.paintDirtyRect)), |
| 737 adjustedSubPixelAccumulation); | 737 adjustedSubPixelAccumulation); |
| 738 paintLayerContents(context, transformedPaintingInfo); | 738 paintLayerContents(context, transformedPaintingInfo); |
| 739 | 739 |
| 740 // Restore the clip. | 740 // Restore the clip. |
| 741 layer()->parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRec
t); | 741 layer()->parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRec
t); |
| 742 } | 742 } |
| 743 | 743 |
| 744 static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer* roo
tLayer, const LayoutSize& subPixelAccumulation); |
| 745 |
| 746 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons
t RenderLayer* layer, const RenderLayer* rootLayer, |
| 747 const LayoutSize& subPixelAccumulation) |
| 748 { |
| 749 // Note: we don't have to walk z-order lists since transparent elements alwa
ys establish |
| 750 // a stacking container. This means we can just walk the layer tree directly
. |
| 751 for (RenderLayer* curr = layer->firstChild(); curr; curr = curr->nextSibling
()) |
| 752 clipRect.unite(transparencyClipBox(curr, rootLayer, subPixelAccumulation
)); |
| 753 } |
| 754 |
| 755 static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLaye
r* rootLayer, |
| 756 const LayoutSize& subPixelAccumulation) |
| 757 { |
| 758 // FIXME: Although this function completely ignores CSS-imposed clipping, we
did already intersect with the |
| 759 // paintDirtyRect, and that should cut down on the amount we have to paint.
Still it |
| 760 // would be better to respect clips. |
| 761 |
| 762 if (rootLayer != layer && layer->transform()) { |
| 763 // The best we can do here is to use enclosed bounding boxes to establis
h a "fuzzy" enough clip to encompass |
| 764 // the transformed layer and all of its children. |
| 765 const RenderLayer* rootLayerForTransform = rootLayer; |
| 766 LayoutPoint delta; |
| 767 layer->convertToLayerCoords(rootLayerForTransform, delta); |
| 768 |
| 769 delta.move(subPixelAccumulation); |
| 770 IntPoint pixelSnappedDelta = roundedIntPoint(delta); |
| 771 TransformationMatrix transform; |
| 772 transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y()); |
| 773 transform = transform * *layer->transform(); |
| 774 |
| 775 // We don't use fragment boxes when collecting a transformed layer's bou
nding box, since it always |
| 776 // paints unfragmented.y |
| 777 LayoutRect clipRect = layer->physicalBoundingBox(layer); |
| 778 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, subPix
elAccumulation); |
| 779 layer->renderer()->style()->filterOutsets().expandRect(clipRect); |
| 780 LayoutRect result = transform.mapRect(clipRect); |
| 781 return result; |
| 782 } |
| 783 |
| 784 LayoutRect clipRect = layer->physicalBoundingBox(rootLayer); |
| 785 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, subPix
elAccumulation); |
| 786 layer->renderer()->style()->filterOutsets().expandRect(clipRect); |
| 787 clipRect.move(subPixelAccumulation); |
| 788 return clipRect; |
| 789 } |
| 790 |
| 744 void RenderBox::paintLayerContents(GraphicsContext* context, const LayerPainting
Info& paintingInfo) | 791 void RenderBox::paintLayerContents(GraphicsContext* context, const LayerPainting
Info& paintingInfo) |
| 745 { | 792 { |
| 746 float deviceScaleFactor = blink::deviceScaleFactor(frame()); | 793 float deviceScaleFactor = blink::deviceScaleFactor(frame()); |
| 747 context->setDeviceScaleFactor(deviceScaleFactor); | 794 context->setDeviceScaleFactor(deviceScaleFactor); |
| 748 | 795 |
| 749 LayoutPoint offsetFromRoot; | 796 LayoutPoint offsetFromRoot; |
| 750 layer()->convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 797 layer()->convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
| 751 | 798 |
| 752 LayerPaintingInfo localPaintingInfo(paintingInfo); | 799 LayerPaintingInfo localPaintingInfo(paintingInfo); |
| 753 | 800 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 781 if (!rootRelativeBoundsComputed) { | 828 if (!rootRelativeBoundsComputed) { |
| 782 rootRelativeBounds = layer()->physicalBoundingBoxIncludingRe
flectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 829 rootRelativeBounds = layer()->physicalBoundingBoxIncludingRe
flectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 783 rootRelativeBoundsComputed = true; | 830 rootRelativeBoundsComputed = true; |
| 784 } | 831 } |
| 785 | 832 |
| 786 context->clipPath(clipPath->path(rootRelativeBounds), clipPath->
windRule()); | 833 context->clipPath(clipPath->path(rootRelativeBounds), clipPath->
windRule()); |
| 787 } | 834 } |
| 788 } | 835 } |
| 789 } | 836 } |
| 790 | 837 |
| 791 if (layer()->isTransparent()) | 838 if (layer()->isTransparent()) { |
| 792 layer()->beginTransparencyLayers(context, localPaintingInfo.rootLayer, p
aintingInfo.paintDirtyRect, localPaintingInfo.subPixelAccumulation); | 839 context->save(); |
| 840 LayoutRect clipRect = intersection(paintingInfo.paintDirtyRect, |
| 841 transparencyClipBox(layer(), localPaintingInfo.rootLayer, localPaint
ingInfo.subPixelAccumulation)); |
| 842 context->clip(clipRect); |
| 843 context->beginTransparencyLayer(opacity()); |
| 844 } |
| 793 | 845 |
| 794 layer()->clipToRect(localPaintingInfo, context, contentRect); | 846 layer()->clipToRect(localPaintingInfo, context, contentRect); |
| 795 | 847 |
| 796 FilterEffectRendererHelper filterPainter(layer()->filterRenderer() && layer(
)->paintsWithFilters()); | 848 FilterEffectRendererHelper filterPainter(layer()->filterRenderer() && layer(
)->paintsWithFilters()); |
| 797 | 849 |
| 798 if (filterPainter.haveFilterEffect()) { | 850 if (filterPainter.haveFilterEffect()) { |
| 799 ASSERT(layer()->filterInfo()); | 851 ASSERT(layer()->filterInfo()); |
| 800 | 852 |
| 801 if (!rootRelativeBoundsComputed) | 853 if (!rootRelativeBoundsComputed) |
| 802 rootRelativeBounds = layer()->physicalBoundingBoxIncludingReflection
AndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 854 rootRelativeBounds = layer()->physicalBoundingBoxIncludingReflection
AndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| (...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2962 | 3014 |
| 2963 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3015 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 2964 { | 3016 { |
| 2965 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3017 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 2966 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3018 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 2967 ASSERT(hasBackground == style.hasBackground()); | 3019 ASSERT(hasBackground == style.hasBackground()); |
| 2968 hasBorder = style.hasBorder(); | 3020 hasBorder = style.hasBorder(); |
| 2969 } | 3021 } |
| 2970 | 3022 |
| 2971 } // namespace blink | 3023 } // namespace blink |
| OLD | NEW |