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

Side by Side Diff: webkit/renderer/compositor_bindings/web_content_layer_impl.cc

Issue 317163002: Moving compositor_bindings from webkit to content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
(Empty)
1 // Copyright 2011 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.
4
5 #include "webkit/renderer/compositor_bindings/web_content_layer_impl.h"
6
7 #include "cc/layers/content_layer.h"
8 #include "cc/layers/picture_layer.h"
9 #include "third_party/WebKit/public/platform/WebContentLayerClient.h"
10 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
11 #include "third_party/WebKit/public/platform/WebFloatRect.h"
12 #include "third_party/WebKit/public/platform/WebRect.h"
13 #include "third_party/WebKit/public/platform/WebSize.h"
14 #include "third_party/skia/include/utils/SkMatrix44.h"
15
16 using cc::ContentLayer;
17 using cc::PictureLayer;
18
19 namespace webkit {
20
21 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client)
22 : client_(client),
23 ignore_lcd_text_change_(false) {
24 if (WebLayerImpl::UsingPictureLayer())
25 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this)));
26 else
27 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this)));
28 layer_->layer()->SetIsDrawable(true);
29 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text();
30 }
31
32 WebContentLayerImpl::~WebContentLayerImpl() {
33 if (WebLayerImpl::UsingPictureLayer())
34 static_cast<PictureLayer*>(layer_->layer())->ClearClient();
35 else
36 static_cast<ContentLayer*>(layer_->layer())->ClearClient();
37 }
38
39 blink::WebLayer* WebContentLayerImpl::layer() { return layer_.get(); }
40
41 void WebContentLayerImpl::setDoubleSided(bool double_sided) {
42 layer_->layer()->SetDoubleSided(double_sided);
43 }
44
45 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) {
46 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable);
47 }
48
49 void WebContentLayerImpl::setHasGpuRasterizationHint(bool has_hint) {
50 // TODO(ajuma): Convert per-layer GPU rasterization hints to per-layer
51 // prepaint-disabling hints (crbug.com/365885).
52 }
53
54 void WebContentLayerImpl::PaintContents(
55 SkCanvas* canvas,
56 const gfx::Rect& clip,
57 gfx::RectF* opaque,
58 ContentLayerClient::GraphicsContextStatus graphics_context_status) {
59 if (!client_)
60 return;
61
62 blink::WebFloatRect web_opaque;
63 // For picture layers, always record with LCD text. PictureLayerImpl
64 // will turn this off later during rasterization.
65 bool use_lcd_text = WebLayerImpl::UsingPictureLayer() || can_use_lcd_text_;
66 client_->paintContents(
67 canvas,
68 clip,
69 use_lcd_text,
70 web_opaque,
71 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED
72 ? blink::WebContentLayerClient::GraphicsContextEnabled
73 : blink::WebContentLayerClient::GraphicsContextDisabled);
74 *opaque = web_opaque;
75 }
76
77 void WebContentLayerImpl::DidChangeLayerCanUseLCDText() {
78 // It is important to make this comparison because the LCD text status
79 // here can get out of sync with that in the layer.
80 if (can_use_lcd_text_ == layer_->layer()->can_use_lcd_text())
81 return;
82
83 // LCD text cannot be enabled once disabled.
84 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_)
85 return;
86
87 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text();
88 ignore_lcd_text_change_ = true;
89 layer_->invalidate();
90 }
91
92 bool WebContentLayerImpl::FillsBoundsCompletely() const { return false; }
93
94 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698