Title: [117310] trunk
Revision
117310
Author
e...@chromium.org
Date
2012-05-16 11:30:09 -0700 (Wed, 16 May 2012)

Log Message

Change ascents and descent back to ints for now
https://bugs.webkit.org/show_bug.cgi?id=86518

Reviewed by Eric Seidel.

Change ascents and descent calculation back to integers for now as it
looks like we'll need to support both the 1/60 and 1/1 implementations of
FractionalLayoutUnit for the immediate future to ensure that text is
rendered at the same offset and with the height regardless of the
ENABLE_SUBPIXEL_LAYOUT flag.

This ensures that most websites will look the same at 100% zoom
regardless of the flag and also allows us to the same test expectations
for the vast majority of layout tests.

Eventually we want to move those back to FractionalLayoutUnits as that
will result in more correct rendering.

Source/WebCore: 

No new tests, no change in functionality.

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
* rendering/RootInlineBox.cpp:
(WebCore::setAscentAndDescent):
(WebCore::RootInlineBox::ascentAndDescentForBox):
* rendering/RootInlineBox.h:
(RootInlineBox):

LayoutTests: 

* platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt:
* platform/mac/fast/block/float/overhanging-tall-block-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117309 => 117310)


--- trunk/LayoutTests/ChangeLog	2012-05-16 18:18:43 UTC (rev 117309)
+++ trunk/LayoutTests/ChangeLog	2012-05-16 18:30:09 UTC (rev 117310)
@@ -1,3 +1,26 @@
+2012-05-16  Emil A Eklund  <e...@chromium.org>
+
+        Change ascents and descent back to ints for now
+        https://bugs.webkit.org/show_bug.cgi?id=86518
+
+        Reviewed by Eric Seidel.
+
+        Change ascents and descent calculation back to integers for now as it
+        looks like we'll need to support both the 1/60 and 1/1 implementations of
+        FractionalLayoutUnit for the immediate future to ensure that text is
+        rendered at the same offset and with the height regardless of the
+        ENABLE_SUBPIXEL_LAYOUT flag.
+
+        This ensures that most websites will look the same at 100% zoom
+        regardless of the flag and also allows us to the same test expectations
+        for the vast majority of layout tests.
+
+        Eventually we want to move those back to FractionalLayoutUnits as that
+        will result in more correct rendering.
+
+        * platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt:
+        * platform/mac/fast/block/float/overhanging-tall-block-expected.txt:
+
 2012-05-16  Ken Buchanan  <ke...@chromium.org>
 
         Crash due to first-letter not getting computed on RenderTableCell

Modified: trunk/LayoutTests/platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt (117309 => 117310)


--- trunk/LayoutTests/platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt	2012-05-16 18:18:43 UTC (rev 117309)
+++ trunk/LayoutTests/platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt	2012-05-16 18:30:09 UTC (rev 117310)
@@ -1,14 +1,14 @@
-layer at (0,0) size 800x1600000026
+layer at (0,0) size 800x1600000018
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x1600000026 backgroundClip at (0,0) size 800x1073741823 clip at (0,0) size 800x1073741823 outlineClip at (0,0) size 800x1073741823
+layer at (0,0) size 800x1600000018 backgroundClip at (0,0) size 800x1073741823 clip at (0,0) size 800x1073741823 outlineClip at (0,0) size 800x1073741823
   RenderBlock {HTML} at (0,0) size 800x1600000000
     RenderBody {BODY} at (8,8) size 784x1600000000
       RenderBlock {DIV} at (0,0) size 784x1600000000
       RenderBlock {DIV} at (0,1600000000) size 784x0
       RenderBlock {DIV} at (0,1600000000) size 784x0
-layer at (10,10) size 179x1600000004 backgroundClip at (10,10) size 179x1073741813 clip at (11,11) size 177x1073741812 outlineClip at (0,0) size 800x1073741823
-  RenderTextControl {TEXTAREA} at (2,2) size 179x1600000000 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+layer at (10,2) size 179x1600000004 backgroundClip at (10,2) size 179x1073741821 clip at (11,3) size 177x1073741820 outlineClip at (0,0) size 800x1073741823
+  RenderTextControl {TEXTAREA} at (2,-6) size 179x1600000000 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     RenderBlock {DIV} at (3,3) size 175x16
-layer at (10,-1094967272) size 179x1600000004 backgroundClip at (10,0) size 179x505032732 clip at (11,0) size 177x505032731 outlineClip at (0,0) size 800x1073741823
+layer at (10,-1094967280) size 179x1600000004 backgroundClip at (10,0) size 179x505032724 clip at (11,0) size 177x505032723 outlineClip at (0,0) size 800x1073741823
   RenderTextControl {TEXTAREA} at (2,1600000000) size 179x-2147483648 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     RenderBlock {DIV} at (3,3) size 175x16

