Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/blink/web_display_item_list_impl.h" | 7 #include "cc/blink/web_display_item_list_impl.h" |
| 8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
| 9 #include "cc/layers/picture_layer.h" | 9 #include "cc/layers/picture_layer.h" |
| 10 #include "third_party/WebKit/public/platform/WebContentLayerClient.h" | 10 #include "third_party/WebKit/public/platform/WebContentLayerClient.h" |
| 11 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 11 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 12 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 12 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 13 #include "third_party/WebKit/public/platform/WebRect.h" | 13 #include "third_party/WebKit/public/platform/WebRect.h" |
| 14 #include "third_party/WebKit/public/platform/WebSize.h" | 14 #include "third_party/WebKit/public/platform/WebSize.h" |
| 15 #include "third_party/skia/include/utils/SkMatrix44.h" | 15 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 16 | 16 |
| 17 using cc::ContentLayer; | 17 using cc::ContentLayer; |
| 18 using cc::PictureLayer; | 18 using cc::PictureLayer; |
| 19 | 19 |
| 20 namespace cc_blink { | 20 namespace cc_blink { |
| 21 | 21 |
| 22 inline blink::WebContentLayerClient::PaintingControlSetting | |
| 23 PaintingControlToWeb( | |
|
ajuma
2015/02/04 22:47:33
This should either be static or inside an anonymou
Stephen Chennney
2015/02/05 14:57:42
Made static.
| |
| 24 cc::ContentLayerClient::PaintingControlSetting painting_control) { | |
| 25 switch (painting_control) { | |
| 26 case cc::ContentLayerClient::PAINTING_BEHAVIOR_NORMAL: | |
| 27 return blink::WebContentLayerClient::PaintDefaultBehavior; | |
| 28 case cc::ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED: | |
| 29 return blink::WebContentLayerClient::DisplayListConstructionDisabled; | |
| 30 case cc::ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED: | |
| 31 return blink::WebContentLayerClient::DisplayListCachingDisabled; | |
| 32 } | |
| 33 NOTREACHED(); | |
| 34 return blink::WebContentLayerClient::PaintDefaultBehavior; | |
| 35 } | |
| 36 | |
| 22 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client) | 37 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client) |
| 23 : client_(client) { | 38 : client_(client) { |
| 24 if (WebLayerImpl::UsingPictureLayer()) | 39 if (WebLayerImpl::UsingPictureLayer()) |
| 25 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); | 40 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); |
| 26 else | 41 else |
| 27 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); | 42 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); |
| 28 layer_->layer()->SetIsDrawable(true); | 43 layer_->layer()->SetIsDrawable(true); |
| 29 } | 44 } |
| 30 | 45 |
| 31 WebContentLayerImpl::~WebContentLayerImpl() { | 46 WebContentLayerImpl::~WebContentLayerImpl() { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 43 layer_->layer()->SetDoubleSided(double_sided); | 58 layer_->layer()->SetDoubleSided(double_sided); |
| 44 } | 59 } |
| 45 | 60 |
| 46 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { | 61 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { |
| 47 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); | 62 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); |
| 48 } | 63 } |
| 49 | 64 |
| 50 void WebContentLayerImpl::PaintContents( | 65 void WebContentLayerImpl::PaintContents( |
| 51 SkCanvas* canvas, | 66 SkCanvas* canvas, |
| 52 const gfx::Rect& clip, | 67 const gfx::Rect& clip, |
| 53 ContentLayerClient::GraphicsContextStatus graphics_context_status) { | 68 cc::ContentLayerClient::PaintingControlSetting painting_control) { |
| 54 if (!client_) | 69 if (!client_) |
| 55 return; | 70 return; |
| 56 | 71 |
| 57 client_->paintContents( | 72 client_->paintContents(canvas, clip, PaintingControlToWeb(painting_control)); |
| 58 canvas, clip, | |
| 59 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED | |
| 60 ? blink::WebContentLayerClient::GraphicsContextEnabled | |
| 61 : blink::WebContentLayerClient::GraphicsContextDisabled); | |
| 62 } | 73 } |
| 63 | 74 |
| 64 scoped_refptr<cc::DisplayItemList> | 75 scoped_refptr<cc::DisplayItemList> |
| 65 WebContentLayerImpl::PaintContentsToDisplayList( | 76 WebContentLayerImpl::PaintContentsToDisplayList( |
| 66 const gfx::Rect& clip, | 77 const gfx::Rect& clip, |
| 67 ContentLayerClient::GraphicsContextStatus graphics_context_status) { | 78 cc::ContentLayerClient::PaintingControlSetting painting_control) { |
| 68 if (!client_) | 79 if (!client_) |
| 69 return cc::DisplayItemList::Create(); | 80 return cc::DisplayItemList::Create(); |
| 70 | 81 |
| 71 WebDisplayItemListImpl list; | 82 WebDisplayItemListImpl list; |
| 72 client_->paintContents( | 83 client_->paintContents(&list, clip, PaintingControlToWeb(painting_control)); |
| 73 &list, clip, | |
| 74 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED | |
| 75 ? blink::WebContentLayerClient::GraphicsContextEnabled | |
| 76 : blink::WebContentLayerClient::GraphicsContextDisabled); | |
| 77 return list.ToDisplayItemList(); | 84 return list.ToDisplayItemList(); |
| 78 } | 85 } |
| 79 | 86 |
| 80 bool WebContentLayerImpl::FillsBoundsCompletely() const { | 87 bool WebContentLayerImpl::FillsBoundsCompletely() const { |
| 81 return false; | 88 return false; |
| 82 } | 89 } |
| 83 | 90 |
| 84 } // namespace cc_blink | 91 } // namespace cc_blink |
| OLD | NEW |