Changeset 72141 in webkit


Ignore:
Timestamp:
Nov 16, 2010 3:28:53 PM (13 years ago)
Author:
hyatt@apple.com
Message:

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

Reviewed by Dan Bernstein.

font-size:0 is ignored. Remove the minimum font size of 1 in CSSStyleSelector.
Change the pref value for minimum font size from 1 to 0. Make sure to never use the NSFont's size,
since it doesn't honor a size of 0. Instead pass the size in to the FontPlatformData(NSFont*) version
of the constructor rather than using [NSFont pointSize].

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

Negative leading is not handled correctly. There are two bugs here. The first is that
maxAscent and maxDescent can be negative, so we need a notion of whether or not we have
set them before so that we can allow them to be < 0.

The second issue is that we should understand where fonts will end up relative to
our baseline (excluding line height), and only allow those boxes to impact ascent and
descent if the actual font box (without factoring in line height) is above or below the
root line box baseline.

Added fast/css/negative-leading.html

These two bug fixes have to land together to keep the Acid 3 test rendering correctly.

WebCore:

  • WebCore.exp.in:
  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::getComputedSizeFromSpecifiedSize):

  • platform/graphics/cocoa/FontPlatformData.h:
  • platform/graphics/cocoa/FontPlatformDataCocoa.mm:

(WebCore::FontPlatformData::FontPlatformData):

  • platform/graphics/mac/FontCacheMac.mm:

(WebCore::FontCache::getFontDataForCharacters):
(WebCore::FontCache::createFontPlatformData):

  • platform/graphics/mac/SimpleFontDataMac.mm:

(WebCore::SimpleFontData::smallCapsFontData):

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::computeLogicalBoxHeights):

  • rendering/InlineFlowBox.h:
  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::alignBoxesInBlockDirection):

WebKit/mac:

  • Misc/WebKitNSStringExtras.mm:

