| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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 "webkit/renderer/compositor_bindings/web_content_layer_impl.h" | 5 #include "content/renderer/compositor_bindings/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 webkit { | 19 namespace content { |
| 20 | 20 |
| 21 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client) | 21 WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client) |
| 22 : client_(client), | 22 : client_(client), ignore_lcd_text_change_(false) { |
| 23 ignore_lcd_text_change_(false) { | |
| 24 if (WebLayerImpl::UsingPictureLayer()) | 23 if (WebLayerImpl::UsingPictureLayer()) |
| 25 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); | 24 layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); |
| 26 else | 25 else |
| 27 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); | 26 layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); |
| 28 layer_->layer()->SetIsDrawable(true); | 27 layer_->layer()->SetIsDrawable(true); |
| 29 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); | 28 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); |
| 30 } | 29 } |
| 31 | 30 |
| 32 WebContentLayerImpl::~WebContentLayerImpl() { | 31 WebContentLayerImpl::~WebContentLayerImpl() { |
| 33 if (WebLayerImpl::UsingPictureLayer()) | 32 if (WebLayerImpl::UsingPictureLayer()) |
| 34 static_cast<PictureLayer*>(layer_->layer())->ClearClient(); | 33 static_cast<PictureLayer*>(layer_->layer())->ClearClient(); |
| 35 else | 34 else |
| 36 static_cast<ContentLayer*>(layer_->layer())->ClearClient(); | 35 static_cast<ContentLayer*>(layer_->layer())->ClearClient(); |
| 37 } | 36 } |
| 38 | 37 |
| 39 blink::WebLayer* WebContentLayerImpl::layer() { return layer_.get(); } | 38 blink::WebLayer* WebContentLayerImpl::layer() { |
| 39 return layer_.get(); |
| 40 } |
| 40 | 41 |
| 41 void WebContentLayerImpl::setDoubleSided(bool double_sided) { | 42 void WebContentLayerImpl::setDoubleSided(bool double_sided) { |
| 42 layer_->layer()->SetDoubleSided(double_sided); | 43 layer_->layer()->SetDoubleSided(double_sided); |
| 43 } | 44 } |
| 44 | 45 |
| 45 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { | 46 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { |
| 46 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); | 47 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); |
| 47 } | 48 } |
| 48 | 49 |
| 49 void WebContentLayerImpl::PaintContents( | 50 void WebContentLayerImpl::PaintContents( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 | 75 |
| 75 // LCD text cannot be enabled once disabled. | 76 // LCD text cannot be enabled once disabled. |
| 76 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_) | 77 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_) |
| 77 return; | 78 return; |
| 78 | 79 |
| 79 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); | 80 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); |
| 80 ignore_lcd_text_change_ = true; | 81 ignore_lcd_text_change_ = true; |
| 81 layer_->invalidate(); | 82 layer_->invalidate(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 bool WebContentLayerImpl::FillsBoundsCompletely() const { return false; } | 85 bool WebContentLayerImpl::FillsBoundsCompletely() const { |
| 86 return false; |
| 87 } |
| 85 | 88 |
| 86 } // namespace webkit | 89 } // namespace content |
| 90 |
| OLD | NEW |