Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 | 71 |
| 72 class CORE_EXPORT PaintLayerCompositor final : public GraphicsLayerClient { | 72 class CORE_EXPORT PaintLayerCompositor final : public GraphicsLayerClient { |
| 73 USING_FAST_MALLOC(PaintLayerCompositor); | 73 USING_FAST_MALLOC(PaintLayerCompositor); |
| 74 | 74 |
| 75 public: | 75 public: |
| 76 explicit PaintLayerCompositor(LayoutView&); | 76 explicit PaintLayerCompositor(LayoutView&); |
| 77 ~PaintLayerCompositor() override; | 77 ~PaintLayerCompositor() override; |
| 78 | 78 |
| 79 void updateIfNeededRecursive(); | 79 void updateIfNeededRecursive(); |
| 80 | 80 |
| 81 // Return true if this LayoutView is in "compositing mode" (i.e. has one or mo re | 81 // Return true if this LayoutView is in "compositing mode" (i.e. has one or |
| 82 // composited Layers) | 82 // more composited Layers) |
| 83 bool inCompositingMode() const; | 83 bool inCompositingMode() const; |
| 84 // FIXME: Replace all callers with inCompositingMode and remove this function. | 84 // FIXME: Replace all callers with inCompositingMode and remove this function. |
| 85 bool staleInCompositingMode() const; | 85 bool staleInCompositingMode() const; |
| 86 // This will make a compositing layer at the root automatically, and hook up t o | 86 // This will make a compositing layer at the root automatically, and hook up |
| 87 // the native view/window system. | 87 // to the native view/window system. |
| 88 void setCompositingModeEnabled(bool); | 88 void setCompositingModeEnabled(bool); |
| 89 | 89 |
| 90 // Returns true if the accelerated compositing is enabled | 90 // Returns true if the accelerated compositing is enabled |
| 91 bool hasAcceleratedCompositing() const { return m_hasAcceleratedCompositing; } | 91 bool hasAcceleratedCompositing() const { return m_hasAcceleratedCompositing; } |
| 92 | 92 |
| 93 bool preferCompositingToLCDTextEnabled() const; | 93 bool preferCompositingToLCDTextEnabled() const; |
| 94 | 94 |
| 95 bool rootShouldAlwaysComposite() const; | 95 bool rootShouldAlwaysComposite() const; |
| 96 | 96 |
| 97 // Copy the accelerated compositing related flags from Settings | 97 // Copy the accelerated compositing related flags from Settings |
| 98 void updateAcceleratedCompositingSettings(); | 98 void updateAcceleratedCompositingSettings(); |
| 99 | 99 |
| 100 // Used to indicate that a compositing update will be needed for the next fram e that gets drawn. | 100 // Used to indicate that a compositing update will be needed for the next |
| 101 // frame that gets drawn. | |
| 101 void setNeedsCompositingUpdate(CompositingUpdateType); | 102 void setNeedsCompositingUpdate(CompositingUpdateType); |
| 102 | 103 |
| 103 void didLayout(); | 104 void didLayout(); |
| 104 | 105 |
| 105 // Whether layer's compositedLayerMapping needs a GraphicsLayer to clip z-orde r children of the given Layer. | 106 // Whether layer's compositedLayerMapping needs a GraphicsLayer to clip |
| 107 // z-order children of the given Layer. | |
| 106 bool clipsCompositingDescendants(const PaintLayer*) const; | 108 bool clipsCompositingDescendants(const PaintLayer*) const; |
| 107 | 109 |
| 108 // Whether the given layer needs an extra 'contents' layer. | 110 // Whether the given layer needs an extra 'contents' layer. |
| 109 bool needsContentsCompositingLayer(const PaintLayer*) const; | 111 bool needsContentsCompositingLayer(const PaintLayer*) const; |
| 110 | 112 |
| 111 bool supportsFixedRootBackgroundCompositing() const; | 113 bool supportsFixedRootBackgroundCompositing() const; |
| 112 bool needsFixedRootBackgroundLayer(const PaintLayer*) const; | 114 bool needsFixedRootBackgroundLayer(const PaintLayer*) const; |
| 113 GraphicsLayer* fixedRootBackgroundLayer() const; | 115 GraphicsLayer* fixedRootBackgroundLayer() const; |
| 114 void setNeedsUpdateFixedBackground() { m_needsUpdateFixedBackground = true; } | 116 void setNeedsUpdateFixedBackground() { m_needsUpdateFixedBackground = true; } |
| 115 | 117 |
| 116 // Issue paint invalidations of the appropriate layers when the given Layer st arts or stops being composited. | 118 // Issue paint invalidations of the appropriate layers when the given Layer |
| 119 // starts or stops being composited. | |
| 117 void paintInvalidationOnCompositingChange(PaintLayer*); | 120 void paintInvalidationOnCompositingChange(PaintLayer*); |
| 118 | 121 |
| 119 void fullyInvalidatePaint(); | 122 void fullyInvalidatePaint(); |
| 120 | 123 |
| 121 PaintLayer* rootLayer() const; | 124 PaintLayer* rootLayer() const; |
| 122 GraphicsLayer* rootGraphicsLayer() const; | 125 GraphicsLayer* rootGraphicsLayer() const; |
| 123 GraphicsLayer* frameScrollLayer() const; | 126 GraphicsLayer* frameScrollLayer() const; |
| 124 GraphicsLayer* scrollLayer() const; | 127 GraphicsLayer* scrollLayer() const; |
| 125 GraphicsLayer* containerLayer() const; | 128 GraphicsLayer* containerLayer() const; |
| 126 GraphicsLayer* rootContentLayer() const; | 129 GraphicsLayer* rootContentLayer() const; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 142 // expand/shrink its clipping layer in response to top controls and have | 145 // expand/shrink its clipping layer in response to top controls and have |
| 143 // the result be visible. | 146 // the result be visible. |
| 144 void updateClippingOnCompositorLayers(); | 147 void updateClippingOnCompositorLayers(); |
| 145 | 148 |
| 146 void setIsInWindow(bool); | 149 void setIsInWindow(bool); |
| 147 | 150 |
| 148 static PaintLayerCompositor* frameContentsCompositor(LayoutPart*); | 151 static PaintLayerCompositor* frameContentsCompositor(LayoutPart*); |
| 149 // Return true if the layers changed. | 152 // Return true if the layers changed. |
| 150 static bool attachFrameContentLayersToIframeLayer(LayoutPart*); | 153 static bool attachFrameContentLayersToIframeLayer(LayoutPart*); |
| 151 | 154 |
| 152 // Update the geometry of the layers used for clipping and scrolling in frames . | 155 // Update the geometry of the layers used for clipping and scrolling in |
| 156 // frames. | |
| 153 void frameViewDidChangeLocation(const IntPoint& contentsOffset); | 157 void frameViewDidChangeLocation(const IntPoint& contentsOffset); |
| 154 void frameViewDidChangeSize(); | 158 void frameViewDidChangeSize(); |
| 155 void frameViewDidScroll(); | 159 void frameViewDidScroll(); |
| 156 void frameViewScrollbarsExistenceDidChange(); | 160 void frameViewScrollbarsExistenceDidChange(); |
| 157 void rootFixedBackgroundsChanged(); | 161 void rootFixedBackgroundsChanged(); |
| 158 | 162 |
| 159 bool scrollingLayerDidChange(PaintLayer*); | 163 bool scrollingLayerDidChange(PaintLayer*); |
| 160 | 164 |
| 161 std::unique_ptr<JSONObject> layerTreeAsJSON(LayerTreeFlags) const; | 165 std::unique_ptr<JSONObject> layerTreeAsJSON(LayerTreeFlags) const; |
| 162 | 166 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 180 } | 184 } |
| 181 void setNeedsUpdateDescendantDependentFlags() { | 185 void setNeedsUpdateDescendantDependentFlags() { |
| 182 m_needsUpdateDescendantDependentFlags = true; | 186 m_needsUpdateDescendantDependentFlags = true; |
| 183 } | 187 } |
| 184 | 188 |
| 185 void updatePotentialCompositingReasonsFromStyle(PaintLayer*); | 189 void updatePotentialCompositingReasonsFromStyle(PaintLayer*); |
| 186 | 190 |
| 187 // Whether the layer could ever be composited. | 191 // Whether the layer could ever be composited. |
| 188 bool canBeComposited(const PaintLayer*) const; | 192 bool canBeComposited(const PaintLayer*) const; |
| 189 | 193 |
| 190 // FIXME: Move allocateOrClearCompositedLayerMapping to CompositingLayerAssign er once we've fixed | 194 // FIXME: Move allocateOrClearCompositedLayerMapping to |
| 195 // CompositingLayerAssigner once we've fixed | |
|
eae
2016/10/05 19:53:01
Rewrap at 80 col.
Nico
2016/10/05 19:58:15
Whoops, thanks! Done.
| |
| 191 // the compositing chicken/egg issues. | 196 // the compositing chicken/egg issues. |
| 192 bool allocateOrClearCompositedLayerMapping( | 197 bool allocateOrClearCompositedLayerMapping( |
| 193 PaintLayer*, | 198 PaintLayer*, |
| 194 CompositingStateTransitionType compositedLayerUpdate); | 199 CompositingStateTransitionType compositedLayerUpdate); |
| 195 | 200 |
| 196 void updateDirectCompositingReasons(PaintLayer*); | 201 void updateDirectCompositingReasons(PaintLayer*); |
| 197 | 202 |
| 198 bool inOverlayFullscreenVideo() const { return m_inOverlayFullscreenVideo; } | 203 bool inOverlayFullscreenVideo() const { return m_inOverlayFullscreenVideo; } |
| 199 | 204 |
| 200 private: | 205 private: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 ScrollingCoordinator* scrollingCoordinator() const; | 239 ScrollingCoordinator* scrollingCoordinator() const; |
| 235 | 240 |
| 236 void enableCompositingModeIfNeeded(); | 241 void enableCompositingModeIfNeeded(); |
| 237 | 242 |
| 238 bool requiresHorizontalScrollbarLayer() const; | 243 bool requiresHorizontalScrollbarLayer() const; |
| 239 bool requiresVerticalScrollbarLayer() const; | 244 bool requiresVerticalScrollbarLayer() const; |
| 240 bool requiresScrollCornerLayer() const; | 245 bool requiresScrollCornerLayer() const; |
| 241 | 246 |
| 242 void applyOverlayFullscreenVideoAdjustmentIfNeeded(); | 247 void applyOverlayFullscreenVideoAdjustmentIfNeeded(); |
| 243 | 248 |
| 244 // Checks the given graphics layer against the compositor's horizontal and ver tical scrollbar | 249 // Checks the given graphics layer against the compositor's horizontal and |
| 245 // graphics layers, returning the associated Scrollbar instance if any, else n ullptr. | 250 // vertical scrollbar graphics layers, returning the associated Scrollbar |
| 251 // instance if any, else nullptr. | |
| 246 Scrollbar* graphicsLayerToScrollbar(const GraphicsLayer*) const; | 252 Scrollbar* graphicsLayerToScrollbar(const GraphicsLayer*) const; |
| 247 | 253 |
| 248 LayoutView& m_layoutView; | 254 LayoutView& m_layoutView; |
| 249 std::unique_ptr<GraphicsLayer> m_rootContentLayer; | 255 std::unique_ptr<GraphicsLayer> m_rootContentLayer; |
| 250 | 256 |
| 251 CompositingReasonFinder m_compositingReasonFinder; | 257 CompositingReasonFinder m_compositingReasonFinder; |
| 252 | 258 |
| 253 CompositingUpdateType m_pendingUpdateType; | 259 CompositingUpdateType m_pendingUpdateType; |
| 254 | 260 |
| 255 bool m_hasAcceleratedCompositing; | 261 bool m_hasAcceleratedCompositing; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 279 | 285 |
| 280 // Layers for overflow controls | 286 // Layers for overflow controls |
| 281 std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; | 287 std::unique_ptr<GraphicsLayer> m_layerForHorizontalScrollbar; |
| 282 std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; | 288 std::unique_ptr<GraphicsLayer> m_layerForVerticalScrollbar; |
| 283 std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; | 289 std::unique_ptr<GraphicsLayer> m_layerForScrollCorner; |
| 284 }; | 290 }; |
| 285 | 291 |
| 286 } // namespace blink | 292 } // namespace blink |
| 287 | 293 |
| 288 #endif // PaintLayerCompositor_h | 294 #endif // PaintLayerCompositor_h |
| OLD | NEW |