OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1099 IntPoint pixelSnappedDelta = roundedIntPoint(delta); | 1099 IntPoint pixelSnappedDelta = roundedIntPoint(delta); |
1100 TransformationMatrix transform; | 1100 TransformationMatrix transform; |
1101 transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y()); | 1101 transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y()); |
1102 if (layer->transform()) | 1102 if (layer->transform()) |
1103 transform = transform * *layer->transform(); | 1103 transform = transform * *layer->transform(); |
1104 | 1104 |
1105 // We don't use fragment boxes when collecting a transformed layer's bou nding box, since it always | 1105 // We don't use fragment boxes when collecting a transformed layer's bou nding box, since it always |
1106 // paints unfragmented. | 1106 // paints unfragmented. |
1107 LayoutRect clipRect = layer->physicalBoundingBox(LayoutPoint()); | 1107 LayoutRect clipRect = layer->physicalBoundingBox(LayoutPoint()); |
1108 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transp arencyBehavior, subPixelAccumulation, globalPaintFlags); | 1108 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transp arencyBehavior, subPixelAccumulation, globalPaintFlags); |
1109 LayoutRect result = enclosingLayoutRect(transform.mapRect(layer->mapRect ForFilter(FloatRect(clipRect)))); | 1109 LayoutRect result = enclosingLayoutRect(transform.mapRect(layer->mapRect ToAffectedFilterRegion(FloatRect(clipRect)))); |
1110 if (!paginationLayer) | 1110 if (!paginationLayer) |
1111 return result; | 1111 return result; |
1112 | 1112 |
1113 // We have to break up the transformed extent across our columns. | 1113 // We have to break up the transformed extent across our columns. |
1114 // Split our box up into the actual fragment boxes that layout in the co lumns/pages and unite those together to | 1114 // Split our box up into the actual fragment boxes that layout in the co lumns/pages and unite those together to |
1115 // get our true bounding box. | 1115 // get our true bounding box. |
1116 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(paginationLay er->layoutObject()); | 1116 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(paginationLay er->layoutObject()); |
1117 result = enclosingFlowThread->fragmentsBoundingBox(result); | 1117 result = enclosingFlowThread->fragmentsBoundingBox(result); |
1118 | 1118 |
1119 LayoutPoint rootLayerDelta; | 1119 LayoutPoint rootLayerDelta; |
1120 paginationLayer->convertToLayerCoords(rootLayer, rootLayerDelta); | 1120 paginationLayer->convertToLayerCoords(rootLayer, rootLayerDelta); |
1121 result.moveBy(rootLayerDelta); | 1121 result.moveBy(rootLayerDelta); |
1122 return result; | 1122 return result; |
1123 } | 1123 } |
1124 | 1124 |
1125 LayoutRect clipRect = layer->shouldFragmentCompositedBounds(rootLayer) ? lay er->fragmentsBoundingBox(rootLayer) : layer->physicalBoundingBox(rootLayer); | 1125 LayoutRect clipRect = layer->shouldFragmentCompositedBounds(rootLayer) ? lay er->fragmentsBoundingBox(rootLayer) : layer->physicalBoundingBox(rootLayer); |
1126 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transp arencyBehavior, subPixelAccumulation, globalPaintFlags); | 1126 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transp arencyBehavior, subPixelAccumulation, globalPaintFlags); |
1127 clipRect = layer->mapLayoutRectForFilter(clipRect); | 1127 clipRect = layer->mapLayoutRectToAffectedFilterRegion(clipRect); |
1128 clipRect.move(subPixelAccumulation); | 1128 clipRect.move(subPixelAccumulation); |
1129 return clipRect; | 1129 return clipRect; |
1130 } | 1130 } |
1131 | 1131 |
1132 LayoutRect PaintLayer::paintingExtent(const PaintLayer* rootLayer, const LayoutS ize& subPixelAccumulation, GlobalPaintFlags globalPaintFlags) | 1132 LayoutRect PaintLayer::paintingExtent(const PaintLayer* rootLayer, const LayoutS ize& subPixelAccumulation, GlobalPaintFlags globalPaintFlags) |
1133 { | 1133 { |
1134 return transparencyClipBox(this, rootLayer, PaintingTransparencyClipBox, Roo tOfTransparencyClipBox, subPixelAccumulation, globalPaintFlags); | 1134 return transparencyClipBox(this, rootLayer, PaintingTransparencyClipBox, Roo tOfTransparencyClipBox, subPixelAccumulation, globalPaintFlags); |
1135 } | 1135 } |
1136 | 1136 |
1137 void* PaintLayer::operator new(size_t sz) | 1137 void* PaintLayer::operator new(size_t sz) |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2243 // children of the parent, that need to be included in reflected composi ted bounds. | 2243 // children of the parent, that need to be included in reflected composi ted bounds. |
2244 // Fix this by including composited bounds of stacking children of the r eflected Layer. | 2244 // Fix this by including composited bounds of stacking children of the r eflected Layer. |
2245 if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo( ) && parent()->reflectionInfo()->reflectionLayer() == this) | 2245 if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo( ) && parent()->reflectionInfo()->reflectionLayer() == this) |
2246 expandRectForReflectionAndStackingChildren(parent(), result, options ); | 2246 expandRectForReflectionAndStackingChildren(parent(), result, options ); |
2247 else | 2247 else |
2248 expandRectForReflectionAndStackingChildren(this, result, options); | 2248 expandRectForReflectionAndStackingChildren(this, result, options); |
2249 | 2249 |
2250 // Only enlarge by the filter outsets if we know the filter is going to be rendered in software. | 2250 // Only enlarge by the filter outsets if we know the filter is going to be rendered in software. |
2251 // Accelerated filters will handle their own outsets. | 2251 // Accelerated filters will handle their own outsets. |
2252 if (paintsWithFilters()) | 2252 if (paintsWithFilters()) |
2253 result = mapLayoutRectForFilter(result); | 2253 result = mapLayoutRectToAffectedFilterRegion(result); |
2254 } | 2254 } |
2255 | 2255 |
2256 if (transform() && (options == IncludeTransformsAndCompositedChildLayers || ((paintsWithTransform(GlobalPaintNormalPhase) && (this != ancestorLayer || optio ns == MaybeIncludeTransformForAncestorLayer))))) | 2256 if (transform() && (options == IncludeTransformsAndCompositedChildLayers || ((paintsWithTransform(GlobalPaintNormalPhase) && (this != ancestorLayer || optio ns == MaybeIncludeTransformForAncestorLayer))))) |
2257 result = transform()->mapRect(result); | 2257 result = transform()->mapRect(result); |
2258 | 2258 |
2259 if (shouldFragmentCompositedBounds(ancestorLayer)) { | 2259 if (shouldFragmentCompositedBounds(ancestorLayer)) { |
2260 convertFromFlowThreadToVisualBoundingBoxInAncestor(ancestorLayer, result ); | 2260 convertFromFlowThreadToVisualBoundingBoxInAncestor(ancestorLayer, result ); |
2261 return result; | 2261 return result; |
2262 } | 2262 } |
2263 LayoutPoint delta; | 2263 LayoutPoint delta; |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2734 } | 2734 } |
2735 | 2735 |
2736 FilterEffect* PaintLayer::lastFilterEffect() const | 2736 FilterEffect* PaintLayer::lastFilterEffect() const |
2737 { | 2737 { |
2738 FilterEffectBuilder* builder = updateFilterEffectBuilder(); | 2738 FilterEffectBuilder* builder = updateFilterEffectBuilder(); |
2739 if (!builder) | 2739 if (!builder) |
2740 return nullptr; | 2740 return nullptr; |
2741 return builder->lastEffect(); | 2741 return builder->lastEffect(); |
2742 } | 2742 } |
2743 | 2743 |
2744 FloatRect PaintLayer::mapRectForFilter(const FloatRect& rect) const | 2744 FloatRect PaintLayer::mapRectToAffectedFilterRegion(const FloatRect& rect) const |
2745 { | 2745 { |
2746 if (!hasFilterThatMovesPixels()) | 2746 if (!hasFilterThatMovesPixels()) |
2747 return rect; | 2747 return rect; |
2748 // Ensure the filter-chain is refreshed wrt reference filters. | 2748 // Ensure the filter-chain is refreshed wrt reference filters. |
2749 updateFilterEffectBuilder(); | 2749 updateFilterEffectBuilder(); |
2750 | 2750 |
2751 FilterOperations filterOperations = computeFilterOperations(layoutObject()-> styleRef()); | 2751 FilterOperations filterOperations = computeFilterOperations(layoutObject()-> styleRef()); |
2752 return filterOperations.mapRect(rect); | 2752 FloatRect filteredRect = filterOperations.mapRect(rect); |
2753 | |
2754 // Some reference filters (e.g., FETurbulence, FETile) have effect bounds | |
2755 // determined by the filter itself instead of the source rect. | |
2756 if (filterOperations.hasReferenceFilter()) { | |
2757 if (FilterEffect* lastEffect = lastFilterEffect()) | |
2758 filteredRect.unite(lastEffect->determineFilterPrimitiveSubregion(Map RectForward)); | |
Stephen White
2016/08/25 15:03:14
I think this is papering over the problem. I think
pdr.
2016/08/29 17:51:12
I've filed https://crbug.com/642035 as a brain-dum
| |
2759 } | |
2760 | |
2761 return filteredRect; | |
2753 } | 2762 } |
2754 | 2763 |
2755 LayoutRect PaintLayer::mapLayoutRectForFilter(const LayoutRect& rect) const | 2764 LayoutRect PaintLayer::mapLayoutRectToAffectedFilterRegion(const LayoutRect& rec t) const |
2756 { | 2765 { |
2757 if (!hasFilterThatMovesPixels()) | 2766 if (!hasFilterThatMovesPixels()) |
2758 return rect; | 2767 return rect; |
2759 return enclosingLayoutRect(mapRectForFilter(FloatRect(rect))); | 2768 return enclosingLayoutRect(mapRectToAffectedFilterRegion(FloatRect(rect))); |
2760 } | 2769 } |
2761 | 2770 |
2762 bool PaintLayer::hasFilterThatMovesPixels() const | 2771 bool PaintLayer::hasFilterThatMovesPixels() const |
2763 { | 2772 { |
2764 if (!hasFilterInducingProperty()) | 2773 if (!hasFilterInducingProperty()) |
2765 return false; | 2774 return false; |
2766 const ComputedStyle& style = layoutObject()->styleRef(); | 2775 const ComputedStyle& style = layoutObject()->styleRef(); |
2767 if (style.hasFilter() && style.filter().hasFilterThatMovesPixels()) | 2776 if (style.hasFilter() && style.filter().hasFilterThatMovesPixels()) |
2768 return true; | 2777 return true; |
2769 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && style.hasBoxRefl ect()) | 2778 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && style.hasBoxRefl ect()) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2935 | 2944 |
2936 void showLayerTree(const blink::LayoutObject* layoutObject) | 2945 void showLayerTree(const blink::LayoutObject* layoutObject) |
2937 { | 2946 { |
2938 if (!layoutObject) { | 2947 if (!layoutObject) { |
2939 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2948 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2940 return; | 2949 return; |
2941 } | 2950 } |
2942 showLayerTree(layoutObject->enclosingLayer()); | 2951 showLayerTree(layoutObject->enclosingLayer()); |
2943 } | 2952 } |
2944 #endif | 2953 #endif |
OLD | NEW |