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

Issue 304973003: [Aura] Translate web contents area to nearest physical pixel boundary (Closed)

Created:
6 years, 6 months ago by jamesr
Modified:
6 years, 6 months ago
CC:
chromium-reviews, yusukes+watch_chromium.org, yukishiino+watch_chromium.org, jam, penghuang+watch_chromium.org, sievers+watch_chromium.org, jbauman+watch_chromium.org, nona+watch_chromium.org, darin-cc_chromium.org, kalyank, piman+watch_chromium.org, danakj+watch_chromium.org, James Su, miu+watch_chromium.org, cpu_(ooo_6.6-7.5), jbauman, enne (OOO)
Visibility:
Public.

Description

[Aura] Translate web contents area to nearest physical pixel boundary Views positions all views, including the views::WebView containing the aura::Window that contains the content::RenderWidgetHostViewAura, to integral DIP positions. With a non-integral device scale factor, this could position the RWHVA in between physical pixel boundaries which results in filtering the composited output from the renderer. This looks blurry and bad. This patch computes the delta to the top-left-most integer physical pixel inside the desired bounds and translates the web contents layer by that amount. This means that the top left corner of the web contents shows up at an exact physical pixel and thus the web contents is not filtered. This means that some amount on the bottom or right edge of the web contents area may be clipped, but this amount is always less that one DIP. BUG=370074, 378620 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=274686

