| 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 "config.h" | 5 #include "config.h" |
| 6 #include "web_content_layer_impl.h" | 6 #include "web_content_layer_impl.h" |
| 7 | 7 |
| 8 #include "SkMatrix44.h" | 8 #include "SkMatrix44.h" |
| 9 #include "base/command_line.h" |
| 9 #include "cc/content_layer.h" | 10 #include "cc/content_layer.h" |
| 11 #include "cc/picture_layer.h" |
| 12 #include "cc/switches.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie
nt.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClie
nt.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
| 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 15 | 18 |
| 16 using namespace cc; | 19 using namespace cc; |
| 17 | 20 |
| 18 namespace WebKit { | 21 namespace WebKit { |
| 19 | 22 |
| 23 static bool usingPictureLayer() |
| 24 { |
| 25 return CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kImplSidePa
inting); |
| 26 } |
| 27 |
| 20 WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) | 28 WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) |
| 21 { | 29 { |
| 22 return new WebContentLayerImpl(client); | 30 return new WebContentLayerImpl(client); |
| 23 } | 31 } |
| 24 | 32 |
| 25 WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) | 33 WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) |
| 26 : m_layer(new WebLayerImpl(ContentLayer::create(this))) | 34 : m_client(client) |
| 27 , m_client(client) | |
| 28 { | 35 { |
| 36 if (usingPictureLayer()) |
| 37 m_layer = make_scoped_ptr(new WebLayerImpl(PictureLayer::create(this))); |
| 38 else |
| 39 m_layer = make_scoped_ptr(new WebLayerImpl(ContentLayer::create(this))); |
| 29 m_layer->layer()->setIsDrawable(true); | 40 m_layer->layer()->setIsDrawable(true); |
| 30 } | 41 } |
| 31 | 42 |
| 32 WebContentLayerImpl::~WebContentLayerImpl() | 43 WebContentLayerImpl::~WebContentLayerImpl() |
| 33 { | 44 { |
| 34 static_cast<ContentLayer*>(m_layer->layer())->clearClient(); | 45 if (usingPictureLayer()) |
| 46 static_cast<PictureLayer*>(m_layer->layer())->clearClient(); |
| 47 else |
| 48 static_cast<ContentLayer*>(m_layer->layer())->clearClient(); |
| 35 } | 49 } |
| 36 | 50 |
| 37 WebLayer* WebContentLayerImpl::layer() | 51 WebLayer* WebContentLayerImpl::layer() |
| 38 { | 52 { |
| 39 return m_layer.get(); | 53 return m_layer.get(); |
| 40 } | 54 } |
| 41 | 55 |
| 42 void WebContentLayerImpl::setDoubleSided(bool doubleSided) | 56 void WebContentLayerImpl::setDoubleSided(bool doubleSided) |
| 43 { | 57 { |
| 44 m_layer->layer()->setDoubleSided(doubleSided); | 58 m_layer->layer()->setDoubleSided(doubleSided); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 m_client->paintContents(canvas, | 92 m_client->paintContents(canvas, |
| 79 clip, | 93 clip, |
| 80 #if WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT | 94 #if WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT |
| 81 m_layer->layer()->useLCDText(), | 95 m_layer->layer()->useLCDText(), |
| 82 #endif // WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT | 96 #endif // WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT |
| 83 webOpaque); | 97 webOpaque); |
| 84 opaque = webOpaque; | 98 opaque = webOpaque; |
| 85 } | 99 } |
| 86 | 100 |
| 87 } // namespace WebKit | 101 } // namespace WebKit |
| OLD | NEW |