Commit b0e8b871 authored by Luna Lu's avatar Luna Lu Committed by Commit Bot

Revert "Fix overlay scrollbar at huge scroll offsets"

This reverts commit 9e21c73c.

Reason for revert: suspect causing WebKit Android (Nexus 4) to fail on webkit_unit_tests
https://uberchromegw.corp.google.com/i/chromium.webkit/builders/WebKit%20Android%20%28Nexus4%29/builds/67957

Original change's description:
> Fix overlay scrollbar at huge scroll offsets
> 
> The overlay scrollbar ThumbPosition method was losing precision at very
> high scroll offsets. This would cause it to drift away from where we
> actually show the thumb from the compositor so the hit testing would be
> unreliable.
> 
> Looking at this method, there's no reason it should need to be any
> different from the base class ScrollbarTheme::ThumbPosition which is
> robust under high scroll offsets so the solution here is to simply
> remove the override. Less code, less bugs.
> 
> Bug: 739668
> Change-Id: Ib90152d989931cd0bcc0bddfb226d97d577ce575
> Reviewed-on: https://chromium-review.googlesource.com/598734
> Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Commit-Queue: David Bokan <bokan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#491766}

TBR=bokan@chromium.org,jbroman@chromium.org,dtapuska@chromium.org

Change-Id: I44f227bc5956899ff43e7c6d96e7c5596666ae36
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 739668
Reviewed-on: https://chromium-review.googlesource.com/600848Reviewed-by: default avatarLuna Lu <loonybear@chromium.org>
Commit-Queue: Luna Lu <loonybear@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491798}
parent fe594161
......@@ -203,38 +203,6 @@ TEST_P(ScrollbarAppearanceTest, ThemeEngineDefinesMinimumThumbLength) {
EXPECT_EQ(StubWebThemeEngine::kMinimumVerticalLength,
theme.ThumbLength(*scrollable_area->VerticalScrollbar()));
}
// Ensure thumb position is correctly calculated even at ridiculously large
// scales.
TEST_P(ScrollbarAppearanceTest, HugeScrollingThumbPosition) {
ScopedTestingPlatformSupport<ScrollbarTestingPlatformSupport> platform;
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
WebView().Resize(WebSize(1000, 1000));
SimRequest request("https://example.com/test.html", "text/html");
LoadURL("https://example.com/test.html");
request.Complete(
"<style> body { margin: 0px; height: 10000000px; } </style>");
ScrollableArea* scrollable_area =
GetDocument().View()->LayoutViewportScrollableArea();
Compositor().BeginFrame();
scrollable_area->SetScrollOffset(ScrollOffset(0, 10000000),
kProgrammaticScroll);
int scroll_y = scrollable_area->GetScrollOffset().Height();
ASSERT_EQ(9999000, scroll_y);
Scrollbar* scrollbar = scrollable_area->VerticalScrollbar();
ASSERT_TRUE(scrollbar);
int maximumThumbPosition =
WebView().Size().height - StubWebThemeEngine::kMinimumVerticalLength;
EXPECT_EQ(maximumThumbPosition,
scrollbar->GetTheme().ThumbPosition(*scrollbar));
}
#endif
} // namespace
......
......@@ -103,6 +103,17 @@ double ScrollbarThemeOverlay::OverlayScrollbarFadeOutDurationSeconds() const {
return style.fade_out_duration_seconds;
}
int ScrollbarThemeOverlay::ThumbPosition(const ScrollbarThemeClient& scrollbar,
float scroll_position) {
if (!scrollbar.TotalSize())
return 0;
int track_len = TrackLength(scrollbar);
float proportion =
static_cast<float>(scroll_position) / scrollbar.TotalSize();
return round(proportion * track_len);
}
int ScrollbarThemeOverlay::ThumbLength(const ScrollbarThemeClient& scrollbar) {
int track_len = TrackLength(scrollbar);
......
......@@ -59,6 +59,8 @@ class PLATFORM_EXPORT ScrollbarThemeOverlay : public ScrollbarTheme {
double OverlayScrollbarFadeOutDelaySeconds() const override;
double OverlayScrollbarFadeOutDurationSeconds() const override;
int ThumbPosition(const ScrollbarThemeClient&,
float scroll_position) override;
int ThumbLength(const ScrollbarThemeClient&) override;
bool HasButtons(const ScrollbarThemeClient&) override { return false; }
......
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