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

Side by Side Diff: Source/core/platform/graphics/GraphicsLayer.h

Issue 75113003: Refactor GraphicsLayer::setContentsToImage(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 protected: 74 protected:
75 virtual ~LinkHighlightClient() { } 75 virtual ~LinkHighlightClient() { }
76 }; 76 };
77 77
78 // GraphicsLayer is an abstraction for a rendering surface with backing store, 78 // GraphicsLayer is an abstraction for a rendering surface with backing store,
79 // which may have associated transformation and animations. 79 // which may have associated transformation and animations.
80 80
81 class GraphicsLayer : public GraphicsContextPainter, public blink::WebAnimationD elegate, public blink::WebLayerScrollClient, public blink::WebLayerClient { 81 class GraphicsLayer : public GraphicsContextPainter, public blink::WebAnimationD elegate, public blink::WebLayerScrollClient, public blink::WebLayerClient {
82 WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED; 82 WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED;
83 public: 83 public:
84 enum ContentsLayerPurpose {
85 NoContentsLayer = 0,
86 ContentsLayerForImage,
87 ContentsLayerForNinePatch,
88 ContentsLayerForVideo,
89 ContentsLayerForCanvas,
90 };
91
92 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer Client*); 84 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer Client*);
93 85
94 virtual ~GraphicsLayer(); 86 virtual ~GraphicsLayer();
95 87
96 GraphicsLayerClient* client() const { return m_client; } 88 GraphicsLayerClient* client() const { return m_client; }
97 89
98 // blink::WebLayerClient implementation. 90 // blink::WebLayerClient implementation.
99 virtual blink::WebString debugName(blink::WebLayer*) OVERRIDE; 91 virtual blink::WebString debugName(blink::WebLayer*) OVERRIDE;
100 92
101 void setCompositingReasons(blink::WebCompositingReasons); 93 void setCompositingReasons(blink::WebCompositingReasons);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 int incrementPaintCount() { return ++m_paintCount; } 327 int incrementPaintCount() { return ++m_paintCount; }
336 328
337 void dumpProperties(TextStream&, int indent, LayerTreeFlags) const; 329 void dumpProperties(TextStream&, int indent, LayerTreeFlags) const;
338 void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeFlags) c onst { } 330 void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeFlags) c onst { }
339 331
340 // Helper functions used by settors to keep layer's the state consistent. 332 // Helper functions used by settors to keep layer's the state consistent.
341 void updateChildList(); 333 void updateChildList();
342 void updateLayerIsDrawable(); 334 void updateLayerIsDrawable();
343 void updateContentsRect(); 335 void updateContentsRect();
344 336
345 void setContentsTo(ContentsLayerPurpose, blink::WebLayer*); 337 void setContentsTo(blink::WebLayer*);
346 void setupContentsLayer(blink::WebLayer*); 338 void setupContentsLayer(blink::WebLayer*);
347 void clearContentsLayerIfUnregistered(); 339 void clearContentsLayerIfUnregistered();
348 blink::WebLayer* contentsLayerIfRegistered(); 340 blink::WebLayer* contentsLayerIfRegistered();
349 341
350 GraphicsLayerClient* m_client; 342 GraphicsLayerClient* m_client;
351 343
352 // Offset from the owning renderer 344 // Offset from the owning renderer
353 IntSize m_offsetFromRenderer; 345 IntSize m_offsetFromRenderer;
354 346
355 // Position is relative to the parent GraphicsLayer 347 // Position is relative to the parent GraphicsLayer
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // We don't have ownership of m_contentsLayer, but we do want to know if a g iven layer is the 394 // We don't have ownership of m_contentsLayer, but we do want to know if a g iven layer is the
403 // same as our current layer in setContentsTo(). Since m_contentsLayer may b e deleted at this point, 395 // same as our current layer in setContentsTo(). Since m_contentsLayer may b e deleted at this point,
404 // we stash an ID away when we know m_contentsLayer is alive and use that fo r comparisons from that point 396 // we stash an ID away when we know m_contentsLayer is alive and use that fo r comparisons from that point
405 // on. 397 // on.
406 int m_contentsLayerId; 398 int m_contentsLayerId;
407 399
408 Vector<LinkHighlightClient*> m_linkHighlights; 400 Vector<LinkHighlightClient*> m_linkHighlights;
409 401
410 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa yerDelegate; 402 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa yerDelegate;
411 403
412 ContentsLayerPurpose m_contentsLayerPurpose;
413
414 ScrollableArea* m_scrollableArea; 404 ScrollableArea* m_scrollableArea;
415 blink::WebCompositingReasons m_compositingReasons; 405 blink::WebCompositingReasons m_compositingReasons;
416 }; 406 };
417 407
418 408
419 } // namespace WebCore 409 } // namespace WebCore
420 410
421 #ifndef NDEBUG 411 #ifndef NDEBUG
422 // Outside the WebCore namespace for ease of invocation from gdb. 412 // Outside the WebCore namespace for ease of invocation from gdb.
423 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer); 413 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer);
424 #endif 414 #endif
425 415
426 #endif // GraphicsLayer_h 416 #endif // GraphicsLayer_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/graphics/GraphicsLayer.cpp » ('j') | Source/core/platform/graphics/GraphicsLayer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698