Commit 1745f190 authored by Makoto Shimazu's avatar Makoto Shimazu Committed by Commit Bot

Revert "Limit minimum scale of PaintedScrollbarLayer to 1"

This reverts commit 6860e109.

Reason for revert: Speculative revert to fix fast/frames/iframe-scaling-with-scroll.html. https://crbug.com/1136335

Original change's description:
> Limit minimum scale of PaintedScrollbarLayer to 1
>
> This is to avoid too low scale when animating scale above the
> scrollbar layer.
>
> This is not ideal. In the future we should move rasterization of
> scrollbar layers to impl-side to better handle scales
> (crbug.com/1009291).
>
> Bug: 1133997
> Change-Id: I3364754f530914816fe8526c627e6cf12e7942ec
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2453436
> Reviewed-by: David Bokan <bokan@chromium.org>
> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#814681}

TBR=wangxianzhu@chromium.org,bokan@chromium.org

Change-Id: I4554c428bcc5a3d5fef9033e6772f53932d0e256
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1133997, 1136335
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459087Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Makoto Shimazu <shimazu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814987}
parent dda82c9a
......@@ -4,10 +4,6 @@
#include "cc/layers/painted_scrollbar_layer.h"
#include <algorithm>
#include <memory>
#include <utility>
#include "base/auto_reset.h"
#include "cc/layers/painted_scrollbar_layer_impl.h"
#include "cc/paint/skia_paint_canvas.h"
......@@ -144,10 +140,6 @@ bool PaintedScrollbarLayer::UpdateInternalContentScale() {
gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
transform, layer_tree_host()->device_scale_factor());
float scale = std::max(transform_scales.x(), transform_scales.y());
// Clamp minimum scale to 1 to avoid too low scale during scale animation.
// TODO(crbug.com/1009291): Move rasterization of scrollbars to the impl side
// to better handle scale changes.
scale = std::max(1.0f, scale);
bool updated = false;
updated |= UpdateProperty(scale, &internal_contents_scale_);
......
......@@ -4,12 +4,9 @@
#include "cc/layers/painted_scrollbar_layer.h"
#include <memory>
#include "cc/animation/animation_host.h"
#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_painted_scrollbar_layer.h"
#include "cc/test/fake_scrollbar.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/test_task_graph_runner.h"
......@@ -22,20 +19,6 @@ namespace cc {
namespace {
class PaintedScrollbarLayerTest : public testing::Test {
protected:
void SetUp() override {
animation_host_ = AnimationHost::CreateForTesting(ThreadInstance::MAIN);
layer_tree_host_ = FakeLayerTreeHost::Create(
&fake_client_, &task_graph_runner_, animation_host_.get());
}
FakeLayerTreeHostClient fake_client_;
TestTaskGraphRunner task_graph_runner_;
std::unique_ptr<AnimationHost> animation_host_;
std::unique_ptr<FakeLayerTreeHost> layer_tree_host_;
};
class MockScrollbar : public FakeScrollbar {
public:
MockScrollbar() {
......@@ -52,7 +35,14 @@ class MockScrollbar : public FakeScrollbar {
~MockScrollbar() override = default;
};
TEST_F(PaintedScrollbarLayerTest, NeedsPaint) {
TEST(PaintedScrollbarLayerTest, NeedsPaint) {
FakeLayerTreeHostClient fake_client_;
TestTaskGraphRunner task_graph_runner_;
auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN);
auto layer_tree_host = FakeLayerTreeHost::Create(
&fake_client_, &task_graph_runner_, animation_host.get());
auto scrollbar = base::MakeRefCounted<MockScrollbar>();
scoped_refptr<PaintedScrollbarLayer> scrollbar_layer =
PaintedScrollbarLayer::Create(scrollbar);
......@@ -60,10 +50,10 @@ TEST_F(PaintedScrollbarLayerTest, NeedsPaint) {
scrollbar_layer->SetIsDrawable(true);
scrollbar_layer->SetBounds(gfx::Size(100, 100));
layer_tree_host_->SetRootLayer(scrollbar_layer);
UpdateDrawProperties(layer_tree_host_.get());
layer_tree_host->SetRootLayer(scrollbar_layer);
UpdateDrawProperties(layer_tree_host.get());
EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get());
EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host.get());
// Request no paint, but expect them to be painted because they have not
// yet been initialized.
......@@ -105,32 +95,5 @@ TEST_F(PaintedScrollbarLayerTest, NeedsPaint) {
Mock::VerifyAndClearExpectations(scrollbar.get());
}
TEST_F(PaintedScrollbarLayerTest, InternalContentBounds) {
auto scrollbar = base::MakeRefCounted<FakeScrollbar>();
auto scrollbar_layer = PaintedScrollbarLayer::Create(scrollbar);
scrollbar_layer->SetIsDrawable(true);
scrollbar_layer->SetBounds(gfx::Size(10, 100));
layer_tree_host_->SetRootLayer(scrollbar_layer);
UpdateDrawProperties(layer_tree_host_.get());
EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get());
scrollbar_layer->Update();
EXPECT_EQ(gfx::Size(10, 100), scrollbar_layer->internal_content_bounds());
layer_tree_host_->SetViewportRectAndScale(
layer_tree_host_->device_viewport_rect(), 2.0f,
layer_tree_host_->local_surface_id_from_parent());
UpdateDrawProperties(layer_tree_host_.get());
scrollbar_layer->Update();
EXPECT_EQ(gfx::Size(20, 200), scrollbar_layer->internal_content_bounds());
layer_tree_host_->SetViewportRectAndScale(
layer_tree_host_->device_viewport_rect(), 0.1f,
layer_tree_host_->local_surface_id_from_parent());
UpdateDrawProperties(layer_tree_host_.get());
scrollbar_layer->Update();
EXPECT_EQ(gfx::Size(10, 100), scrollbar_layer->internal_content_bounds());
}
} // namespace
} // namespace cc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment