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

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: Changing dependencies due to failing ios bots 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::PaintContents(
50 SkCanvas* canvas,
51 const gfx::Rect& clip,
52 gfx::RectF* opaque,
53 ContentLayerClient::GraphicsContextStatus graphics_context_status) {
54 if (!client_)
55 return;
56
57 blink::WebFloatRect web_opaque;
58 client_->paintContents(
59 canvas,
60 clip,
61 can_use_lcd_text_,
62 web_opaque,
63 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED
64 ? blink::WebContentLayerClient::GraphicsContextEnabled
65 : blink::WebContentLayerClient::GraphicsContextDisabled);
66 *opaque = web_opaque;
67 }
68
69 void WebContentLayerImpl::DidChangeLayerCanUseLCDText() {
70 // It is important to make this comparison because the LCD text status
71 // here can get out of sync with that in the layer.
72 if (can_use_lcd_text_ == layer_->layer()->can_use_lcd_text())
73 return;
74
75 // LCD text cannot be enabled once disabled.
76 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_)
77 return;
78
79 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text();
80 ignore_lcd_text_change_ = true;
81 layer_->invalidate();
82 }
83
84 bool WebContentLayerImpl::FillsBoundsCompletely() const { return false; }
85
86 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698