| 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 "WebContentLayerImpl.h" | 6 #include "WebContentLayerImpl.h" |
| 7 | 7 |
| 8 #include "ContentLayerChromium.h" | 8 #include "ContentLayerChromium.h" |
| 9 #include "SkMatrix44.h" | 9 #include "SkMatrix44.h" |
| 10 #include <public/WebContentLayerClient.h> | 10 #include <public/WebContentLayerClient.h> |
| 11 #include <public/WebFloatPoint.h> | 11 #include <public/WebFloatPoint.h> |
| 12 #include <public/WebFloatRect.h> | 12 #include <public/WebFloatRect.h> |
| 13 #include <public/WebRect.h> | 13 #include <public/WebRect.h> |
| 14 #include <public/WebSize.h> | 14 #include <public/WebSize.h> |
| 15 | 15 |
| 16 using namespace WebCore; | 16 using namespace WebCore; |
| 17 | 17 |
| 18 namespace WebKit { | 18 namespace WebKit { |
| 19 | 19 |
| 20 WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) | 20 WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) |
| 21 { | 21 { |
| 22 return new WebContentLayerImpl(client); | 22 return new WebContentLayerImpl(client); |
| 23 } | 23 } |
| 24 | 24 |
| 25 WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) | 25 WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) |
| 26 : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this
)))) | 26 : m_layer(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) |
| 27 , m_client(client) | 27 , m_client(client) |
| 28 { | 28 { |
| 29 m_webLayerImpl->layer()->setIsDrawable(true); | 29 m_layer->layer()->setIsDrawable(true); |
| 30 } | 30 } |
| 31 | 31 |
| 32 WebContentLayerImpl::~WebContentLayerImpl() | 32 WebContentLayerImpl::~WebContentLayerImpl() |
| 33 { | 33 { |
| 34 static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearClient(); | 34 static_cast<ContentLayerChromium*>(m_layer->layer())->clearClient(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 WebLayer* WebContentLayerImpl::layer() | 37 WebLayer* WebContentLayerImpl::layer() |
| 38 { | 38 { |
| 39 return m_webLayerImpl.get(); | 39 return m_layer.get(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void WebContentLayerImpl::setDoubleSided(bool doubleSided) | 42 void WebContentLayerImpl::setDoubleSided(bool doubleSided) |
| 43 { | 43 { |
| 44 m_webLayerImpl->layer()->setDoubleSided(doubleSided); | 44 m_layer->layer()->setDoubleSided(doubleSided); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void WebContentLayerImpl::setContentsScale(float scale) | 47 void WebContentLayerImpl::setContentsScale(float scale) |
| 48 { | 48 { |
| 49 m_webLayerImpl->layer()->setContentsScale(scale); | 49 m_layer->layer()->setContentsScale(scale); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void WebContentLayerImpl::setUseLCDText(bool enable) | 52 void WebContentLayerImpl::setUseLCDText(bool enable) |
| 53 { | 53 { |
| 54 m_webLayerImpl->layer()->setUseLCDText(enable); | 54 m_layer->layer()->setUseLCDText(enable); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) | 57 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) |
| 58 { | 58 { |
| 59 m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable); | 59 m_layer->layer()->setDrawCheckerboardForMissingTiles(enable); |
| 60 } | 60 } |
| 61 | 61 |
| 62 | 62 |
| 63 void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, F
loatRect& opaque) | 63 void WebContentLayerImpl::paintContents(SkCanvas* canvas, const IntRect& clip, F
loatRect& opaque) |
| 64 { | 64 { |
| 65 if (!m_client) | 65 if (!m_client) |
| 66 return; | 66 return; |
| 67 WebFloatRect webOpaque; | 67 WebFloatRect webOpaque; |
| 68 m_client->paintContents(canvas, WebRect(clip), webOpaque); | 68 m_client->paintContents(canvas, WebRect(clip), webOpaque); |
| 69 opaque = webOpaque; | 69 opaque = webOpaque; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace WebKit | 72 } // namespace WebKit |
| OLD | NEW |