Bug 146273 - Subpixel rendering: roundToDevicePixel() snaps to wrong value.
Summary: Subpixel rendering: roundToDevicePixel() snaps to wrong value.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-06-23 20:16 PDT by zalan
Modified: 2015-06-30 13:06 PDT (History)
2 users (show)

See Also:


Attachments
Patch (4.70 KB, patch)
2015-06-23 21:08 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (4.80 KB, patch)
2015-06-24 09:58 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2015-06-23 20:16:46 PDT
RenderLayer::paintForegroundForFragmentsWithPhase() gets a fragment with a foregroundRect of, say:

(WebCore::LayoutRect) $23 = (m_location = { x = -96452px (-6172928), y = 0px (0) }, m_size = { width = 146px (9344), height = 310px (19840) })

where -96452 is the left edge of the layer (negative, because we're in vertical-rl content).

snapRectToDevicePixels() is converting that to:

(const WebCore::FloatRect) $24 = {
  m_location = (m_x = -96451.5, m_y = 0)
  m_size = (m_width = 146, m_height = 310)
}
Comment 1 zalan 2015-06-23 20:18:10 PDT
rdar://problem/18509840
Comment 2 zalan 2015-06-23 21:08:48 PDT
Created attachment 255471 [details]
Patch
Comment 3 zalan 2015-06-24 09:58:58 PDT
Created attachment 255487 [details]
Patch
Comment 4 WebKit Commit Bot 2015-06-24 10:54:34 PDT
Comment on attachment 255487 [details]
Patch

Clearing flags on attachment: 255487

Committed r185916: <http://trac.webkit.org/changeset/185916>
Comment 5 WebKit Commit Bot 2015-06-24 10:54:37 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Darin Adler 2015-06-24 14:52:46 PDT
Comment on attachment 255471 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=255471&action=review

> Source/WebCore/platform/LayoutUnit.h:875
>  inline float roundToDevicePixel(LayoutUnit value, const float pixelSnappingFactor, bool needsDirectionalRounding = false)

The const here adds nothing and should be removed.
Comment 7 zalan 2015-06-24 15:10:06 PDT
(In reply to comment #6)
> Comment on attachment 255471 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=255471&action=review
> 
> > Source/WebCore/platform/LayoutUnit.h:875
> >  inline float roundToDevicePixel(LayoutUnit value, const float pixelSnappingFactor, bool needsDirectionalRounding = false)
> 
> The const here adds nothing and should be removed.
Indeed. Thanks.
Comment 8 zalan 2015-06-30 13:06:43 PDT
Addressing post-review comment: 
http://trac.webkit.org/changeset/186128