diff options
-rw-r--r-- | ui/compositor/compositor.cc | 19 | ||||
-rw-r--r-- | ui/compositor/compositor.h | 5 | ||||
-rw-r--r-- | ui/compositor/layer.cc | 162 | ||||
-rw-r--r-- | ui/compositor/layer.h | 16 | ||||
-rw-r--r-- | ui/compositor/layer_unittest.cc | 54 |
5 files changed, 252 insertions, 4 deletions
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 5c86dff..50564f0 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -150,18 +150,25 @@ Compositor::Compositor(CompositorDelegate* delegate, settings.refreshRate = test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + host_.initialize(this, *root_web_layer_, settings); + root_web_layer_->setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); +#else host_.initialize(this, root_web_layer_, settings); - host_.setSurfaceReady(); root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); +#endif + host_.setSurfaceReady(); } Compositor::~Compositor() { // Don't call |CompositorDelegate::ScheduleDraw| from this point. delegate_ = NULL; +#if !defined(WEBLAYER_IS_PURE_VIRTUAL) // There's a cycle between |root_web_layer_| and |host_|, which results in // leaking and/or crashing. Explicitly set the root layer to NULL so the cycle // is broken. host_.setRootLayer(NULL); +#endif if (root_layer_) root_layer_->SetCompositor(NULL); @@ -212,9 +219,15 @@ void Compositor::SetRootLayer(Layer* root_layer) { root_layer_ = root_layer; if (root_layer_ && !root_layer_->GetCompositor()) root_layer_->SetCompositor(this); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + root_web_layer_->removeAllChildren(); + if (root_layer_) + root_web_layer_->addChild(root_layer_->web_layer()); +#else root_web_layer_.removeAllChildren(); if (root_layer_) root_web_layer_.addChild(root_layer_->web_layer()); +#endif } void Compositor::Draw(bool force_clear) { @@ -268,7 +281,11 @@ void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { return; size_ = size_in_pixel; host_.setViewportSize(size_in_pixel); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + root_web_layer_->setBounds(size_in_pixel); +#else root_web_layer_.setBounds(size_in_pixel); +#endif if (device_scale_factor_ != scale) { device_scale_factor_ = scale; diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index f598542..27b8dc3 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -7,6 +7,7 @@ #include "base/hash_tables.h" #include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" @@ -241,7 +242,11 @@ class COMPOSITOR_EXPORT Compositor ObserverList<CompositorObserver> observer_list_; gfx::AcceleratedWidget widget_; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + scoped_ptr<WebKit::WebLayer> root_web_layer_; +#else WebKit::WebLayer root_web_layer_; +#endif WebKit::WebLayerTreeView host_; // This is set to true when the swap buffers has been posted and we're waiting diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index d6b2257..94caf4b 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc @@ -61,6 +61,9 @@ Layer::Layer() layer_mask_(NULL), layer_mask_back_link_(NULL), delegate_(NULL), +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_(NULL), +#endif scale_content_(true), device_scale_factor_(1.0f) { CreateWebLayer(); @@ -103,7 +106,11 @@ Layer::~Layer() { layer_mask_back_link_->SetMaskLayer(NULL); for (size_t i = 0; i < children_.size(); ++i) children_[i]->parent_ = NULL; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->removeFromParent(); +#else web_layer_.removeFromParent(); +#endif } Compositor* Layer::GetCompositor() { @@ -127,7 +134,11 @@ void Layer::Add(Layer* child) { child->parent_->Remove(child); child->parent_ = this; children_.push_back(child); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->addChild(child->web_layer_); +#else web_layer_.addChild(child->web_layer_); +#endif child->OnDeviceScaleFactorChanged(device_scale_factor_); } @@ -137,7 +148,11 @@ void Layer::Remove(Layer* child) { DCHECK(i != children_.end()); children_.erase(i); child->parent_ = NULL; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + child->web_layer_->removeFromParent(); +#else child->web_layer_.removeFromParent(); +#endif } void Layer::StackAtTop(Layer* child) { @@ -205,11 +220,19 @@ gfx::Rect Layer::GetTargetBounds() const { } void Layer::SetMasksToBounds(bool masks_to_bounds) { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setMasksToBounds(masks_to_bounds); +#else web_layer_.setMasksToBounds(masks_to_bounds); +#endif } bool Layer::GetMasksToBounds() const { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + return web_layer_->masksToBounds(); +#else return web_layer_.masksToBounds(); +#endif } void Layer::SetOpacity(float opacity) { @@ -224,7 +247,11 @@ void Layer::SetBackgroundBlur(int blur_radius) { filters.append(WebKit::WebFilterOperation::createBlurFilter( background_blur_radius_)); } +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setBackgroundFilters(filters); +#else web_layer_.setBackgroundFilters(filters); +#endif } void Layer::SetLayerSaturation(float saturation) { @@ -275,8 +302,13 @@ void Layer::SetMaskLayer(Layer* layer_mask) { if (layer_mask_) layer_mask_->layer_mask_back_link_ = NULL; layer_mask_ = layer_mask; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setMaskLayer( + layer_mask ? layer_mask->web_layer() : NULL); +#else web_layer_.setMaskLayer( layer_mask ? layer_mask->web_layer() : WebKit::WebLayer()); +#endif // We need to reference the linked object so that it can properly break the // link to us when it gets deleted. if (layer_mask) @@ -303,7 +335,11 @@ void Layer::SetLayerFilters() { layer_brightness_)); } +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setFilters(filters); +#else web_layer_.setFilters(filters); +#endif } float Layer::GetTargetOpacity() const { @@ -357,7 +393,11 @@ void Layer::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { fills_bounds_opaquely_ = fills_bounds_opaquely; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setOpaque(fills_bounds_opaquely); +#else web_layer_.setOpaque(fills_bounds_opaquely); +#endif RecomputeDebugBorderColor(); } @@ -367,31 +407,73 @@ void Layer::SetExternalTexture(Texture* texture) { texture_ = texture; if (web_layer_is_accelerated_ != layer_updated_externally_) { // Switch to a different type of layer. +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->removeAllChildren(); + content_layer_.reset(); + solid_color_layer_.reset(); + WebKit::WebLayer* new_layer = NULL; +#else web_layer_.removeAllChildren(); WebKit::WebLayer new_layer; +#endif if (layer_updated_externally_) { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + texture_layer_.reset(WebKit::WebExternalTextureLayer::create()); + texture_layer_->setFlipped(texture_->flipped()); + new_layer = texture_layer_->layer(); +#else WebKit::WebExternalTextureLayer texture_layer = WebKit::WebExternalTextureLayer::create(); texture_layer.setFlipped(texture_->flipped()); new_layer = texture_layer; +#endif } else { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + texture_layer_.reset(); + solid_color_layer_.reset(); + content_layer_.reset(WebKit::WebContentLayer::create(this)); + new_layer = content_layer_->layer(); +#else new_layer = WebKit::WebContentLayer::create(this); +#endif } if (parent_) { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + DCHECK(parent_->web_layer_); + parent_->web_layer_->replaceChild(web_layer_, new_layer); +#else DCHECK(!parent_->web_layer_.isNull()); parent_->web_layer_.replaceChild(web_layer_, new_layer); +#endif } +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_= new_layer; +#else web_layer_ = new_layer; +#endif web_layer_is_accelerated_ = layer_updated_externally_; for (size_t i = 0; i < children_.size(); ++i) { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + DCHECK(children_[i]->web_layer_); + web_layer_->addChild(children_[i]->web_layer_); +#else DCHECK(!children_[i]->web_layer_.isNull()); web_layer_.addChild(children_[i]->web_layer_); +#endif } +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); + web_layer_->setOpaque(fills_bounds_opaquely_); + web_layer_->setOpacity(visible_ ? opacity_ : 0.f); + web_layer_->setDebugBorderWidth(show_debug_borders_ ? 2 : 0); + web_layer_->setForceRenderSurface(force_render_surface_); +#else web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); web_layer_.setOpaque(fills_bounds_opaquely_); web_layer_.setOpacity(visible_ ? opacity_ : 0.f); web_layer_.setDebugBorderWidth(show_debug_borders_ ? 2 : 0); web_layer_.setForceRenderSurface(force_render_surface_); +#endif RecomputeTransform(); RecomputeDebugBorderColor(); } @@ -401,8 +483,12 @@ void Layer::SetExternalTexture(Texture* texture) { void Layer::SetColor(SkColor color) { DCHECK_EQ(type_, LAYER_SOLID_COLOR); // WebColor is equivalent to SkColor, per WebColor.h. +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + solid_color_layer_->setBackgroundColor(static_cast<WebKit::WebColor>(color)); +#else web_layer_.to<WebKit::WebSolidColorLayer>().setBackgroundColor( static_cast<WebKit::WebColor>(color)); +#endif SetFillsBoundsOpaquely(SkColorGetA(color) == 0xFF); } @@ -447,11 +533,15 @@ void Layer::SendDamagedRects() { damaged_in_pixel.y(), damaged_in_pixel.width(), damaged_in_pixel.height()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->invalidateRect(web_rect); +#else if (!web_layer_is_accelerated_) web_layer_.to<WebKit::WebContentLayer>().invalidateRect(web_rect); else web_layer_.to<WebKit::WebExternalTextureLayer>().invalidateRect( web_rect); +#endif } damaged_region_.setEmpty(); } @@ -508,7 +598,11 @@ void Layer::SetForceRenderSurface(bool force) { return; force_render_surface_ = force; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setForceRenderSurface(force_render_surface_); +#else web_layer_.setForceRenderSurface(force_render_surface_); +#endif } float Layer::GetCombinedOpacity() const { @@ -540,8 +634,13 @@ void Layer::StackRelativeTo(Layer* child, Layer* other, bool above) { children_.erase(children_.begin() + child_i); children_.insert(children_.begin() + dest_i, child); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + child->web_layer_->removeFromParent(); + web_layer_->insertChild(child->web_layer_, dest_i); +#else child->web_layer_.removeFromParent(); web_layer_.insertChild(child->web_layer_, dest_i); +#endif } bool Layer::ConvertPointForAncestor(const Layer* ancestor, @@ -613,7 +712,11 @@ void Layer::SetOpacityImmediately(float opacity) { opacity_ = opacity; if (visible_) +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setOpacity(opacity); +#else web_layer_.setOpacity(opacity); +#endif RecomputeDebugBorderColor(); if (schedule_draw) ScheduleDraw(); @@ -625,7 +728,11 @@ void Layer::SetVisibilityImmediately(bool visible) { visible_ = visible; // TODO(piman): Expose a visibility flag on WebLayer. +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setOpacity(visible_ ? opacity_ : 0.f); +#else web_layer_.setOpacity(visible_ ? opacity_ : 0.f); +#endif } void Layer::SetBrightnessImmediately(float brightness) { @@ -690,16 +797,32 @@ float Layer::GetGrayscaleForAnimation() const { } void Layer::CreateWebLayer() { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + if (type_ == LAYER_SOLID_COLOR) { + solid_color_layer_.reset(WebKit::WebSolidColorLayer::create()); + web_layer_ = solid_color_layer_->layer(); + } else { + content_layer_.reset(WebKit::WebContentLayer::create(this)); + web_layer_ = content_layer_->layer(); + } +#else if (type_ == LAYER_SOLID_COLOR) web_layer_ = WebKit::WebSolidColorLayer::create(); else web_layer_ = WebKit::WebContentLayer::create(this); - web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); - web_layer_.setOpaque(true); +#endif web_layer_is_accelerated_ = false; show_debug_borders_ = CommandLine::ForCurrentProcess()->HasSwitch( switches::kUIShowLayerBorders); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); + web_layer_->setOpaque(true); + web_layer_->setDebugBorderWidth(show_debug_borders_ ? 2 : 0); +#else + web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); + web_layer_.setOpaque(true); web_layer_.setDebugBorderWidth(show_debug_borders_ ? 2 : 0); +#endif } void Layer::RecomputeTransform() { @@ -715,22 +838,43 @@ void Layer::RecomputeTransform() { transform.ConcatTransform(transform_); transform.ConcatTranslate(bounds_.x(), bounds_.y()); transform.ConcatTransform(scale_translate); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setTransform(transform.matrix()); +#else web_layer_.setTransform(transform.matrix()); +#endif } void Layer::RecomputeDrawsContentAndUVRect() { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + DCHECK(web_layer_); +#else DCHECK(!web_layer_.isNull()); +#endif bool should_draw = type_ != LAYER_NOT_DRAWN; if (!web_layer_is_accelerated_) { - if (type_ != LAYER_SOLID_COLOR) + if (type_ != LAYER_SOLID_COLOR) { +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setDrawsContent(should_draw); +#else web_layer_.to<WebKit::WebContentLayer>().setDrawsContent(should_draw); +#endif + } +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setBounds(ConvertSizeToPixel(this, bounds_.size())); +#else web_layer_.setBounds(ConvertSizeToPixel(this, bounds_.size())); +#endif } else { DCHECK(texture_); unsigned int texture_id = texture_->texture_id(); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + texture_layer_->setTextureId(should_draw ? texture_id : 0); +#else WebKit::WebExternalTextureLayer texture_layer = web_layer_.to<WebKit::WebExternalTextureLayer>(); texture_layer.setTextureId(should_draw ? texture_id : 0); +#endif gfx::Size texture_size; if (scale_content_) @@ -745,10 +889,18 @@ void Layer::RecomputeDrawsContentAndUVRect() { 0, static_cast<float>(size.width())/texture_size.width(), static_cast<float>(size.height())/texture_size.height()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + texture_layer_->setUVRect(rect); +#else texture_layer.setUVRect(rect); +#endif gfx::Size size_in_pixel = ConvertSizeToPixel(this, size); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setBounds(size_in_pixel); +#else web_layer_.setBounds(size_in_pixel); +#endif } } @@ -760,7 +912,11 @@ void Layer::RecomputeDebugBorderColor() { bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); if (!opaque) color |= 0xFF; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + web_layer_->setDebugBorderColor(color); +#else web_layer_.setDebugBorderColor(color); +#endif } } // namespace ui diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index 4eb39cf..a999de8 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h @@ -14,6 +14,9 @@ #include "base/message_loop.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClient.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" +#include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h" +#include "third_party/WebKit/Source/Platform/chromium/public/WebSolidColorLayer.h" +#include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureLayer.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkRegion.h" #include "ui/compositor/compositor.h" @@ -258,7 +261,11 @@ class COMPOSITOR_EXPORT Layer WebKit::WebRect& opaque); #endif +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + WebKit::WebLayer* web_layer() { return web_layer_; } +#else WebKit::WebLayer web_layer() { return web_layer_; } +#endif float device_scale_factor() const { return device_scale_factor_; } @@ -373,7 +380,16 @@ class COMPOSITOR_EXPORT Layer scoped_ptr<LayerAnimator> animator_; +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + // Ownership of the layer is held through one of the strongly typed layer + // pointers, depending on which sort of layer this is. + scoped_ptr<WebKit::WebContentLayer> content_layer_; + scoped_ptr<WebKit::WebExternalTextureLayer> texture_layer_; + scoped_ptr<WebKit::WebSolidColorLayer> solid_color_layer_; + WebKit::WebLayer* web_layer_; +#else WebKit::WebLayer web_layer_; +#endif bool web_layer_is_accelerated_; bool show_debug_borders_; diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index 08623a7..a0c293f 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc @@ -696,9 +696,15 @@ TEST_F(LayerWithNullDelegateTest, Visibility) { EXPECT_TRUE(l1->IsDrawn()); EXPECT_TRUE(l2->IsDrawn()); EXPECT_TRUE(l3->IsDrawn()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + EXPECT_EQ(1.f, l1->web_layer()->opacity()); + EXPECT_EQ(1.f, l2->web_layer()->opacity()); + EXPECT_EQ(1.f, l3->web_layer()->opacity()); +#else EXPECT_EQ(1.f, l1->web_layer().opacity()); EXPECT_EQ(1.f, l2->web_layer().opacity()); EXPECT_EQ(1.f, l3->web_layer().opacity()); +#endif compositor()->SetRootLayer(l1.get()); @@ -708,19 +714,31 @@ TEST_F(LayerWithNullDelegateTest, Visibility) { EXPECT_FALSE(l1->IsDrawn()); EXPECT_FALSE(l2->IsDrawn()); EXPECT_FALSE(l3->IsDrawn()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + EXPECT_EQ(0.f, l1->web_layer()->opacity()); +#else EXPECT_EQ(0.f, l1->web_layer().opacity()); +#endif l3->SetVisible(false); EXPECT_FALSE(l1->IsDrawn()); EXPECT_FALSE(l2->IsDrawn()); EXPECT_FALSE(l3->IsDrawn()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + EXPECT_EQ(0.f, l3->web_layer()->opacity()); +#else EXPECT_EQ(0.f, l3->web_layer().opacity()); +#endif l1->SetVisible(true); EXPECT_TRUE(l1->IsDrawn()); EXPECT_TRUE(l2->IsDrawn()); EXPECT_FALSE(l3->IsDrawn()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + EXPECT_EQ(1.f, l1->web_layer()->opacity()); +#else EXPECT_EQ(1.f, l1->web_layer().opacity()); +#endif } // Checks that stacking-related methods behave as advertised. @@ -1128,9 +1146,17 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) { EXPECT_EQ("10,20 200x220", root->bounds().ToString()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + gfx::Size size_in_pixel = root->web_layer()->bounds(); +#else gfx::Size size_in_pixel = root->web_layer().bounds(); +#endif EXPECT_EQ("200x220", size_in_pixel.ToString()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + size_in_pixel = l1->web_layer()->bounds(); +#else size_in_pixel = l1->web_layer().bounds(); +#endif EXPECT_EQ("140x180", size_in_pixel.ToString()); // No scale change, so no scale notification. EXPECT_EQ(0.0f, root_delegate.device_scale_factor()); @@ -1145,9 +1171,17 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) { EXPECT_EQ("10,20 200x220", root->bounds().ToString()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); // Pixel size must have been scaled up. +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + size_in_pixel = root->web_layer()->bounds(); +#else size_in_pixel = root->web_layer().bounds(); +#endif EXPECT_EQ("400x440", size_in_pixel.ToString()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + size_in_pixel = l1->web_layer()->bounds(); +#else size_in_pixel = l1->web_layer().bounds(); +#endif EXPECT_EQ("280x360", size_in_pixel.ToString()); // New scale factor must have been notified. EXPECT_EQ(2.0f, root_delegate.device_scale_factor()); @@ -1165,9 +1199,17 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) { EXPECT_EQ("10,20 200x220", root->bounds().ToString()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); // Pixel size must have been scaled down. +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + size_in_pixel = root->web_layer()->bounds(); +#else size_in_pixel = root->web_layer().bounds(); +#endif EXPECT_EQ("200x220", size_in_pixel.ToString()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + size_in_pixel = l1->web_layer()->bounds(); +#else size_in_pixel = l1->web_layer().bounds(); +#endif EXPECT_EQ("140x180", size_in_pixel.ToString()); // New scale factor must have been notified. EXPECT_EQ(1.0f, root_delegate.device_scale_factor()); @@ -1210,7 +1252,11 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleReparent) { root->Add(l1.get()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + gfx::Size size_in_pixel = l1->web_layer()->bounds(); +#else gfx::Size size_in_pixel = l1->web_layer().bounds(); +#endif EXPECT_EQ("140x180", size_in_pixel.ToString()); EXPECT_EQ(0.0f, l1_delegate.device_scale_factor()); @@ -1225,13 +1271,21 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleReparent) { GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); // Sanity check on root and l1. EXPECT_EQ("10,20 200x220", root->bounds().ToString()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + size_in_pixel = l1->web_layer()->bounds(); +#else size_in_pixel = l1->web_layer().bounds(); +#endif EXPECT_EQ("140x180", size_in_pixel.ToString()); root->Add(l1.get()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); +#if defined(WEBLAYER_IS_PURE_VIRTUAL) + size_in_pixel = l1->web_layer()->bounds(); +#else size_in_pixel = l1->web_layer().bounds(); +#endif EXPECT_EQ("280x360", size_in_pixel.ToString()); EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); RunPendingMessages(); |