Modified: trunk/LayoutTests/platform/mac/fast/block/float/overhanging-tall-block-expected.txt (117309 => 117310)


--- trunk/LayoutTests/platform/mac/fast/block/float/overhanging-tall-block-expected.txt	2012-05-16 18:18:43 UTC (rev 117309)
+++ trunk/LayoutTests/platform/mac/fast/block/float/overhanging-tall-block-expected.txt	2012-05-16 18:30:09 UTC (rev 117310)
@@ -1,11 +1,11 @@
-layer at (0,0) size 800x1300000028
+layer at (0,0) size 800x1300000018
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x1300000028 backgroundClip at (0,0) size 800x1073741823 clip at (0,0) size 800x1073741823 outlineClip at (0,0) size 800x1073741823
+layer at (0,0) size 800x1300000018 backgroundClip at (0,0) size 800x1073741823 clip at (0,0) size 800x1073741823 outlineClip at (0,0) size 800x1073741823
   RenderBlock {HTML} at (0,0) size 800x1300000000
     RenderBody {BODY} at (8,8) size 784x1300000000
       RenderBlock {DIV} at (0,0) size 784x1300000000
       RenderBlock {DIV} at (0,1300000000) size 784x0
       RenderBlock {DIV} at (0,1300000000) size 784x0
-layer at (10,10) size 161x1300000006 backgroundClip at (10,10) size 161x1073741813 clip at (11,11) size 159x1073741812 outlineClip at (0,0) size 800x1073741823
-  RenderTextControl {TEXTAREA} at (2,2) size 161x1300000000 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+layer at (10,0) size 161x1300000006 backgroundClip at (10,0) size 161x1073741823 clip at (11,1) size 159x1073741822 outlineClip at (0,0) size 800x1073741823
+  RenderTextControl {TEXTAREA} at (2,-8) size 161x1300000000 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     RenderBlock {DIV} at (3,3) size 155x13

Modified: trunk/Source/WebCore/ChangeLog (117309 => 117310)


