[content shell] implement testRunner.overridePreference
[chromium-blink-merge.git] / cc / content_layer.h
blobcad68d1f7af5833ce57a28e95d051cf8efc6f4f3
1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_CONTENT_LAYER_H_
6 #define CC_CONTENT_LAYER_H_
8 #include "base/basictypes.h"
9 #include "cc/cc_export.h"
10 #include "cc/layer_painter.h"
11 #include "cc/tiled_layer.h"
13 class SkCanvas;
15 namespace cc {
17 class ContentLayerClient;
18 class LayerUpdater;
20 class CC_EXPORT ContentLayerPainter : public LayerPainter {
21 public:
22 static scoped_ptr<ContentLayerPainter> create(ContentLayerClient*);
24 virtual void paint(SkCanvas*, gfx::Rect contentRect, gfx::RectF& opaque) OVERRIDE;
26 private:
27 explicit ContentLayerPainter(ContentLayerClient*);
29 ContentLayerClient* m_client;
31 DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter);
34 // A layer that renders its contents into an SkCanvas.
35 class CC_EXPORT ContentLayer : public TiledLayer {
36 public:
37 static scoped_refptr<ContentLayer> create(ContentLayerClient*);
39 void clearClient() { m_client = 0; }
40 bool useLCDText() const { return m_useLCDText; }
42 virtual bool drawsContent() const OVERRIDE;
43 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE;
44 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&) OVERRIDE;
45 virtual bool needMoreUpdates() OVERRIDE;
47 virtual void setContentsOpaque(bool) OVERRIDE;
49 protected:
50 explicit ContentLayer(ContentLayerClient*);
51 virtual ~ContentLayer();
53 private:
54 virtual LayerUpdater* updater() const OVERRIDE;
55 virtual void createUpdaterIfNeeded() OVERRIDE;
57 void updateUseLCDText();
58 // Called when LCD text setting is about to potentially change.
59 // If this function returns true, the setting is allowed to change.
60 // If it returns false, the setting is not changed.
61 bool useLCDTextWillChange() const;
62 void useLCDTextDidChange();
64 ContentLayerClient* m_client;
65 scoped_refptr<LayerUpdater> m_updater;
67 bool m_useLCDText;
68 int m_lcdTextChangeCount;
69 static const int kLCDTextMaxChangeCount;
73 #endif // CC_CONTENT_LAYER_H_