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

Side by Side Diff: sky/viewer/cc/web_content_layer_impl.cc

Issue 752683002: Break Sky's dependency on cc (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « sky/viewer/cc/web_content_layer_impl.h ('k') | sky/viewer/cc/web_external_bitmap_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sky/viewer/cc/web_content_layer_impl.h"
6
7 #include "cc/layers/content_layer.h"
8 #include "cc/layers/picture_layer.h"
9 #include "sky/engine/public/platform/WebContentLayerClient.h"
10 #include "sky/engine/public/platform/WebFloatPoint.h"
11 #include "sky/engine/public/platform/WebFloatRect.h"
12 #include "sky/engine/public/platform/WebRect.h"
13 #include "sky/engine/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 sky_viewer_cc {
20
21 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client)
22 : client_(client) {
23 if (WebLayerImpl::UsingPictureLayer())
24 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this)));
25 else
26 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this)));
27 layer_->layer()->SetIsDrawable(true);
28 }
29
30 WebContentLayerImpl::~WebContentLayerImpl() {
31 if (WebLayerImpl::UsingPictureLayer())
32 static_cast<PictureLayer*>(layer_->layer())->ClearClient();
33 else
34 static_cast<ContentLayer*>(layer_->layer())->ClearClient();
35 }
36
37 blink::WebLayer* WebContentLayerImpl::layer() {
38 return layer_.get();
39 }
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 ContentLayerClient::GraphicsContextStatus graphics_context_status) {
53 if (!client_)
54 return;
55
56 blink::WebFloatRect web_opaque;
57 bool can_use_lcd_text = false;
58 client_->paintContents(
59 canvas, clip, can_use_lcd_text, web_opaque,
60 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED
61 ? blink::WebContentLayerClient::GraphicsContextEnabled
62 : blink::WebContentLayerClient::GraphicsContextDisabled);
63 }
64
65 bool WebContentLayerImpl::FillsBoundsCompletely() const {
66 return false;
67 }
68
69 } // namespace sky_viewer_cc
OLDNEW
« no previous file with comments | « sky/viewer/cc/web_content_layer_impl.h ('k') | sky/viewer/cc/web_external_bitmap_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698