| 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 "webkit/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" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 void WebContentLayerImpl::PaintContents( | 49 void WebContentLayerImpl::PaintContents( |
| 50 SkCanvas* canvas, | 50 SkCanvas* canvas, |
| 51 const gfx::Rect& clip, | 51 const gfx::Rect& clip, |
| 52 gfx::RectF* opaque, | 52 gfx::RectF* opaque, |
| 53 ContentLayerClient::GraphicsContextStatus graphics_context_status) { | 53 ContentLayerClient::GraphicsContextStatus graphics_context_status) { |
| 54 if (!client_) | 54 if (!client_) |
| 55 return; | 55 return; |
| 56 | 56 |
| 57 blink::WebFloatRect web_opaque; | 57 blink::WebFloatRect web_opaque; |
| 58 // For picture layers, always record with LCD text. PictureLayerImpl | |
| 59 // will turn this off later during rasterization. | |
| 60 bool use_lcd_text = WebLayerImpl::UsingPictureLayer() || can_use_lcd_text_; | |
| 61 client_->paintContents( | 58 client_->paintContents( |
| 62 canvas, | 59 canvas, |
| 63 clip, | 60 clip, |
| 64 use_lcd_text, | 61 can_use_lcd_text_, |
| 65 web_opaque, | 62 web_opaque, |
| 66 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED | 63 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED |
| 67 ? blink::WebContentLayerClient::GraphicsContextEnabled | 64 ? blink::WebContentLayerClient::GraphicsContextEnabled |
| 68 : blink::WebContentLayerClient::GraphicsContextDisabled); | 65 : blink::WebContentLayerClient::GraphicsContextDisabled); |
| 69 *opaque = web_opaque; | 66 *opaque = web_opaque; |
| 70 } | 67 } |
| 71 | 68 |
| 72 void WebContentLayerImpl::DidChangeLayerCanUseLCDText() { | 69 void WebContentLayerImpl::DidChangeLayerCanUseLCDText() { |
| 73 // It is important to make this comparison because the LCD text status | 70 // It is important to make this comparison because the LCD text status |
| 74 // here can get out of sync with that in the layer. | 71 // here can get out of sync with that in the layer. |
| 75 if (can_use_lcd_text_ == layer_->layer()->can_use_lcd_text()) | 72 if (can_use_lcd_text_ == layer_->layer()->can_use_lcd_text()) |
| 76 return; | 73 return; |
| 77 | 74 |
| 78 // LCD text cannot be enabled once disabled. | 75 // LCD text cannot be enabled once disabled. |
| 79 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_) | 76 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_) |
| 80 return; | 77 return; |
| 81 | 78 |
| 82 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); | 79 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); |
| 83 ignore_lcd_text_change_ = true; | 80 ignore_lcd_text_change_ = true; |
| 84 layer_->invalidate(); | 81 layer_->invalidate(); |
| 85 } | 82 } |
| 86 | 83 |
| 87 bool WebContentLayerImpl::FillsBoundsCompletely() const { return false; } | 84 bool WebContentLayerImpl::FillsBoundsCompletely() const { return false; } |
| 88 | 85 |
| 89 } // namespace webkit | 86 } // namespace webkit |
| OLD | NEW |