Patch Set 1 #

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -0 lines) Patch
M content/browser/renderer_host/render_widget_host_view_aura.h View 1 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura.cc View 1 3 chunks +21 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
jamesr
6 years, 6 months ago (2014-06-03 01:28:58 UTC) #1
Ben Goodger (Google)
Do you know if this issue generally affects all aura windows, or is it just ...
6 years, 6 months ago (2014-06-03 06:21:35 UTC) #2
danakj
Could we do something more general in the compositor where we know the screen space ...
6 years, 6 months ago (2014-06-03 10:15:43 UTC) #3
jamesr
On 2014/06/03 06:21:35, Ben Goodger (Google) wrote: > Do you know if this issue generally ...
6 years, 6 months ago (2014-06-03 17:13:01 UTC) #4
jamesr
On 2014/06/03 10:15:43, danakj (OOO_back_june_6) wrote: > Could we do something more general in the ...
6 years, 6 months ago (2014-06-03 17:18:04 UTC) #5
Ben Goodger (Google)
On 2014/06/03 17:13:01, jamesr wrote: > On 2014/06/03 06:21:35, Ben Goodger (Google) wrote: > > ...
6 years, 6 months ago (2014-06-03 20:49:50 UTC) #6
jamesr
The CQ bit was checked by jamesr@chromium.org
6 years, 6 months ago (2014-06-03 20:54:19 UTC) #7
jamesr
On 2014/06/03 20:49:50, Ben Goodger (Google) wrote: > On 2014/06/03 17:13:01, jamesr wrote: > > ...
6 years, 6 months ago (2014-06-03 20:55:00 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jamesr@chromium.org/304973003/20001
6 years, 6 months ago (2014-06-03 20:55:32 UTC) #9
chromium-reviews
On Tue, Jun 3, 2014 at 7:18 PM, <jamesr@chromium.org> wrote: > On 2014/06/03 10:15:43, danakj ...
6 years, 6 months ago (2014-06-03 21:17:24 UTC) #10
chromium-reviews
On Tue, Jun 3, 2014 at 2:17 PM, Dana Jansens <danakj@google.com> wrote: > On Tue, ...
6 years, 6 months ago (2014-06-03 21:31:38 UTC) #11
chromium-reviews
On Tue, Jun 3, 2014 at 11:31 PM, James Robinson <jamesr@google.com> wrote: > On Tue, ...
6 years, 6 months ago (2014-06-03 21:38:46 UTC) #12
chromium-reviews
On Tue, Jun 3, 2014 at 2:38 PM, Dana Jansens <danakj@google.com> wrote: > On Tue, ...
6 years, 6 months ago (2014-06-03 21:44:05 UTC) #13
chromium-reviews
On Tue, Jun 3, 2014 at 11:44 PM, James Robinson <jamesr@google.com> wrote: > > > ...
6 years, 6 months ago (2014-06-03 21:57:10 UTC) #14
chromium-reviews
On Tue, Jun 3, 2014 at 2:56 PM, Dana Jansens <danakj@google.com> wrote: > On Tue, ...
6 years, 6 months ago (2014-06-03 22:13:24 UTC) #15
chromium-reviews
On Wed, Jun 4, 2014 at 12:13 AM, James Robinson <jamesr@google.com> wrote: > > On ...
6 years, 6 months ago (2014-06-03 22:32:28 UTC) #16
chromium-reviews
On Tue, Jun 3, 2014 at 3:32 PM, Dana Jansens <danakj@google.com> wrote: > On Wed, ...
6 years, 6 months ago (2014-06-03 23:27:47 UTC) #17
commit-bot: I haz the power
Change committed as 274686
6 years, 6 months ago (2014-06-04 00:34:59 UTC) #18
chromium-reviews
6 years, 6 months ago (2014-06-04 01:42:45 UTC) #19
On Wed, Jun 4, 2014 at 1:27 AM, James Robinson <jamesr@google.com> wrote:

> On Tue, Jun 3, 2014 at 3:32 PM, Dana Jansens <danakj@google.com> wrote:
>
>> On Wed, Jun 4, 2014 at 12:13 AM, James Robinson <jamesr@google.com>
>> wrote:My understanding is that in the end for each screen pixel, we're
>> going to pick one texture to sample from and fill the screen pixel with
>> that, and we use the pixel center to do that. If the layer's position is
>> overlapping the center, then we're going to use the layer, otherwise we'll
>> use the DIP pixel to the left/right of the layer, etc. So if you layout a
>> window border right beside a tab contents in DIP space, and that boundary
>> ends up in the middle of a screen pixel, we'd just end up picking the one
>> that takes up more of the pixel (occupies the pixel center), and on the
>> other end of the layer, we'd do the same.
>>
>
> Currently the window frame on the left side of the tab contents occupies
> an odd number of DIP pixels.  This means with a scale of 1.5, the rightmost
> edge of the tab border and the leftmost edge of the tab contents split a
> physical pixel exactly down the center. Which do you consider to be "the
> texture occupying the pixel center"?  Neither occupies more of the pixel,
> except for floating point error, it's exactly split.
>

Note: the GL "diamond exit rules" make it that exactly one triangle (hence
quad) would own that pixel center in that case.


>
>
>> This is what we do now, except that we don't align the pixels we choose
>> with the screen pixels, so we end up with blurriness if we turn on LINEAR
>> or skipping/repeating a pixel with NEAREST. If we align this to the screen
>> pixels, then we avoid that. I don't think we introduce any gaps in this
>> way, do we?
>>
>
> Alignment = moving something.  Assuming that the layout is tight to begin
> with (i.e. does not have gaps or overlap) then any movement will either
> clip something or introduce a gap somewhere.  We can't invent space out of
> nowhere :)
>
>
>>
>> I also don't want to introduce magic here, but I am having trouble
>> thinking of a case where this would do the wrong thing for us. It sounds
>> like you are thinking of some scenarios where this would be wrong, and the
>> UI would do something different with more control. Do you have a concrete
>> example in mind (can you draw a picture or something :)) ?
>>
>
> Consider a horizontal slice across a browser window.  We have some browser
> frame, then web contents, then more browser frame, then the edge of the
> window.  In DIP space views decides it wants things to lay out thusly:
>
> | 7 DIP pixels of browser frame | 600 DIP pixels of web contents | 7
> pixels of browser frame |
>
> We tell the render process to size itself to 600 DIPs, meaning the
> viewport is 600 CSS pixels wide.  We have a device scale of 1.5 so the
> physical pixel size of everything (prior to this patch) would be:
>
> | 10.5 pixels of browser frame | 900 pixels of web contents | 10.5 pixels
> of browser frame |
>
> This means the tab contents are at an offset of 10.5px from the left edge
> of the window, which is why we filter and look blurry.  The tricky question
> here is what should occupy the 11th and pixel from the left and right edges
> of the window.  There are several possibilities depending on what we want
> to optimize for.  We need to end up 921 physical pixels wide, we want to
> show the web contents as accurately as possible, we don't want to have
> gaps, and we want the window frame to be as symmetric as possible.
>
> (A - snap everything to the left)
> | 10 pixels of browser frame | 900 pixels of web contents | 1 pixel gap |
> 10 pixels of browser frame |
>
> Here the left part of the window frame is 10 physicals and the web
> contents starts at the 11th physical pixel and extends up to and including
> the 911th.  Then we have 11 physical pixels left in the window, but only
> window frame content to put there.  We have to put a gap in somewhere
> (whether it's on the left or right edge isn't important).  The way that the
> chrome browser UI actually looks this means the web contents actually looks
> too far left relative to the window frame in the omnibox area.
>
> (B - snap to the right)
> | 11 pixels of browser frame | 900 pixels of web contents | 10 pixels of
> browser frame |
>
> This isn't good either since the browser frame on the right is smaller
> than on the left, so it won't be symmetric.
>
> (C - shift + clip web contents)
>
> | 11 pixels of browser frame | 899 pixels of web contents | 11 pixels of
> browser frame |
>
> This is what this patch implements.  The web contents is "shifted" by 1/2
> pixel to the right, meaning that the browser frame on the left edge can
> occupy a full 11 pixels and the rightmost edge of the web contents area is
> clipped out by 1/3 of a DIP.  The browser frame can occupy full space on
> either edge.
>
> I would not say this is a correct *general* solution but it's a correct
> solution *for this particular UI*.  I think it'd be equally mathematically
> valid to say that the 11th pixel should be web contents and not browser
> frame, but that'd look bad since it would mean that the browser frame would
> be inconsistent with how infobars and other content below the navigation
> bar render.  Kicking the web contents to the right looks better for this.
>
> Here's what the left edge of the window looks like in Chrome Canary blown
> up 8x at 1.5 scale:
>
> http://imgur.com/rRKu2Sn
>
> Notice how when the web contents starts the rightmost pixel of the window
> frame appears to be lighter - it's actually filtering 50% of the window
> frame (grey) with 50% of the leftmost web contents pixel (white).
>
> This is with this patch:
>
> http://imgur.com/XTsPsVw
>
> Here the window frame fills out the 11th pixel completely and is the same
> color as it is before the web contents starts.
>
> Of course, this means that the right edge is slightly different too - but
> for Chrome we want the browser frame to look the same so that means
> clipping the web contents area slightly.
>
>
>> Also, do you want to have blink layout its compositor layers at sub-pixel
>> positions to get them screen-pixel aligned also?
>>
>
> Blink already snaps to physical (or as close as it can get with the
> information it has) when painting, which means doing positioning to finer
> granularity than DIPs (so subpixel in a sense).  It definitely should be
> doing the same for composited layer positions to be consistent with painted
> content.
>
> - James
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698