Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2335253002: Push CompositorFilterOperations creation out of GraphicsLayer (Closed)
Patch Set: The right FilterOperations Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "core/paint/BoxReflectionUtils.h" 74 #include "core/paint/BoxReflectionUtils.h"
75 #include "core/paint/FilterEffectBuilder.h" 75 #include "core/paint/FilterEffectBuilder.h"
76 #include "core/paint/ObjectPaintInvalidator.h" 76 #include "core/paint/ObjectPaintInvalidator.h"
77 #include "core/paint/PaintTiming.h" 77 #include "core/paint/PaintTiming.h"
78 #include "platform/LengthFunctions.h" 78 #include "platform/LengthFunctions.h"
79 #include "platform/RuntimeEnabledFeatures.h" 79 #include "platform/RuntimeEnabledFeatures.h"
80 #include "platform/TraceEvent.h" 80 #include "platform/TraceEvent.h"
81 #include "platform/geometry/FloatPoint3D.h" 81 #include "platform/geometry/FloatPoint3D.h"
82 #include "platform/geometry/FloatRect.h" 82 #include "platform/geometry/FloatRect.h"
83 #include "platform/geometry/TransformState.h" 83 #include "platform/geometry/TransformState.h"
84 #include "platform/graphics/CompositorFilterOperations.h"
84 #include "platform/graphics/filters/Filter.h" 85 #include "platform/graphics/filters/Filter.h"
85 #include "platform/graphics/filters/SourceGraphic.h" 86 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
86 #include "platform/transforms/ScaleTransformOperation.h" 87 #include "platform/transforms/ScaleTransformOperation.h"
87 #include "platform/transforms/TransformationMatrix.h" 88 #include "platform/transforms/TransformationMatrix.h"
88 #include "platform/transforms/TranslateTransformOperation.h" 89 #include "platform/transforms/TranslateTransformOperation.h"
89 #include "public/platform/Platform.h"
90 #include "wtf/PtrUtil.h" 90 #include "wtf/PtrUtil.h"
91 #include "wtf/StdLibExtras.h" 91 #include "wtf/StdLibExtras.h"
92 #include "wtf/allocator/Partitions.h" 92 #include "wtf/allocator/Partitions.h"
93 #include "wtf/text/CString.h" 93 #include "wtf/text/CString.h"
94 94
95 namespace blink { 95 namespace blink {
96 96
97 namespace { 97 namespace {
98 98
99 static CompositingQueryMode gCompositingQueryMode = 99 static CompositingQueryMode gCompositingQueryMode =
(...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 bool PaintLayer::scrollsOverflow() const 2676 bool PaintLayer::scrollsOverflow() const
2677 { 2677 {
2678 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) 2678 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea())
2679 return scrollableArea->scrollsOverflow(); 2679 return scrollableArea->scrollsOverflow();
2680 2680
2681 return false; 2681 return false;
2682 } 2682 }
2683 2683
2684 namespace { 2684 namespace {
2685 2685
2686 FilterOperations computeFilterOperationsHandleReferenceFilters(const FilterOpera tions& filters, float effectiveZoom, Node* enclosingNode) 2686 FilterOperations resolveReferenceFilters(const FilterOperations& filters, float effectiveZoom, Node* enclosingNode)
2687 { 2687 {
2688 if (filters.hasReferenceFilter()) { 2688 if (filters.hasReferenceFilter()) {
2689 for (size_t i = 0; i < filters.size(); ++i) { 2689 for (size_t i = 0; i < filters.size(); ++i) {
2690 FilterOperation* filterOperation = filters.operations().at(i).get(); 2690 FilterOperation* filterOperation = filters.operations().at(i).get();
2691 if (filterOperation->type() != FilterOperation::REFERENCE) 2691 if (filterOperation->type() != FilterOperation::REFERENCE)
2692 continue; 2692 continue;
2693 ReferenceFilterOperation& referenceOperation = toReferenceFilterOper ation(*filterOperation); 2693 ReferenceFilterOperation& referenceOperation = toReferenceFilterOper ation(*filterOperation);
2694 // FIXME: Cache the Filter if it didn't change. 2694 // FIXME: Cache the Filter if it didn't change.
2695 Filter* referenceFilter = FilterEffectBuilder::buildReferenceFilter( referenceOperation, nullptr, nullptr, nullptr, *toElement(enclosingNode), nullpt r, effectiveZoom); 2695 Filter* referenceFilter = FilterEffectBuilder::buildReferenceFilter( referenceOperation, nullptr, nullptr, nullptr, *toElement(enclosingNode), nullpt r, effectiveZoom);
2696 referenceOperation.setFilter(referenceFilter); 2696 referenceOperation.setFilter(referenceFilter);
2697 } 2697 }
2698 } 2698 }
2699 return filters; 2699 return filters;
2700 } 2700 }
2701 2701
2702 } // unnamed namespace 2702 } // unnamed namespace
2703 2703
2704 FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style) const 2704 FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style) const
2705 { 2705 {
2706 FilterOperations filterOperations = style.filter(); 2706 FilterOperations filterOperations = style.filter();
2707 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()-> hasReflection() && layoutObject()->isBox()) { 2707 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()-> hasReflection() && layoutObject()->isBox()) {
2708 BoxReflection reflection = boxReflectionForPaintLayer(*this, style); 2708 BoxReflection reflection = boxReflectionForPaintLayer(*this, style);
2709 filterOperations.operations().append(BoxReflectFilterOperation::create(r eflection)); 2709 filterOperations.operations().append(BoxReflectFilterOperation::create(r eflection));
2710 } 2710 }
2711 return computeFilterOperationsHandleReferenceFilters(filterOperations, style .effectiveZoom(), enclosingNode()); 2711 return resolveReferenceFilters(filterOperations, style.effectiveZoom(), encl osingNode());
2712 } 2712 }
2713 2713
2714 FilterOperations PaintLayer::computeBackdropFilterOperations(const ComputedStyle & style) const 2714 CompositorFilterOperations PaintLayer::createCompositorFilterOperationsForFilter (const ComputedStyle& style)
2715 { 2715 {
2716 return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(), style.effectiveZoom(), enclosingNode()); 2716 return SkiaImageFilterBuilder::buildFilterOperations(computeFilterOperations (style));
2717 }
2718
2719 CompositorFilterOperations PaintLayer::createCompositorFilterOperationsForBackdr opFilter(const ComputedStyle& style)
2720 {
2721 FilterOperations operations = resolveReferenceFilters(style.backdropFilter() , style.effectiveZoom(), enclosingNode());
2722 return SkiaImageFilterBuilder::buildFilterOperations(operations);
2717 } 2723 }
2718 2724
2719 PaintLayerFilterInfo& PaintLayer::ensureFilterInfo() 2725 PaintLayerFilterInfo& PaintLayer::ensureFilterInfo()
2720 { 2726 {
2721 PaintLayerRareData& rareData = ensureRareData(); 2727 PaintLayerRareData& rareData = ensureRareData();
2722 if (!rareData.filterInfo) 2728 if (!rareData.filterInfo)
2723 rareData.filterInfo = new PaintLayerFilterInfo(this); 2729 rareData.filterInfo = new PaintLayerFilterInfo(this);
2724 return *rareData.filterInfo; 2730 return *rareData.filterInfo;
2725 } 2731 }
2726 2732
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2980 2986
2981 void showLayerTree(const blink::LayoutObject* layoutObject) 2987 void showLayerTree(const blink::LayoutObject* layoutObject)
2982 { 2988 {
2983 if (!layoutObject) { 2989 if (!layoutObject) {
2984 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2990 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2985 return; 2991 return;
2986 } 2992 }
2987 showLayerTree(layoutObject->enclosingLayer()); 2993 showLayerTree(layoutObject->enclosingLayer());
2988 } 2994 }
2989 #endif 2995 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698