Changeset 117310 in webkit


Ignore:
Timestamp:
May 16, 2012 11:30:09 AM (12 years ago)
Author:
eae@chromium.org
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:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117309 r117310  
     12012-05-16  Emil A Eklund  <eae@chromium.org>
     2
     3        Change ascents and descent back to ints for now
     4        https://bugs.webkit.org/show_bug.cgi?id=86518
     5
     6        Reviewed by Eric Seidel.
     7
     8        Change ascents and descent calculation back to integers for now as it
     9        looks like we'll need to support both the 1/60 and 1/1 implementations of
     10        FractionalLayoutUnit for the immediate future to ensure that text is
     11        rendered at the same offset and with the height regardless of the
     12        ENABLE_SUBPIXEL_LAYOUT flag.
     13
     14        This ensures that most websites will look the same at 100% zoom
     15        regardless of the flag and also allows us to the same test expectations
     16        for the vast majority of layout tests.
     17
     18        Eventually we want to move those back to FractionalLayoutUnits as that
     19        will result in more correct rendering.
     20
     21        * platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt:
     22        * platform/mac/fast/block/float/overhanging-tall-block-expected.txt:
     23
    1242012-05-16  Ken Buchanan  <kenrb@chromium.org>
    225
  • trunk/LayoutTests/platform/chromium-win/fast/block/float/overhanging-tall-block-expected.txt

    r116033 r117310  
    1 layer at (0,0) size 800x1600000026
     1layer at (0,0) size 800x1600000018
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x1600000026 backgroundClip at (0,0) size 800x1073741823 clip at (0,0) size 800x1073741823 outlineClip at (0,0) size 800x1073741823
     3layer at (0,0) size 800x1600000018 backgroundClip at (0,0) size 800x1073741823 clip at (0,0) size 800x1073741823 outlineClip at (0,0) size 800x1073741823
    44  RenderBlock {HTML} at (0,0) size 800x1600000000
    55    RenderBody {BODY} at (8,8) size 784x1600000000
     
    77      RenderBlock {DIV} at (0,1600000000) size 784x0
    88      RenderBlock {DIV} at (0,1600000000) size 784x0
    9 layer at (10,10) size 179x1600000004 backgroundClip at (10,10) size 179x1073741813 clip at (11,11) size 177x1073741812 outlineClip at (0,0) size 800x1073741823
    10   RenderTextControl {TEXTAREA} at (2,2) size 179x1600000000 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     9layer at (10,2) size 179x1600000004 backgroundClip at (10,2) size 179x1073741821 clip at (11,3) size 177x1073741820 outlineClip at (0,0) size 800x1073741823
     10  RenderTextControl {TEXTAREA} at (2,-6) size 179x1600000000 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    1111    RenderBlock {DIV} at (3,3) size 175x16
    12 layer at (10,-1094967272) size 179x1600000004 backgroundClip at (10,0) size 179x505032732 clip at (11,0) size 177x505032731 outlineClip at (0,0) size 800x1073741823
     12layer at (10,-1094967280) size 179x1600000004 backgroundClip at (10,0) size 179x505032724 clip at (11,0) size 177x505032723 outlineClip at (0,0) size 800x1073741823
    1313  RenderTextControl {TEXTAREA} at (2,1600000000) size 179x-2147483648 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    1414    RenderBlock {DIV} at (3,3) size 175x16
  • trunk/LayoutTests/platform/mac/fast/block/float/overhanging-tall-block-expected.txt

    r116176 r117310  
    1 layer at (0,0) size 800x1300000028
     1layer at (0,0) size 800x1300000018
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x1300000028 backgroundClip at (0,0) size 800x1073741823 clip at (0,0) size 800x1073741823 outlineClip at (0,0) size 800x1073741823
     3layer at (0,0) size 800x1300000018 backgroundClip at (0,0) size 800x1073741823 clip at (0,0) size 800x1073741823 outlineClip at (0,0) size 800x1073741823
    44  RenderBlock {HTML} at (0,0) size 800x1300000000
    55    RenderBody {BODY} at (8,8) size 784x1300000000
     
    77      RenderBlock {DIV} at (0,1300000000) size 784x0
    88      RenderBlock {DIV} at (0,1300000000) size 784x0
    9 layer at (10,10) size 161x1300000006 backgroundClip at (10,10) size 161x1073741813 clip at (11,11) size 159x1073741812 outlineClip at (0,0) size 800x1073741823
    10   RenderTextControl {TEXTAREA} at (2,2) size 161x1300000000 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     9layer at (10,0) size 161x1300000006 backgroundClip at (10,0) size 161x1073741823 clip at (11,1) size 159x1073741822 outlineClip at (0,0) size 800x1073741823
     10  RenderTextControl {TEXTAREA} at (2,-8) size 161x1300000000 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    1111    RenderBlock {DIV} at (3,3) size 155x13
  • trunk/Source/WebCore/ChangeLog

    r117309 r117310  
     12012-05-15  Emil A Eklund  <eae@chromium.org>
     2
     3        Change ascents and descent back to ints for now
     4        https://bugs.webkit.org/show_bug.cgi?id=86518
     5
     6        Reviewed by Eric Seidel.
     7
     8        Change ascents and descent calculation back to integers for now as it
     9        looks like we'll need to support both the 1/60 and 1/1 implementations of
     10        FractionalLayoutUnit for the immediate future to ensure that text is
     11        rendered at the same offset and with the height regardless of the
     12        ENABLE_SUBPIXEL_LAYOUT flag.
     13
     14        This ensures that most websites will look the same at 100% zoom
     15        regardless of the flag and also allows us to the same test expectations
     16        for the vast majority of layout tests.
     17
     18        Eventually we want to move those back to FractionalLayoutUnits as that
     19        will result in more correct rendering.
     20
     21        No new tests, no change in functionality.
     22
     23        * rendering/InlineFlowBox.cpp:
     24        (WebCore::InlineFlowBox::computeLogicalBoxHeights):
     25        * rendering/RootInlineBox.cpp:
     26        (WebCore::setAscentAndDescent):
     27        (WebCore::RootInlineBox::ascentAndDescentForBox):
     28        * rendering/RootInlineBox.h:
     29        (RootInlineBox):
     30
    1312012-05-16  Ken Buchanan  <kenrb@chromium.org>
    232
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r115689 r117310  
    518518    if (isRootInlineBox()) {
    519519        // Examine our root box.
    520         LayoutUnit ascent = 0;
    521         LayoutUnit descent = 0;
     520        int ascent = 0;
     521        int descent = 0;
    522522        rootBox->ascentAndDescentForBox(rootBox, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent);
    523523        if (strictMode || hasTextChildren() || (!checkChildren && hasTextDescendants())) {
     
    550550        curr->setLogicalTop(rootBox->verticalPositionForBox(curr, verticalPositionCache));
    551551       
    552         LayoutUnit ascent = 0;
    553         LayoutUnit descent = 0;
     552        int ascent = 0;
     553        int descent = 0;
    554554        rootBox->ascentAndDescentForBox(curr, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent);
    555555
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r114784 r117310  
    709709}
    710710
    711 static void setAscentAndDescent(LayoutUnit& ascent, LayoutUnit& descent, LayoutUnit newAscent, LayoutUnit newDescent, bool& ascentDescentSet)
     711static void setAscentAndDescent(int& ascent, int& descent, int newAscent, int newDescent, bool& ascentDescentSet)
    712712{
    713713    if (!ascentDescentSet) {
     
    721721}
    722722
    723 void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, LayoutUnit& ascent, LayoutUnit& descent,
     723void RootInlineBox::ascentAndDescentForBox(InlineBox* box, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, int& ascent, int& descent,
    724724                                           bool& affectsAscent, bool& affectsDescent) const
    725725{
     
    758758        for (size_t i = 0; i < usedFonts->size(); ++i) {
    759759            const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
    760             LayoutUnit usedFontAscent = fontMetrics.ascent(baselineType());
    761             LayoutUnit usedFontDescent = fontMetrics.descent(baselineType());
    762             LayoutUnit halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2;
    763             LayoutUnit usedFontAscentAndLeading = usedFontAscent + halfLeading;
    764             LayoutUnit usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFontAscentAndLeading;
     760            int usedFontAscent = fontMetrics.ascent(baselineType());
     761            int usedFontDescent = fontMetrics.descent(baselineType());
     762            int halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2;
     763            int usedFontAscentAndLeading = usedFontAscent + halfLeading;
     764            int usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFontAscentAndLeading;
    765765            if (includeFont) {
    766766                setAscentAndDescent(ascent, descent, usedFontAscent, usedFontDescent, ascentDescentSet);
     
    780780    // If leading is included for the box, then we compute that box.
    781781    if (includeLeading && !setUsedFontWithLeading) {
    782         LayoutUnit ascentWithLeading = box->baselinePosition(baselineType());
    783         LayoutUnit descentWithLeading = box->lineHeight() - ascentWithLeading;
     782        int ascentWithLeading = box->baselinePosition(baselineType());
     783        int descentWithLeading = box->lineHeight() - ascentWithLeading;
    784784        setAscentAndDescent(ascent, descent, ascentWithLeading, descentWithLeading, ascentDescentSet);
    785785       
     
    793793   
    794794    if (includeFontForBox(box) && !setUsedFont) {
    795         LayoutUnit fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent();
    796         LayoutUnit fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent();
     795        int fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent();
     796        int fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent();
    797797        setAscentAndDescent(ascent, descent, fontAscent, fontDescent, ascentDescentSet);
    798798        affectsAscent = fontAscent - box->logicalTop() > 0;
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r114784 r117310  
    152152    LayoutRect paddedLayoutOverflowRect(LayoutUnit endPadding) const;
    153153
    154     void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, LayoutUnit& ascent, LayoutUnit& descent, bool& affectsAscent, bool& affectsDescent) const;
     154    void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, int& ascent, int& descent, bool& affectsAscent, bool& affectsDescent) const;
    155155    LayoutUnit verticalPositionForBox(InlineBox*, VerticalPositionCache&);
    156156    bool includeLeadingForBox(InlineBox*) const;
Note: See TracChangeset for help on using the changeset viewer.