Explicitly add python-numpy dependency to install-build-deps.
[chromium-blink-merge.git] / cc / blink / web_content_layer_impl.cc
blobd0a4cca4722b57166a92947c8de69e977729a4d7
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.
5 #include "cc/blink/web_content_layer_impl.h"
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"
16 using cc::ContentLayer;
17 using cc::PictureLayer;
19 namespace cc_blink {
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);
30 WebContentLayerImpl::~WebContentLayerImpl() {
31 if (WebLayerImpl::UsingPictureLayer())
32 static_cast<PictureLayer*>(layer_->layer())->ClearClient();
33 else
34 static_cast<ContentLayer*>(layer_->layer())->ClearClient();
37 blink::WebLayer* WebContentLayerImpl::layer() {
38 return layer_.get();
41 void WebContentLayerImpl::setDoubleSided(bool double_sided) {
42 layer_->layer()->SetDoubleSided(double_sided);
45 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) {
46 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable);
49 void WebContentLayerImpl::PaintContents(
50 SkCanvas* canvas,
51 const gfx::Rect& clip,
52 ContentLayerClient::GraphicsContextStatus graphics_context_status) {
53 if (!client_)
54 return;
56 // TODO(danakj): Stop passing this to blink it should always use LCD when it
57 // wants to. crbug.com/430617
58 bool can_use_lcd_text = true;
59 client_->paintContents(
60 canvas, clip, can_use_lcd_text,
61 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED
62 ? blink::WebContentLayerClient::GraphicsContextEnabled
63 : blink::WebContentLayerClient::GraphicsContextDisabled);
66 bool WebContentLayerImpl::FillsBoundsCompletely() const {
67 return false;
70 } // namespace cc_blink