Bug 146273

Summary: Subpixel rendering: roundToDevicePixel() snaps to wrong value.
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, simon.fraser
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

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