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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/CSSPropertyNames.h" | 47 #include "core/CSSPropertyNames.h" |
48 #include "core/HTMLNames.h" | 48 #include "core/HTMLNames.h" |
49 #include "core/css/PseudoStyleRequest.h" | 49 #include "core/css/PseudoStyleRequest.h" |
50 #include "core/dom/Document.h" | 50 #include "core/dom/Document.h" |
51 #include "core/dom/shadow/ShadowRoot.h" | 51 #include "core/dom/shadow/ShadowRoot.h" |
52 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" | 52 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" |
53 #include "core/frame/FrameView.h" | 53 #include "core/frame/FrameView.h" |
54 #include "core/frame/LocalFrame.h" | 54 #include "core/frame/LocalFrame.h" |
55 #include "core/html/HTMLFrameElement.h" | 55 #include "core/html/HTMLFrameElement.h" |
56 #include "core/layout/ColumnInfo.h" | 56 #include "core/layout/ColumnInfo.h" |
57 #include "core/layout/FilterEffectRenderer.h" | |
58 #include "core/layout/HitTestRequest.h" | 57 #include "core/layout/HitTestRequest.h" |
59 #include "core/layout/HitTestResult.h" | 58 #include "core/layout/HitTestResult.h" |
60 #include "core/layout/HitTestingTransformState.h" | 59 #include "core/layout/HitTestingTransformState.h" |
61 #include "core/layout/LayoutFlowThread.h" | 60 #include "core/layout/LayoutFlowThread.h" |
62 #include "core/layout/LayoutGeometryMap.h" | 61 #include "core/layout/LayoutGeometryMap.h" |
63 #include "core/layout/LayoutInline.h" | 62 #include "core/layout/LayoutInline.h" |
64 #include "core/layout/LayoutPart.h" | 63 #include "core/layout/LayoutPart.h" |
65 #include "core/layout/LayoutReplica.h" | 64 #include "core/layout/LayoutReplica.h" |
66 #include "core/layout/LayoutScrollbar.h" | 65 #include "core/layout/LayoutScrollbar.h" |
67 #include "core/layout/LayoutScrollbarPart.h" | 66 #include "core/layout/LayoutScrollbarPart.h" |
68 #include "core/layout/LayoutTreeAsText.h" | 67 #include "core/layout/LayoutTreeAsText.h" |
69 #include "core/layout/LayoutView.h" | 68 #include "core/layout/LayoutView.h" |
70 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" | 69 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" |
71 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 70 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
72 #include "core/layout/svg/LayoutSVGRoot.h" | 71 #include "core/layout/svg/LayoutSVGRoot.h" |
73 #include "core/layout/svg/ReferenceFilterBuilder.h" | 72 #include "core/layout/svg/ReferenceFilterBuilder.h" |
74 #include "core/page/Page.h" | 73 #include "core/page/Page.h" |
75 #include "core/page/scrolling/ScrollingCoordinator.h" | 74 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 75 #include "core/paint/FilterEffectBuilder.h" |
76 #include "platform/LengthFunctions.h" | 76 #include "platform/LengthFunctions.h" |
77 #include "platform/RuntimeEnabledFeatures.h" | 77 #include "platform/RuntimeEnabledFeatures.h" |
78 #include "platform/TraceEvent.h" | 78 #include "platform/TraceEvent.h" |
79 #include "platform/geometry/FloatPoint3D.h" | 79 #include "platform/geometry/FloatPoint3D.h" |
80 #include "platform/geometry/FloatRect.h" | 80 #include "platform/geometry/FloatRect.h" |
81 #include "platform/geometry/TransformState.h" | 81 #include "platform/geometry/TransformState.h" |
82 #include "platform/graphics/filters/ReferenceFilter.h" | 82 #include "platform/graphics/filters/ReferenceFilter.h" |
83 #include "platform/graphics/filters/SourceGraphic.h" | 83 #include "platform/graphics/filters/SourceGraphic.h" |
84 #include "platform/transforms/ScaleTransformOperation.h" | 84 #include "platform/transforms/ScaleTransformOperation.h" |
85 #include "platform/transforms/TransformationMatrix.h" | 85 #include "platform/transforms/TransformationMatrix.h" |
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 } | 2545 } |
2546 | 2546 |
2547 void DeprecatedPaintLayer::ensureCompositedDeprecatedPaintLayerMapping() | 2547 void DeprecatedPaintLayer::ensureCompositedDeprecatedPaintLayerMapping() |
2548 { | 2548 { |
2549 if (m_compositedDeprecatedPaintLayerMapping) | 2549 if (m_compositedDeprecatedPaintLayerMapping) |
2550 return; | 2550 return; |
2551 | 2551 |
2552 m_compositedDeprecatedPaintLayerMapping = adoptPtr(new CompositedDeprecatedP
aintLayerMapping(*this)); | 2552 m_compositedDeprecatedPaintLayerMapping = adoptPtr(new CompositedDeprecatedP
aintLayerMapping(*this)); |
2553 m_compositedDeprecatedPaintLayerMapping->setNeedsGraphicsLayerUpdate(Graphic
sLayerUpdateSubtree); | 2553 m_compositedDeprecatedPaintLayerMapping->setNeedsGraphicsLayerUpdate(Graphic
sLayerUpdateSubtree); |
2554 | 2554 |
2555 updateOrRemoveFilterEffectRenderer(); | 2555 updateOrRemoveFilterEffectBuilder(); |
2556 } | 2556 } |
2557 | 2557 |
2558 void DeprecatedPaintLayer::clearCompositedDeprecatedPaintLayerMapping(bool layer
BeingDestroyed) | 2558 void DeprecatedPaintLayer::clearCompositedDeprecatedPaintLayerMapping(bool layer
BeingDestroyed) |
2559 { | 2559 { |
2560 if (!layerBeingDestroyed) { | 2560 if (!layerBeingDestroyed) { |
2561 // We need to make sure our decendants get a geometry update. In princip
le, | 2561 // We need to make sure our decendants get a geometry update. In princip
le, |
2562 // we could call setNeedsGraphicsLayerUpdate on our children, but that w
ould | 2562 // we could call setNeedsGraphicsLayerUpdate on our children, but that w
ould |
2563 // require walking the z-order lists to find them. Instead, we over-inva
lidate | 2563 // require walking the z-order lists to find them. Instead, we over-inva
lidate |
2564 // by marking our parent as needing a geometry update. | 2564 // by marking our parent as needing a geometry update. |
2565 if (DeprecatedPaintLayer* compositingParent = enclosingLayerWithComposit
edDeprecatedPaintLayerMapping(ExcludeSelf)) | 2565 if (DeprecatedPaintLayer* compositingParent = enclosingLayerWithComposit
edDeprecatedPaintLayerMapping(ExcludeSelf)) |
2566 compositingParent->compositedDeprecatedPaintLayerMapping()->setNeeds
GraphicsLayerUpdate(GraphicsLayerUpdateSubtree); | 2566 compositingParent->compositedDeprecatedPaintLayerMapping()->setNeeds
GraphicsLayerUpdate(GraphicsLayerUpdateSubtree); |
2567 } | 2567 } |
2568 | 2568 |
2569 m_compositedDeprecatedPaintLayerMapping.clear(); | 2569 m_compositedDeprecatedPaintLayerMapping.clear(); |
2570 | 2570 |
2571 if (!layerBeingDestroyed) | 2571 if (!layerBeingDestroyed) |
2572 updateOrRemoveFilterEffectRenderer(); | 2572 updateOrRemoveFilterEffectBuilder(); |
2573 } | 2573 } |
2574 | 2574 |
2575 void DeprecatedPaintLayer::setGroupedMapping(CompositedDeprecatedPaintLayerMappi
ng* groupedMapping, bool layerBeingDestroyed) | 2575 void DeprecatedPaintLayer::setGroupedMapping(CompositedDeprecatedPaintLayerMappi
ng* groupedMapping, bool layerBeingDestroyed) |
2576 { | 2576 { |
2577 if (groupedMapping == m_groupedMapping) | 2577 if (groupedMapping == m_groupedMapping) |
2578 return; | 2578 return; |
2579 | 2579 |
2580 if (!layerBeingDestroyed && m_groupedMapping) { | 2580 if (!layerBeingDestroyed && m_groupedMapping) { |
2581 m_groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree
); | 2581 m_groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree
); |
2582 m_groupedMapping->removeLayerFromSquashingGraphicsLayer(this); | 2582 m_groupedMapping->removeLayerFromSquashingGraphicsLayer(this); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2715 | 2715 |
2716 return hasBoxDecorationsOrBackground() || hasOverflowControls(); | 2716 return hasBoxDecorationsOrBackground() || hasOverflowControls(); |
2717 } | 2717 } |
2718 | 2718 |
2719 void DeprecatedPaintLayer::updateFilters(const ComputedStyle* oldStyle, const Co
mputedStyle& newStyle) | 2719 void DeprecatedPaintLayer::updateFilters(const ComputedStyle* oldStyle, const Co
mputedStyle& newStyle) |
2720 { | 2720 { |
2721 if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter())) | 2721 if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter())) |
2722 return; | 2722 return; |
2723 | 2723 |
2724 updateOrRemoveFilterClients(); | 2724 updateOrRemoveFilterClients(); |
2725 updateOrRemoveFilterEffectRenderer(); | 2725 updateOrRemoveFilterEffectBuilder(); |
2726 } | 2726 } |
2727 | 2727 |
2728 bool DeprecatedPaintLayer::attemptDirectCompositingUpdate(StyleDifference diff,
const ComputedStyle* oldStyle) | 2728 bool DeprecatedPaintLayer::attemptDirectCompositingUpdate(StyleDifference diff,
const ComputedStyle* oldStyle) |
2729 { | 2729 { |
2730 CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialComp
ositingReasonsFromStyle; | 2730 CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialComp
ositingReasonsFromStyle; |
2731 compositor()->updatePotentialCompositingReasonsFromStyle(this); | 2731 compositor()->updatePotentialCompositingReasonsFromStyle(this); |
2732 | 2732 |
2733 // This function implements an optimization for transforms and opacity. | 2733 // This function implements an optimization for transforms and opacity. |
2734 // A common pattern is for a touchmove handler to update the transform | 2734 // A common pattern is for a touchmove handler to update the transform |
2735 // and/or an opacity of an element every frame while the user moves their | 2735 // and/or an opacity of an element every frame while the user moves their |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2851 removeFilterInfoIfNeeded(); | 2851 removeFilterInfoIfNeeded(); |
2852 return; | 2852 return; |
2853 } | 2853 } |
2854 | 2854 |
2855 if (layoutObject()->style()->filter().hasReferenceFilter()) | 2855 if (layoutObject()->style()->filter().hasReferenceFilter()) |
2856 ensureFilterInfo()->updateReferenceFilterClients(layoutObject()->style()
->filter()); | 2856 ensureFilterInfo()->updateReferenceFilterClients(layoutObject()->style()
->filter()); |
2857 else if (hasFilterInfo()) | 2857 else if (hasFilterInfo()) |
2858 filterInfo()->removeReferenceFilterClients(); | 2858 filterInfo()->removeReferenceFilterClients(); |
2859 } | 2859 } |
2860 | 2860 |
2861 void DeprecatedPaintLayer::updateOrRemoveFilterEffectRenderer() | 2861 void DeprecatedPaintLayer::updateOrRemoveFilterEffectBuilder() |
2862 { | 2862 { |
2863 // FilterEffectRenderer is only used to render the filters in software mode, | 2863 // FilterEffectBuilder is only used to render the filters in software mode, |
2864 // so we always need to run updateOrRemoveFilterEffectRenderer after the com
posited | 2864 // so we always need to run updateOrRemoveFilterEffectBuilder after the comp
osited |
2865 // mode might have changed for this layer. | 2865 // mode might have changed for this layer. |
2866 if (!paintsWithFilters()) { | 2866 if (!paintsWithFilters()) { |
2867 // Don't delete the whole filter info here, because we might use it | 2867 // Don't delete the whole filter info here, because we might use it |
2868 // for loading CSS shader files. | 2868 // for loading CSS shader files. |
2869 if (DeprecatedPaintLayerFilterInfo* filterInfo = this->filterInfo()) | 2869 if (DeprecatedPaintLayerFilterInfo* filterInfo = this->filterInfo()) |
2870 filterInfo->setRenderer(nullptr); | 2870 filterInfo->setBuilder(nullptr); |
2871 | 2871 |
2872 return; | 2872 return; |
2873 } | 2873 } |
2874 | 2874 |
2875 DeprecatedPaintLayerFilterInfo* filterInfo = ensureFilterInfo(); | 2875 DeprecatedPaintLayerFilterInfo* filterInfo = ensureFilterInfo(); |
2876 if (!filterInfo->renderer()) { | 2876 if (!filterInfo->builder()) |
2877 RefPtrWillBeRawPtr<FilterEffectRenderer> filterRenderer = FilterEffectRe
nderer::create(); | 2877 filterInfo->setBuilder(FilterEffectBuilder::create()); |
2878 filterInfo->setRenderer(filterRenderer.release()); | |
2879 } | |
2880 | 2878 |
2881 // If the filter fails to build, remove it from the layer. It will still att
empt to | 2879 // If the filter fails to build, remove it from the layer. It will still att
empt to |
2882 // go through regular processing (e.g. compositing), but never apply anythin
g. | 2880 // go through regular processing (e.g. compositing), but never apply anythin
g. |
2883 if (!filterInfo->renderer()->build(layoutObject(), computeFilterOperations(l
ayoutObject()->styleRef()))) | 2881 if (!filterInfo->builder()->build(layoutObject(), computeFilterOperations(la
youtObject()->styleRef()))) |
2884 filterInfo->setRenderer(nullptr); | 2882 filterInfo->setBuilder(nullptr); |
2885 } | 2883 } |
2886 | 2884 |
2887 void DeprecatedPaintLayer::filterNeedsPaintInvalidation() | 2885 void DeprecatedPaintLayer::filterNeedsPaintInvalidation() |
2888 { | 2886 { |
2889 { | 2887 { |
2890 DeprecatedScheduleStyleRecalcDuringLayout marker(layoutObject()->documen
t().lifecycle()); | 2888 DeprecatedScheduleStyleRecalcDuringLayout marker(layoutObject()->documen
t().lifecycle()); |
2891 // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a styl
e recalc, which | 2889 // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a styl
e recalc, which |
2892 // is a problem because this function can be called while performing lay
out. | 2890 // is a problem because this function can be called while performing lay
out. |
2893 // Presumably this represents an illegal data flow of layout or composit
ing | 2891 // Presumably this represents an illegal data flow of layout or composit
ing |
2894 // information into the style system. | 2892 // information into the style system. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2967 } | 2965 } |
2968 } | 2966 } |
2969 | 2967 |
2970 void showLayerTree(const blink::LayoutObject* layoutObject) | 2968 void showLayerTree(const blink::LayoutObject* layoutObject) |
2971 { | 2969 { |
2972 if (!layoutObject) | 2970 if (!layoutObject) |
2973 return; | 2971 return; |
2974 showLayerTree(layoutObject->enclosingLayer()); | 2972 showLayerTree(layoutObject->enclosingLayer()); |
2975 } | 2973 } |
2976 #endif | 2974 #endif |
OLD | NEW |