--- trunk/Source/WebCore/ChangeLog	2012-05-16 18:18:43 UTC (rev 117309)
+++ trunk/Source/WebCore/ChangeLog	2012-05-16 18:30:09 UTC (rev 117310)
@@ -1,3 +1,33 @@
+2012-05-15  Emil A Eklund  <e...@chromium.org>
+
+        Change ascents and descent back to ints for now
+        https://bugs.webkit.org/show_bug.cgi?id=86518
+
+        Reviewed by Eric Seidel.
+
+        Change ascents and descent calculation back to integers for now as it
+        looks like we'll need to support both the 1/60 and 1/1 implementations of
+        FractionalLayoutUnit for the immediate future to ensure that text is
+        rendered at the same offset and with the height regardless of the
+        ENABLE_SUBPIXEL_LAYOUT flag.
+
+        This ensures that most websites will look the same at 100% zoom
+        regardless of the flag and also allows us to the same test expectations
+        for the vast majority of layout tests.
+
+        Eventually we want to move those back to FractionalLayoutUnits as that
+        will result in more correct rendering.
+
+        No new tests, no change in functionality.
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::computeLogicalBoxHeights):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::setAscentAndDescent):
+        (WebCore::RootInlineBox::ascentAndDescentForBox):
+        * rendering/RootInlineBox.h:
+        (RootInlineBox):
+
 2012-05-16  Ken Buchanan  <ke...@chromium.org>
 
         Crash due to first-letter not getting computed on RenderTableCell

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (117309 => 117310)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2012-05-16 18:18:43 UTC (rev 117309)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2012-05-16 18:30:09 UTC (rev 117310)
@@ -517,8 +517,8 @@
     
     if (isRootInlineBox()) {
         // Examine our root box.
-        LayoutUnit ascent = 0;
-        LayoutUnit descent = 0;
+        int ascent = 0;
+        int descent = 0;
         rootBox->ascentAndDescentForBox(rootBox, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent);
         if (strictMode || hasTextChildren() || (!checkChildren && hasTextDescendants())) {
             if (maxAscent < ascent || !setMaxAscent) {
@@ -549,8 +549,8 @@
         // root box's baseline, and it is positive if the child box's baseline is below the root box's baseline.
         curr->setLogicalTop(rootBox->verticalPositionForBox(curr, verticalPositionCache));
         
-        LayoutUnit ascent = 0;
-        LayoutUnit descent = 0;
+        int ascent = 0;
+        int descent = 0;
         rootBox->ascentAndDescentForBox(curr, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent);
 
         LayoutUnit boxHeight = ascent + descent;

Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (117309 => 117310)


--- trunk/Source/WebCore/rendering/RootInlineBox.cpp	2012-05-16 18:18:43 UTC (rev 117309)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp	2012-05-16 18:30:09 UTC (rev 117310)
@@ -708,7 +708,7 @@
     return lineLayoutOverflow;
 }
 
-static void setAscentAndDescent(LayoutUnit& ascent, LayoutUnit& descent, LayoutUnit newAscent, LayoutUnit newDescent, bool& ascentDescentSet)
+static void setAscentAndDescent(int& ascent, int& descent, int newAscent, int newDescent, bool& ascentDescentSet)
 {
     if (!ascentDescentSet) {
         ascentDescentSet = true;
@@ -720,7 +720,7 @@
     }
 }
 
-void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, LayoutUnit& ascent, LayoutUnit& descent,
+void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, int& ascent, int& descent,
                                            bool& affectsAscent, bool& affectsDescent) const
 {
     bool ascentDescentSet = false;
@@ -757,11 +757,11 @@
         usedFonts->append(box->renderer()->style(isFirstLineStyle())->font().primaryFont());
         for (size_t i = 0; i < usedFonts->size(); ++i) {
             const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
-            LayoutUnit usedFontAscent = fontMetrics.ascent(baselineType());
-            LayoutUnit usedFontDescent = fontMetrics.descent(baselineType());
-            LayoutUnit halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2;
-            LayoutUnit usedFontAscentAndLeading = usedFontAscent + halfLeading;
-            LayoutUnit usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFontAscentAndLeading;
+            int usedFontAscent = fontMetrics.ascent(baselineType());
+            int usedFontDescent = fontMetrics.descent(baselineType());
+            int halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2;
+            int usedFontAscentAndLeading = usedFontAscent + halfLeading;
+            int usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFontAscentAndLeading;
             if (includeFont) {
                 setAscentAndDescent(ascent, descent, usedFontAscent, usedFontDescent, ascentDescentSet);
                 setUsedFont = true;
@@ -779,8 +779,8 @@
 
     // If leading is included for the box, then we compute that box.
     if (includeLeading && !setUsedFontWithLeading) {
-        LayoutUnit ascentWithLeading = box->baselinePosition(baselineType());
-        LayoutUnit descentWithLeading = box->lineHeight() - ascentWithLeading;
+        int ascentWithLeading = box->baselinePosition(baselineType());
+        int descentWithLeading = box->lineHeight() - ascentWithLeading;
         setAscentAndDescent(ascent, descent, ascentWithLeading, descentWithLeading, ascentDescentSet);
         
         // Examine the font box for inline flows and text boxes to see if any part of it is above the baseline.
@@ -792,8 +792,8 @@
     }
     
     if (includeFontForBox(box) && !setUsedFont) {
-        LayoutUnit fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent();
-        LayoutUnit fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent();
+        int fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent();
+        int fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent();
         setAscentAndDescent(ascent, descent, fontAscent, fontDescent, ascentDescentSet);
         affectsAscent = fontAscent - box->logicalTop() > 0;
         affectsDescent = fontDescent + box->logicalTop() > 0; 

Modified: trunk/Source/WebCore/rendering/RootInlineBox.h (117309 => 117310)


--- trunk/Source/WebCore/rendering/RootInlineBox.h	2012-05-16 18:18:43 UTC (rev 117309)
+++ trunk/Source/WebCore/rendering/RootInlineBox.h	2012-05-16 18:30:09 UTC (rev 117310)
@@ -151,7 +151,7 @@
 
     LayoutRect paddedLayoutOverflowRect(LayoutUnit endPadding) const;
 
-    void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, LayoutUnit& ascent, LayoutUnit& descent, bool& affectsAscent, bool& affectsDescent) const;
+    void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, int& ascent, int& descent, bool& affectsAscent, bool& affectsDescent) const;
     LayoutUnit verticalPositionForBox(InlineBox*, VerticalPositionCache&);
     bool includeLeadingForBox(InlineBox*) const;
     bool includeFontForBox(InlineBox*) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to