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

Side by Side Diff: cc/blink/web_content_layer_impl.cc

Issue 684653004: Plumb can_use_lcd_text, contents_opaque directly to ContentLayerClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/blink/web_content_layer_impl.h" 5 #include "cc/blink/web_content_layer_impl.h"
6 6
7 #include "cc/layers/content_layer.h" 7 #include "cc/layers/content_layer.h"
8 #include "cc/layers/picture_layer.h" 8 #include "cc/layers/picture_layer.h"
9 #include "third_party/WebKit/public/platform/WebContentLayerClient.h" 9 #include "third_party/WebKit/public/platform/WebContentLayerClient.h"
10 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 10 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
11 #include "third_party/WebKit/public/platform/WebFloatRect.h" 11 #include "third_party/WebKit/public/platform/WebFloatRect.h"
12 #include "third_party/WebKit/public/platform/WebRect.h" 12 #include "third_party/WebKit/public/platform/WebRect.h"
13 #include "third_party/WebKit/public/platform/WebSize.h" 13 #include "third_party/WebKit/public/platform/WebSize.h"
14 #include "third_party/skia/include/utils/SkMatrix44.h" 14 #include "third_party/skia/include/utils/SkMatrix44.h"
15 15
16 using cc::ContentLayer; 16 using cc::ContentLayer;
17 using cc::PictureLayer; 17 using cc::PictureLayer;
18 18
19 namespace cc_blink { 19 namespace cc_blink {
20 20
21 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client) 21 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client)
22 : client_(client), ignore_lcd_text_change_(false) { 22 : client_(client) {
23 if (WebLayerImpl::UsingPictureLayer()) 23 if (WebLayerImpl::UsingPictureLayer())
24 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); 24 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this)));
25 else 25 else
26 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); 26 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this)));
27 layer_->layer()->SetIsDrawable(true); 27 layer_->layer()->SetIsDrawable(true);
28 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text();
29 } 28 }
30 29
31 WebContentLayerImpl::~WebContentLayerImpl() { 30 WebContentLayerImpl::~WebContentLayerImpl() {
32 if (WebLayerImpl::UsingPictureLayer()) 31 if (WebLayerImpl::UsingPictureLayer())
33 static_cast<PictureLayer*>(layer_->layer())->ClearClient(); 32 static_cast<PictureLayer*>(layer_->layer())->ClearClient();
34 else 33 else
35 static_cast<ContentLayer*>(layer_->layer())->ClearClient(); 34 static_cast<ContentLayer*>(layer_->layer())->ClearClient();
36 } 35 }
37 36
38 blink::WebLayer* WebContentLayerImpl::layer() { 37 blink::WebLayer* WebContentLayerImpl::layer() {
39 return layer_.get(); 38 return layer_.get();
40 } 39 }
41 40
42 void WebContentLayerImpl::setDoubleSided(bool double_sided) { 41 void WebContentLayerImpl::setDoubleSided(bool double_sided) {
43 layer_->layer()->SetDoubleSided(double_sided); 42 layer_->layer()->SetDoubleSided(double_sided);
44 } 43 }
45 44
46 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { 45 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) {
47 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); 46 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable);
48 } 47 }
49 48
50 void WebContentLayerImpl::PaintContents( 49 void WebContentLayerImpl::PaintContents(
51 SkCanvas* canvas, 50 SkCanvas* canvas,
52 const gfx::Rect& clip, 51 const gfx::Rect& clip,
52 bool can_use_lcd_text,
53 bool contents_opaque,
53 ContentLayerClient::GraphicsContextStatus graphics_context_status) { 54 ContentLayerClient::GraphicsContextStatus graphics_context_status) {
54 if (!client_) 55 if (!client_)
55 return; 56 return;
56 57
57 client_->paintContents( 58 client_->paintContents(
58 canvas, 59 canvas,
59 clip, 60 clip,
60 can_use_lcd_text_, 61 can_use_lcd_text,
62 contents_opaque,
61 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED 63 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED
62 ? blink::WebContentLayerClient::GraphicsContextEnabled 64 ? blink::WebContentLayerClient::GraphicsContextEnabled
63 : blink::WebContentLayerClient::GraphicsContextDisabled); 65 : blink::WebContentLayerClient::GraphicsContextDisabled);
64 } 66 }
65 67
66 void WebContentLayerImpl::DidChangeLayerCanUseLCDText() {
67 // It is important to make this comparison because the LCD text status
68 // here can get out of sync with that in the layer.
69 if (can_use_lcd_text_ == layer_->layer()->can_use_lcd_text())
70 return;
71
72 // LCD text cannot be enabled once disabled.
73 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_)
74 return;
75
76 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text();
77 ignore_lcd_text_change_ = true;
78 layer_->invalidate();
79 }
80
81 bool WebContentLayerImpl::FillsBoundsCompletely() const { 68 bool WebContentLayerImpl::FillsBoundsCompletely() const {
82 return false; 69 return false;
83 } 70 }
84 71
85 } // namespace cc_blink 72 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698