Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Issue 2803853007: Ignore rounding error between clip_layer_length_ and scroll_layer_length_ (Closed)

Created:
3 years, 8 months ago by chaopeng
Modified:
3 years, 8 months ago
CC:
cc-bugs_chromium.org, chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Ignore rounding error between clip_layer_length_ and scroll_layer_length_ We determined overlay scrollbar should show by comparing clip_layer_length with scroll_layer_length of scrollbar_layer_impl. clip_layer_length_ has rounding error form pagescale division. The scrollbar will appear when the rounding error makes clip_layer_length < scroll_layer_length. In this patch, we change to use ceil of clip length in device pixel and floor of scroll length in device pixel for compare. That means we only appear the scrollbar when clip_layer_length is at least 1 physical px smaller than scroll_layer_length. BUG=709062 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel Review-Url: https://codereview.chromium.org/2803853007 Cr-Commit-Position: refs/heads/master@{#466570} Committed: https://chromium.googlesource.com/chromium/src/+/beb19669855bab47cda70ea40fbbe154eb3bfdc5

Patch Set 1 #

Total comments: 1

Patch Set 2 : bokan comment addressed #

Patch Set 3 : add test #

Total comments: 5

Patch Set 4 : remove pagescale & move test to ScrollbarLayerTest #

Patch Set 5 : rebase update #

Total comments: 1

Patch Set 6 : add page_scale #

Total comments: 1

Patch Set 7 : change scroll to floor #

Patch Set 8 : change to epsilon #

Total comments: 2