(-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
(-[NSString _web_widthWithFont:]):

  • Misc/WebStringTruncator.mm:

(fontFromNSFont):

  • WebView/WebPreferences.mm:

(+[WebPreferences initialize]):

WebKit/win:

  • WebPreferences.cpp:

(WebPreferences::initializeDefaultSettings):

WebKit2:

  • Shared/WebPreferencesStore.cpp:

(WebKit::WebPreferencesStore::WebPreferencesStore):

LayoutTests:

  • fast/css/negative-leading.html: Added.
  • platform/mac/fast/compact/001-expected.checksum:
  • platform/mac/fast/compact/001-expected.png:
  • platform/mac/fast/compact/001-expected.txt:
  • platform/mac/fast/css/negative-leading-expected.checksum: Added.
  • platform/mac/fast/css/negative-leading-expected.png: Added.
  • platform/mac/fast/css/negative-leading-expected.txt: Added.
  • platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.checksum:
  • platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.png:
  • platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.txt:
  • platform/mac/fast/parser/style-script-head-test-expected.png:
Location:
trunk
Files:
4 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72138 r72141  
     12010-11-16  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=11004
     6       
     7        font-size:0 is ignored.  Remove the minimum font size of 1 in CSSStyleSelector.
     8        Change the pref value for minimum font size from 1 to 0.  Make sure to never use the NSFont's size,
     9        since it doesn't honor a size of 0.  Instead pass the size in to the FontPlatformData(NSFont*) version
     10        of the constructor rather than using [NSFont pointSize].
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=49582
     13       
     14        Negative leading is not handled correctly.  There are two bugs here.  The first is that
     15        maxAscent and maxDescent can be negative, so we need a notion of whether or not we have
     16        set them before so that we can allow them to be < 0.
     17       
     18        The second issue is that we should understand where fonts will end up relative to
     19        our baseline (excluding line height), and only allow those boxes to impact ascent and
     20        descent if the actual font box (without factoring in line height) is above or below the
     21        root line box baseline.
     22
     23        Added fast/css/negative-leading.html
     24       
     25        These two bug fixes have to land together to keep the Acid 3 test rendering correctly.
     26
     27        * fast/css/negative-leading.html: Added.
     28        * platform/mac/fast/compact/001-expected.checksum:
     29        * platform/mac/fast/compact/001-expected.png:
     30        * platform/mac/fast/compact/001-expected.txt:
     31        * platform/mac/fast/css/negative-leading-expected.checksum: Added.
     32        * platform/mac/fast/css/negative-leading-expected.png: Added.
     33        * platform/mac/fast/css/negative-leading-expected.txt: Added.
     34        * platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.checksum:
     35        * platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.png:
     36        * platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.txt:
     37        * platform/mac/fast/parser/style-script-head-test-expected.png:
     38
    1392010-11-16  David Levin  <levin@chromium.org>
    240
  • trunk/LayoutTests/platform/mac/fast/compact/001-expected.checksum

    r71062 r72141  
    1 59cf3d6597fc8c1700323ceacd7f4735
     1bf7c2f92f348ee027ab468c6fd6cf26b
  • trunk/LayoutTests/platform/mac/fast/compact/001-expected.txt

    r40259 r72141  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x81
    4   RenderBlock {HTML} at (0,0) size 800x81
    5     RenderBody {BODY} at (8,16) size 784x57
     3layer at (0,0) size 800x77
     4  RenderBlock {HTML} at (0,0) size 800x76
     5    RenderBody {BODY} at (8,16) size 784x52
    66      RenderBlock {P} at (0,0) size 784x18
    77        RenderText {#text} at (0,0) size 193x18
     
    1010        RenderText {#text} at (0,0) size 31x18
    1111          text run at (0,0) width 31: "Test:"
    12       RenderBlock {DIV} at (160,52) size 624x5 [color=#FF0000] [bgcolor=#00FF00]
     12      RenderBlock {DIV} at (160,52) size 624x0 [color=#FF0000] [bgcolor=#00FF00]
    1313        RenderInline {SPAN} at (0,0) size 299x18 [color=#000000]
    1414          RenderText {#text} at (0,-9) size 299x18
  • trunk/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.checksum

    r71187 r72141  
    1 bcdc206d48bcdb75decb4407a15b934b
     1a8e4279b6289b99c9deeba8a58c2f357
  • trunk/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.txt

    r43355 r72141  
    44  RenderBlock {HTML} at (0,0) size 800x600
    55    RenderBody {BODY} at (8,8) size 784x576
    6       RenderBlock (anonymous) at (0,0) size 784x54
     6      RenderBlock (anonymous) at (0,0) size 784x71
    77        RenderText {#text} at (300,36) size 4x18
    88          text run at (300,36) width 4: " "
    99        RenderText {#text} at (0,0) size 0x0
    10       RenderBlock {P} at (0,70) size 784x36
     10      RenderBlock {P} at (0,87) size 784x36
    1111        RenderText {#text} at (0,0) size 753x36
    1212          text run at (0,0) width 753: "This is a pixel test that tests the linebox overflow in the padding on textareas. The div on the right is styled to look like a"
    1313          text run at (0,18) width 53: "textarea."
    14 layer at (8,8) size 300x50 clip at (11,11) size 279x44 scrollHeight 52
     14layer at (8,8) size 300x50 clip at (11,11) size 294x44
    1515  RenderTextControl {TEXTAREA} at (0,0) size 300x50 [color=#0000FF] [bgcolor=#FFFFFF] [border: (3px solid #FFFF00)]
    16     RenderBlock {DIV} at (18,18) size 249x22
    17       RenderText {#text} at (0,-17) size 180x46
     16    RenderBlock {DIV} at (18,18) size 264x0
     17      RenderText {#text} at (0,-17) size 180x35
    1818        text run at (0,-17) width 162: "ggggggggg"
    1919        text run at (162,-17) width 18: " "
    20         text run at (0,-6) width 162: "ggggggggg"
    21 layer at (312,8) size 300x50 clip at (315,11) size 279x44 scrollHeight 52
    22   RenderBlock {DIV} at (304,0) size 300x50 [color=#0000FF] [border: (3px solid #FFFF00)]
    23     RenderBlock {DIV} at (18,18) size 249x22
    24       RenderText {#text} at (0,-17) size 162x46
    2520        text run at (0,-17) width 162: "ggggggggg"
    26         text run at (0,-6) width 162: "ggggggggg"
     21layer at (312,29) size 300x50 clip at (315,32) size 294x44
     22  RenderBlock {DIV} at (304,21) size 300x50 [color=#0000FF] [border: (3px solid #FFFF00)]
     23    RenderBlock {DIV} at (18,18) size 264x0
     24      RenderText {#text} at (0,-17) size 162x35
     25        text run at (0,-17) width 162: "ggggggggg"
     26        text run at (0,-17) width 162: "ggggggggg"
  • trunk/WebCore/ChangeLog

    r72137 r72141  
     12010-11-16  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=11004
     6       
     7        font-size:0 is ignored.  Remove the minimum font size of 1 in CSSStyleSelector.
     8        Change the pref value for minimum font size from 1 to 0.  Make sure to never use the NSFont's size,
     9        since it doesn't honor a size of 0.  Instead pass the size in to the FontPlatformData(NSFont*) version
     10        of the constructor rather than using [NSFont pointSize].
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=49582
     13       
     14        Negative leading is not handled correctly.  There are two bugs here.  The first is that
     15        maxAscent and maxDescent can be negative, so we need a notion of whether or not we have
     16        set them before so that we can allow them to be < 0.
     17       
     18        The second issue is that we should understand where fonts will end up relative to
     19        our baseline (excluding line height), and only allow those boxes to impact ascent and
     20        descent if the actual font box (without factoring in line height) is above or below the
     21        root line box baseline.
     22
     23        Added fast/css/negative-leading.html
     24       
     25        These two bug fixes have to land together to keep the Acid 3 test rendering correctly.
     26
     27        * WebCore.exp.in:
     28        * css/CSSStyleSelector.cpp:
     29        (WebCore::CSSStyleSelector::getComputedSizeFromSpecifiedSize):
     30        * platform/graphics/cocoa/FontPlatformData.h:
     31        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
     32        (WebCore::FontPlatformData::FontPlatformData):
     33        * platform/graphics/mac/FontCacheMac.mm:
     34        (WebCore::FontCache::getFontDataForCharacters):
     35        (WebCore::FontCache::createFontPlatformData):
     36        * platform/graphics/mac/SimpleFontDataMac.mm:
     37        (WebCore::SimpleFontData::smallCapsFontData):
     38        * rendering/InlineFlowBox.cpp:
     39        (WebCore::InlineFlowBox::computeLogicalBoxHeights):
     40        * rendering/InlineFlowBox.h:
     41        * rendering/RootInlineBox.cpp:
     42        (WebCore::RootInlineBox::alignBoxesInBlockDirection):
     43
    1442010-11-16  Darin Adler  <darin@apple.com>
    245
  • trunk/WebCore/WebCore.exp.in

    r71790 r72141  
    384384__ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd
    385385__ZN7WebCore16FontFallbackList15releaseFontDataEv
    386 __ZN7WebCore16FontPlatformDataC1EP6NSFontbbNS_15FontOrientationE
     386__ZN7WebCore16FontPlatformDataC1EP6NSFontfbbNS_15FontOrientationE
    387387__ZN7WebCore16FontPlatformDataD1Ev
    388388__ZN7WebCore16HTMLInputElement13setAutofilledEb
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r72116 r72141  
    62936293    // Also clamp to a reasonable maximum to prevent insane font sizes from causing crashes on various
    62946294    // platforms (I'm looking at you, Windows.)
    6295     return min(1000000.0f, max(zoomedSize, 1.0f));
     6295    return min(1000000.0f, zoomedSize);
    62966296}
    62976297
  • trunk/WebCore/platform/graphics/cocoa/FontPlatformData.h

    r70705 r72141  
    7474    }
    7575
    76     FontPlatformData(NSFont *nsFont, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal);
     76    FontPlatformData(NSFont *nsFont, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal);
    7777   
    7878    FontPlatformData(CGFontRef cgFont, ATSUFontID fontID, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation)
  • trunk/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm

    r71975 r72141  
    4545#endif  // PLATFORM(MAC)
    4646
    47 FontPlatformData::FontPlatformData(NSFont *nsFont, bool syntheticBold, bool syntheticOblique, FontOrientation orientation)
     47FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation)
    4848    : m_syntheticBold(syntheticBold)
    4949    , m_syntheticOblique(syntheticOblique)
     50    , m_size(size)
    5051    , m_font(nsFont)
    5152#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     
    5960    ASSERT_ARG(nsFont, nsFont);
    6061
    61     m_size = [nsFont pointSize];
    62    
    6362    CGFontRef cgFont = 0;
    64     loadFont(nsFont, m_size, m_font, cgFont, m_atsuFontID);
     63    loadFont(nsFont, size, m_font, cgFont, m_atsuFontID);
    6564
    6665    m_orientation = orientation;
  • trunk/WebCore/platform/graphics/mac/FontCacheMac.mm

    r70250 r72141  
    141141    NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont];
    142142
    143     FontPlatformData alternateFont(substituteFont,
     143    FontPlatformData alternateFont(substituteFont, platformData.size(),
    144144        !font.isPlatformFont() && isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(substituteFontWeight),
    145145        !font.isPlatformFont() && (traits & NSFontItalicTrait) && !(substituteFontTraits & NSFontItalicTrait),
     
    212212    bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait);
    213213
    214     return new FontPlatformData(platformFont, syntheticBold, syntheticOblique, fontDescription.orientation());
     214    return new FontPlatformData(platformFont, size, syntheticBold, syntheticOblique, fontDescription.orientation());
    215215}
    216216
  • trunk/WebCore/platform/graphics/mac/SimpleFontDataMac.mm

    r71975 r72141  
    383383        } else {
    384384            BEGIN_BLOCK_OBJC_EXCEPTIONS;
    385             float size = [m_platformData.font() pointSize] * smallCapsFontSizeMultiplier;
    386             FontPlatformData smallCapsFont([[NSFontManager sharedFontManager] convertFont:m_platformData.font() toSize:size]);
     385            float size = m_platformData.size() * smallCapsFontSizeMultiplier;
     386            FontPlatformData smallCapsFont([[NSFontManager sharedFontManager] convertFont:m_platformData.font() toSize:size], size);
    387387           
    388388            // AppKit resets the type information (screen/printer) when you convert a font to a different size.
  • trunk/WebCore/rendering/InlineFlowBox.cpp

    r71465 r72141  
    398398
    399399void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
    400                                              int& maxAscent, int& maxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
    401 {
     400                                             int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,
     401                                             bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
     402{
     403    // The primary purpose of this function is to compute the maximal ascent and descent values for
     404    // a line.
     405    //
     406    // The maxAscent value represents the distance of the highest point of any box (including line-height) from
     407    // the root box's baseline.  The maxDescent value represents the distance of the lowest point of any box
     408    // (also including line-height) from the root box baseline.  These values can be negative.
     409    //
     410    // A secondary purpose of this function is to store the offset of very box's baseline from the root box's
     411    // baseline.  This information is cached in the logicalTop() of every box. We're effectively just using
     412    // the logicalTop() as scratch space.
    402413    if (isRootInlineBox()) {
    403414        // Examine our root box.
     
    407418            int ascent = baseline;
    408419            int descent = height - ascent;
    409             if (maxAscent < ascent)
     420            if (maxAscent < ascent || !setMaxAscent) {
    410421                maxAscent = ascent;
    411             if (maxDescent < descent)
     422                setMaxAscent = true;
     423            }
     424            if (maxDescent < descent || !setMaxDescent) {
    412425                maxDescent = descent;
     426                setMaxDescent = true;
     427            }
    413428        }
    414429    }
     
    419434       
    420435        bool isInlineFlow = curr->isInlineFlowBox();
    421 
     436       
     437        // Because a box can be positioned such that it ends up fully above or fully below the
     438        // root line box, we only consider it to affect the maxAscent and maxDescent values if some
     439        // part of the box (EXCLUDING line-height) is above (for ascent) or below (for descent) the root box's baseline.
     440        bool affectsAscent = false;
     441        bool affectsDescent = false;
     442       
     443        // The verticalPositionForBox function returns the distance between the child box's baseline
     444        // and the root box's baseline.  The value is negative if the child box's baseline is above the
     445        // root box's baseline, and it is positive if the child box's baseline is below the root box's baseline.
     446        curr->setLogicalTop(verticalPositionForBox(curr, m_firstLine));
     447       
    422448        int lineHeight;
    423449        int baseline;
     
    438464                    baseline = max(baseline, halfLeading + usedFonts->at(i)->ascent());
    439465                    baselineToBottom = max(baselineToBottom, usedFonts->at(i)->lineSpacing() - usedFonts->at(i)->ascent() - usedFonts->at(i)->descent() - halfLeading);
     466                    if (!affectsAscent)
     467                        affectsAscent = usedFonts->at(i)->ascent() - curr->logicalTop() > 0;
     468                    if (!affectsDescent)
     469                        affectsDescent = usedFonts->at(i)->descent() + curr->logicalTop() > 0;
    440470                }
    441471                lineHeight = baseline + baselineToBottom;
     
    446476                    int halfLeading = (lineHeight - usedFonts->at(i)->ascent() - usedFonts->at(i)->descent()) / 2;
    447477                    baseline = max(baseline, halfLeading + usedFonts->at(i)->ascent());
     478                    if (!affectsAscent)
     479                        affectsAscent = usedFonts->at(i)->ascent() - curr->logicalTop() > 0;
     480                    if (!affectsDescent)
     481                        affectsDescent = usedFonts->at(i)->descent() + curr->logicalTop() > 0;
    448482                }
    449483            } else {
     
    453487                    int halfLeading = (lineHeight - usedFonts->at(i)->ascent() - usedFonts->at(i)->descent()) / 2;
    454488                    baseline = max(baseline, halfLeading + usedFonts->at(i)->ascent());
     489                    if (!affectsAscent)
     490                        affectsAscent = usedFonts->at(i)->ascent() - curr->logicalTop() > 0;
     491                    if (!affectsDescent)
     492                        affectsDescent = usedFonts->at(i)->descent() + curr->logicalTop() > 0;
    455493                }
    456494            }
     
    458496            lineHeight = curr->lineHeight();
    459497            baseline = curr->baselinePosition();
    460         }
    461 
    462         curr->setLogicalTop(verticalPositionForBox(curr, m_firstLine));
     498            if (curr->isText() || isInlineFlow) {
     499                // Examine the font box for inline flows and text boxes to see if any part of it is above the baseline.
     500                // If the top of our font box relative to the root box baseline is above the root box baseline, then
     501                // we are contributing to the maxAscent value.
     502                affectsAscent = curr->renderer()->style(m_firstLine)->font().ascent() - curr->logicalTop() > 0;
     503               
     504                // Descent is similar.  If any part of our font box is below the root box's baseline, then
     505                // we contribute to the maxDescent value.
     506                affectsDescent = curr->renderer()->style(m_firstLine)->font().descent() + curr->logicalTop() > 0;
     507            } else {
     508                // Replaced elements always affect both the ascent and descent.
     509                affectsAscent = true;
     510                affectsDescent = true;
     511            }
     512        }
     513
    463514        if (curr->logicalTop() == PositionTop) {
    464515            if (maxPositionTop < lineHeight)
     
    468519                maxPositionBottom = lineHeight;
    469520        } else if ((!isInlineFlow || static_cast<InlineFlowBox*>(curr)->hasTextChildren()) || curr->boxModelObject()->hasInlineDirectionBordersOrPadding() || strictMode) {
     521            // Note that these values can be negative.  Even though we only affect the maxAscent and maxDescent values
     522            // if our box (excluding line-height) was above (for ascent) or below (for descent) the root baseline, once you factor in line-height
     523            // the final box can end up being fully above or fully below the root box's baseline!  This is ok, but what it
     524            // means is that ascent and descent (including leading), can end up being negative.  The setMaxAscent and
     525            // setMaxDescent booleans are used to ensure that we're willing to initially set maxAscent/Descent to negative
     526            // values.
    470527            int ascent = baseline - curr->logicalTop();
    471528            int descent = lineHeight - ascent;
    472             if (maxAscent < ascent)
     529            if (affectsAscent && (maxAscent < ascent || !setMaxAscent)) {
    473530                maxAscent = ascent;
    474             if (maxDescent < descent)
     531                setMaxAscent = true;
     532            }
     533            if (affectsDescent && (maxDescent < descent || !setMaxDescent)) {
    475534                maxDescent = descent;
     535                setMaxDescent = true;
     536            }
    476537        }
    477538
    478539        if (curr->isInlineFlowBox())
    479             static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, strictMode, textBoxDataMap);
     540            static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, strictMode, textBoxDataMap);
    480541    }
    481542}
  • trunk/WebCore/rendering/InlineFlowBox.h

    r71465 r72141  
    156156    int placeBoxesInInlineDirection(int logicalLeft, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&);
    157157    void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
    158                                   int& maxAscent, int& maxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&);
     158                                  int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,
     159                                  bool strictMode, GlyphOverflowAndFallbackFontsMap&);
    159160    void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
    160161                                   int maxPositionTop, int maxPositionBottom);
  • trunk/WebCore/rendering/RootInlineBox.cpp

    r71563 r72141  
    227227    int maxAscent = 0;
    228228    int maxDescent = 0;
     229    bool setMaxAscent = false;
     230    bool setMaxDescent = false;
    229231
    230232    // Figure out if we're in no-quirks mode.
    231233    bool noQuirksMode = renderer()->document()->inNoQuirksMode();
    232234
    233     computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, noQuirksMode, textBoxDataMap);
     235    computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode, textBoxDataMap);
    234236
    235237    if (maxAscent + maxDescent < max(maxPositionTop, maxPositionBottom))
  • trunk/WebKit/mac/ChangeLog

    r72129 r72141  
     12010-11-16  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=11004
     6       
     7        font-size:0 is ignored.  Remove the minimum font size of 1 in CSSStyleSelector.
     8        Change the pref value for minimum font size from 1 to 0.  Make sure to never use the NSFont's size,
     9        since it doesn't honor a size of 0.  Instead pass the size in to the FontPlatformData(NSFont*) version
     10        of the constructor rather than using [NSFont pointSize].
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=49582
     13       
     14        Negative leading is not handled correctly.  There are two bugs here.  The first is that
     15        maxAscent and maxDescent can be negative, so we need a notion of whether or not we have
     16        set them before so that we can allow them to be < 0.
     17       
     18        The second issue is that we should understand where fonts will end up relative to
     19        our baseline (excluding line height), and only allow those boxes to impact ascent and
     20        descent if the actual font box (without factoring in line height) is above or below the
     21        root line box baseline.
     22
     23        Added fast/css/negative-leading.html
     24       
     25        These two bug fixes have to land together to keep the Acid 3 test rendering correctly.
     26
     27        * Misc/WebKitNSStringExtras.mm:
     28        (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
     29        (-[NSString _web_widthWithFont:]):
     30        * Misc/WebStringTruncator.mm:
     31        (fontFromNSFont):
     32        * WebView/WebPreferences.mm:
     33        (+[WebPreferences initialize]):
     34
    1352010-11-16  Anders Carlsson  <andersca@apple.com>
    236
  • trunk/WebKit/mac/Misc/WebKitNSStringExtras.mm

    r70143 r72141  
    8989            CGContextScaleCTM(cgContext, 1, -1);
    9090
    91         Font webCoreFont(FontPlatformData(font), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
     91        Font webCoreFont(FontPlatformData(font, [font pointSize]), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
    9292        TextRun run(buffer.data(), length);
    9393        run.disableRoundingHacks();
     
    135135
    136136    if (canUseFastRenderer(buffer.data(), length)) {
    137         Font webCoreFont(FontPlatformData(font), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
     137        Font webCoreFont(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
    138138        TextRun run(buffer.data(), length);
    139139        run.disableRoundingHacks();
  • trunk/WebKit/mac/Misc/WebStringTruncator.mm

    r44520 r72141  
    5959    currentFont = font;
    6060    CFRetain(currentFont);
    61     FontPlatformData f(font);
     61    FontPlatformData f(font, [font pointSize]);
    6262    currentRenderer = Font(f, ![[NSGraphicsContext currentContext] isDrawingToScreen]);
    6363    return currentRenderer;
  • trunk/WebKit/mac/WebView/WebPreferences.mm

    r70751 r72141  
    306306        @"Apple Chancery",              WebKitCursiveFontPreferenceKey,
    307307        @"Papyrus",                     WebKitFantasyFontPreferenceKey,
    308         @"1",                           WebKitMinimumFontSizePreferenceKey,
     308        @"0",                           WebKitMinimumFontSizePreferenceKey,
    309309        @"9",                           WebKitMinimumLogicalFontSizePreferenceKey,
    310310        @"16",                          WebKitDefaultFontSizePreferenceKey,
  • trunk/WebKit/win/ChangeLog

    r72136 r72141  
     12010-11-16  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=11004
     6       
     7        font-size:0 is ignored.  Remove the minimum font size of 1 in CSSStyleSelector.
     8        Change the pref value for minimum font size from 1 to 0.  Make sure to never use the NSFont's size,
     9        since it doesn't honor a size of 0.  Instead pass the size in to the FontPlatformData(NSFont*) version
     10        of the constructor rather than using [NSFont pointSize].
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=49582
     13       
     14        Negative leading is not handled correctly.  There are two bugs here.  The first is that
     15        maxAscent and maxDescent can be negative, so we need a notion of whether or not we have
     16        set them before so that we can allow them to be < 0.
     17       
     18        The second issue is that we should understand where fonts will end up relative to
     19        our baseline (excluding line height), and only allow those boxes to impact ascent and
     20        descent if the actual font box (without factoring in line height) is above or below the
     21        root line box baseline.
     22
     23        Added fast/css/negative-leading.html
     24       
     25        These two bug fixes have to land together to keep the Acid 3 test rendering correctly.
     26
     27        * WebPreferences.cpp:
     28        (WebPreferences::initializeDefaultSettings):
     29
    1302010-11-16  Steve Falkenburg  <sfalken@apple.com>
    231
  • trunk/WebKit/win/WebPreferences.cpp

    r68166 r72141  
    191191    CFDictionaryAddValue(defaults, CFSTR(WebKitCursiveFontPreferenceKey), CFSTR("Comic Sans MS"));
    192192    CFDictionaryAddValue(defaults, CFSTR(WebKitFantasyFontPreferenceKey), CFSTR("Comic Sans MS"));
    193     CFDictionaryAddValue(defaults, CFSTR(WebKitMinimumFontSizePreferenceKey), CFSTR("1"));
     193    CFDictionaryAddValue(defaults, CFSTR(WebKitMinimumFontSizePreferenceKey), CFSTR("0"));
    194194    CFDictionaryAddValue(defaults, CFSTR(WebKitMinimumLogicalFontSizePreferenceKey), CFSTR("9"));
    195195    CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultFontSizePreferenceKey), CFSTR("16"));
  • trunk/WebKit2/ChangeLog

    r72131 r72141  
     12010-11-16  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=11004
     6       
     7        font-size:0 is ignored.  Remove the minimum font size of 1 in CSSStyleSelector.
     8        Change the pref value for minimum font size from 1 to 0.  Make sure to never use the NSFont's size,
     9        since it doesn't honor a size of 0.  Instead pass the size in to the FontPlatformData(NSFont*) version
     10        of the constructor rather than using [NSFont pointSize].
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=49582
     13       
     14        Negative leading is not handled correctly.  There are two bugs here.  The first is that
     15        maxAscent and maxDescent can be negative, so we need a notion of whether or not we have
     16        set them before so that we can allow them to be < 0.
     17       
     18        The second issue is that we should understand where fonts will end up relative to
     19        our baseline (excluding line height), and only allow those boxes to impact ascent and
     20        descent if the actual font box (without factoring in line height) is above or below the
     21        root line box baseline.
     22
     23        Added fast/css/negative-leading.html
     24       
     25        These two bug fixes have to land together to keep the Acid 3 test rendering correctly.
     26
     27        * Shared/WebPreferencesStore.cpp:
     28        (WebKit::WebPreferencesStore::WebPreferencesStore):
     29
    1302010-11-16  Anders Carlsson  <andersca@apple.com>
    231
  • trunk/WebKit2/Shared/WebPreferencesStore.cpp

    r70680 r72141  
    4848    , developerExtrasEnabled(false)
    4949    , fontSmoothingLevel(FontSmoothingLevelMedium)
    50     , minimumFontSize(1)
     50    , minimumFontSize(0)
    5151    , minimumLogicalFontSize(9)
    5252    , defaultFontSize(16)
Note: See TracChangeset for help on using the changeset viewer.