[Webkit-unassigned] [Bug 90097] New: Subpixel layout broken with spans with CSS position other than static

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 27 13:26:51 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=90097

           Summary: Subpixel layout broken with spans with CSS position
                    other than static
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Layout and Rendering
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: behdad at google.com


We are facing an issue with Chrome Linux with --enable-text-subpixel-rendering where getBoundingClientRect() is returning rounded-to-integers bounds for spans with position:static but not any other position setting.  See:

  http://code.google.com/p/chromium/issues/detail?id=132571

Here is a minimal test case:

  http://jsfiddle.net/ALd5F/2/

Currently, this is sample output from Chrome Linux with --enable-text-subpixel-positioning:

T TTT
span[0]: rect.width=9.7734375
span[1]: rect.width=10
span[2]: rect.width=10
span[3]: rect.width=9

Firefox on the Mac does subpixel text positioning, and here's its output:

T T T T

span[0]: rect.width=9.76666259765625
span[1]: rect.width=9.766677856445312
span[2]: rect.width=9.766677856445312
span[3]: rect.width=9.766677856445312

The position:relative case goes through RenderInline to InlineBox, and looks like a thinko, and should be harmless to fix:

diff --git a/Source/WebCore/rendering/InlineBox.h b/Source/WebCore/rendering/InlineBox.h
index 2ed9cd4..84108db 100644
--- a/Source/WebCore/rendering/InlineBox.h
+++ b/Source/WebCore/rendering/InlineBox.h
@@ -200,7 +200,7 @@ public:

     float width() const { return isHorizontal() ? logicalWidth() : logicalHeight(); }
     float height() const { return isHorizontal() ? logicalHeight() : logicalWidth(); }
-    FloatSize size() const { return IntSize(width(), height()); }
+    FloatSize size() const { return FloatSize(width(), height()); }
     float right() const { return left() + width(); }
     float bottom() const { return top() + height(); }


The two remaining ones go through RenderBlock, eventually getting ceil'ed in RenderBlock::updatePreferredWidth():

static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& result)
{
    LayoutUnit snappedResult = ceilf(result);
    preferredWidth = max(snappedResult, preferredWidth);
}

This one is clearly more delicate.  We don't want rounding to full pixels.  But we want to make sure that the allocated with is at least as large as requested width.  So, when converting from float to LayoutUnits, we need to round up.

Attaching separate patches for the two issues.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list