Patch Set 9 : expose IsFloatNearlyTheSame & add comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+68 lines, -5 lines) Patch
M cc/base/math_util.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M cc/base/math_util.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M cc/base/math_util_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download
M cc/layers/scrollbar_layer_impl_base.cc View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
M cc/layers/scrollbar_layer_unittest.cc View 1 2 3 4 5 6 7 2 chunks +39 lines, -0 lines 0 comments Download
M cc/test/layer_test_common.h View 1 2 1 chunk +19 lines, -0 lines 0 comments Download
M content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 72 (45 generated)
chaopeng
PTAL. Thank you.
3 years, 8 months ago (2017-04-07 21:49:09 UTC) #4
bokan
https://codereview.chromium.org/2803853007/diff/20001/cc/layers/scrollbar_layer_impl_base.cc File cc/layers/scrollbar_layer_impl_base.cc (right): https://codereview.chromium.org/2803853007/diff/20001/cc/layers/scrollbar_layer_impl_base.cc#newcode71 cc/layers/scrollbar_layer_impl_base.cc:71: !MathUtil::IsFloatNearlyTheSame(clip_layer_length_, Thinking about this some more: this limit is ...
3 years, 8 months ago (2017-04-10 14:20:56 UTC) #13
chaopeng
Use ceil to resolve the rounding error. PTAL. Thank you.
3 years, 8 months ago (2017-04-10 16:11:46 UTC) #15
bokan
this looks fine to me. But it'll need a test.
3 years, 8 months ago (2017-04-10 19:40:36 UTC) #16
chaopeng
Added test. PTAL. Thank you.
3 years, 8 months ago (2017-04-14 04:12:43 UTC) #18
bokan
https://codereview.chromium.org/2803853007/diff/80001/cc/layers/scrollbar_layer_impl_base.cc File cc/layers/scrollbar_layer_impl_base.cc (right): https://codereview.chromium.org/2803853007/diff/80001/cc/layers/scrollbar_layer_impl_base.cc#newcode70 cc/layers/scrollbar_layer_impl_base.cc:70: float page_scale_factor = layer_tree_impl()->current_page_scale_factor(); I don't think this is ...
3 years, 8 months ago (2017-04-18 17:39:09 UTC) #19
chaopeng
Updated, PTAL. Thank you.
3 years, 8 months ago (2017-04-19 18:21:19 UTC) #20
bokan
https://codereview.chromium.org/2803853007/diff/120001/cc/layers/scrollbar_layer_impl_base.cc File cc/layers/scrollbar_layer_impl_base.cc (right): https://codereview.chromium.org/2803853007/diff/120001/cc/layers/scrollbar_layer_impl_base.cc#newcode76 cc/layers/scrollbar_layer_impl_base.cc:76: int clip_layer_length = std::ceil(clip_layer_length_ * device_scale_factor); Sorry to flip ...
3 years, 8 months ago (2017-04-20 21:34:36 UTC) #29
chaopeng
On 2017/04/20 21:34:36, bokan wrote: > https://codereview.chromium.org/2803853007/diff/120001/cc/layers/scrollbar_layer_impl_base.cc > File cc/layers/scrollbar_layer_impl_base.cc (right): > > https://codereview.chromium.org/2803853007/diff/120001/cc/layers/scrollbar_layer_impl_base.cc#newcode76 > ...
3 years, 8 months ago (2017-04-20 21:56:28 UTC) #30
bokan
https://codereview.chromium.org/2803853007/diff/140001/cc/layers/scrollbar_layer_impl_base.cc File cc/layers/scrollbar_layer_impl_base.cc (right): https://codereview.chromium.org/2803853007/diff/140001/cc/layers/scrollbar_layer_impl_base.cc#newcode80 cc/layers/scrollbar_layer_impl_base.cc:80: std::ceil(scroll_layer_length_ * page_scale_factor * device_scale_factor); We should floor scroll ...
3 years, 8 months ago (2017-04-20 22:09:49 UTC) #35
bokan
Thanks, lgtm +aelias@ for CC owner since he's helped us deal with precision issues in ...
3 years, 8 months ago (2017-04-20 22:53:48 UTC) #37
chaopeng
On 2017/04/20 22:09:49, bokan wrote: > https://codereview.chromium.org/2803853007/diff/140001/cc/layers/scrollbar_layer_impl_base.cc > File cc/layers/scrollbar_layer_impl_base.cc (right): > > https://codereview.chromium.org/2803853007/diff/140001/cc/layers/scrollbar_layer_impl_base.cc#newcode80 > ...
3 years, 8 months ago (2017-04-20 22:53:58 UTC) #38
bokan
Also, please update the commit message, the approach has changed somewhat since it was written.
3 years, 8 months ago (2017-04-20 22:54:22 UTC) #39
aelias_OOO_until_Jul13
I'm OK with the idea of using ceil() on the clip layer -- in general ...
3 years, 8 months ago (2017-04-21 00:36:47 UTC) #45
chaopeng
On 2017/04/21 00:36:47, aelias wrote: > I'm OK with the idea of using ceil() on ...
3 years, 8 months ago (2017-04-21 00:56:22 UTC) #46
aelias_OOO_until_Jul13
OK, never mind what I said above, I looked at the bug history and see ...
3 years, 8 months ago (2017-04-21 01:22:44 UTC) #47
aelias_OOO_until_Jul13
OK, I see that was your original solution. Well, apologies for the code reviewer disagreement/whiplash ...
3 years, 8 months ago (2017-04-21 01:32:26 UTC) #48
aelias_OOO_until_Jul13
Note your new test is currently red because the epsilon yielded by bokan@'s method is ...
3 years, 8 months ago (2017-04-21 01:50:41 UTC) #49
chaopeng
On 2017/04/21 01:50:41, aelias wrote: > Note your new test is currently red because the ...
3 years, 8 months ago (2017-04-21 02:00:13 UTC) #50
aelias_OOO_until_Jul13
One more thing, since you need to change it anyway, could you rewrite the test ...
3 years, 8 months ago (2017-04-21 02:04:10 UTC) #51
bokan
I agree in practice an epsilon will likely work well enough so aelias' suggestion sgtm ...
3 years, 8 months ago (2017-04-21 14:02:26 UTC) #52
chaopeng
Updated, PTAL. +enne for math. Thank you.
3 years, 8 months ago (2017-04-21 15:08:57 UTC) #54
enne (OOO)
https://codereview.chromium.org/2803853007/diff/180001/cc/base/math_util.cc File cc/base/math_util.cc (right): https://codereview.chromium.org/2803853007/diff/180001/cc/base/math_util.cc#newcode820 cc/base/math_util.cc:820: bool MathUtil::IsFloatNearlyTheSame(float left, float right) { I'm not sure ...
3 years, 8 months ago (2017-04-21 22:54:33 UTC) #59
chaopeng
On 2017/04/21 22:54:33, enne wrote: > https://codereview.chromium.org/2803853007/diff/180001/cc/base/math_util.cc > File cc/base/math_util.cc (right): > > https://codereview.chromium.org/2803853007/diff/180001/cc/base/math_util.cc#newcode820 > ...
3 years, 8 months ago (2017-04-21 23:38:03 UTC) #61
enne (OOO)
lgtm
3 years, 8 months ago (2017-04-23 21:41:09 UTC) #66
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2803853007/220001
3 years, 8 months ago (2017-04-23 22:17:19 UTC) #69
commit-bot: I haz the power
3 years, 8 months ago (2017-04-23 23:10:15 UTC) #72
Message was sent while issue was closed.
Committed patchset #9 (id:220001) as
https://chromium.googlesource.com/chromium/src/+/beb19669855bab47cda70ea40fbb...

Powered by Google App Engine
This is Rietveld 408576698