[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hyatt at apple.com hyatt at apple.com
Wed Dec 22 15:56:13 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 80958a7c909889d33a3285c8a98db289196d5fba
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 16 23:28:53 2010 +0000

    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:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72141 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 50e7dd9..9d5e924 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,41 @@
+2010-11-16  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=11004
+        
+        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.
+
+        * 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:
+
 2010-11-16  David Levin  <levin at chromium.org>
 
         Removed lines for tests that are now passing after r72137.
diff --git a/LayoutTests/fast/css/negative-leading.html b/LayoutTests/fast/css/negative-leading.html
new file mode 100644
index 0000000..0509f8e
--- /dev/null
+++ b/LayoutTests/fast/css/negative-leading.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            div { 
+                font-size: 48px;
+                font-family: arial;
+                width: 400px;
+            }
+        </style>
+    </head>
+    <body>
+        <p>The following two phrases should appear identical. The second line of text should overlap both the first line and the red border.</p>
+        <div style="border: 2px solid red; height: 100%; padding: 10px 10px 0px 10px">
+            <div style="line-height:19px">Lorem ipsum dolor sit amet</div>
+        </div>
+        <br>
+        <div style="border: 2px solid red; height: 100%; padding: 10px 10px 0px 10px">
+            <div style="line-height:40%">Lorem ipsum dolor sit amet</div>
+        </div>
+    </body>
+</html>
+
diff --git a/LayoutTests/platform/mac/fast/compact/001-expected.checksum b/LayoutTests/platform/mac/fast/compact/001-expected.checksum
index a28d9ad..d88f987 100644
--- a/LayoutTests/platform/mac/fast/compact/001-expected.checksum
+++ b/LayoutTests/platform/mac/fast/compact/001-expected.checksum
@@ -1 +1 @@
-59cf3d6597fc8c1700323ceacd7f4735
\ No newline at end of file
+bf7c2f92f348ee027ab468c6fd6cf26b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/compact/001-expected.png b/LayoutTests/platform/mac/fast/compact/001-expected.png
index babd4f0..37db2d6 100644
Binary files a/LayoutTests/platform/mac/fast/compact/001-expected.png and b/LayoutTests/platform/mac/fast/compact/001-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/compact/001-expected.txt b/LayoutTests/platform/mac/fast/compact/001-expected.txt
index 2669c95..b7674eb 100644
--- a/LayoutTests/platform/mac/fast/compact/001-expected.txt
+++ b/LayoutTests/platform/mac/fast/compact/001-expected.txt
@@ -1,15 +1,15 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x81
-  RenderBlock {HTML} at (0,0) size 800x81
-    RenderBody {BODY} at (8,16) size 784x57
+layer at (0,0) size 800x77
+  RenderBlock {HTML} at (0,0) size 800x76
+    RenderBody {BODY} at (8,16) size 784x52
       RenderBlock {P} at (0,0) size 784x18
         RenderText {#text} at (0,0) size 193x18
           text run at (0,0) width 193: "There should be no red below."
       RenderBlock {DIV} at (0,34) size 784x18
         RenderText {#text} at (0,0) size 31x18
           text run at (0,0) width 31: "Test:"
-      RenderBlock {DIV} at (160,52) size 624x5 [color=#FF0000] [bgcolor=#00FF00]
+      RenderBlock {DIV} at (160,52) size 624x0 [color=#FF0000] [bgcolor=#00FF00]
         RenderInline {SPAN} at (0,0) size 299x18 [color=#000000]
           RenderText {#text} at (0,-9) size 299x18
             text run at (0,-9) width 299: "This sentence should have a green background."
diff --git a/LayoutTests/platform/mac/fast/css/negative-leading-expected.checksum b/LayoutTests/platform/mac/fast/css/negative-leading-expected.checksum
new file mode 100644
index 0000000..4df4efd
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/negative-leading-expected.checksum
@@ -0,0 +1 @@
+4645624a04de95c3af7681eaa57fa781
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/negative-leading-expected.png b/LayoutTests/platform/mac/fast/css/negative-leading-expected.png
new file mode 100644
index 0000000..b534ec2
Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/negative-leading-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/negative-leading-expected.txt b/LayoutTests/platform/mac/fast/css/negative-leading-expected.txt
new file mode 100644
index 0000000..0b9524e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/negative-leading-expected.txt
@@ -0,0 +1,21 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x205
+  RenderBlock {HTML} at (0,0) size 800x198
+    RenderBody {BODY} at (8,16) size 784x174
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 751x36
+          text run at (0,0) width 751: "The following two phrases should appear identical. The second line of text should overlap both the first line and the red"
+          text run at (0,18) width 45: "border."
+      RenderBlock {DIV} at (0,52) size 424x52 [border: (2px solid #FF0000)]
+        RenderBlock {DIV} at (12,12) size 400x38
+          RenderText {#text} at (0,-17) size 400x72
+            text run at (0,-17) width 400: "Lorem ipsum dolor"
+            text run at (0,2) width 168: "sit amet"
+      RenderBlock (anonymous) at (0,104) size 784x18
+        RenderBR {BR} at (0,0) size 0x18
+      RenderBlock {DIV} at (0,122) size 424x52 [border: (2px solid #FF0000)]
+        RenderBlock {DIV} at (12,12) size 400x38
+          RenderText {#text} at (0,-17) size 400x72
+            text run at (0,-17) width 400: "Lorem ipsum dolor"
+            text run at (0,2) width 168: "sit amet"
diff --git a/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.checksum b/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.checksum
index 4211475..4eaf8c6 100644
--- a/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.checksum
+++ b/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.checksum
@@ -1 +1 @@
-bcdc206d48bcdb75decb4407a15b934b
\ No newline at end of file
+a8e4279b6289b99c9deeba8a58c2f357
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.png b/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.png
index 68e0c7b..17a5900 100644
Binary files a/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.png and b/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.txt b/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.txt
index 9f0a982..9d44a7a 100644
--- a/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/linebox-overflow-in-textarea-padding-expected.txt
@@ -3,24 +3,24 @@ layer at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x576
-      RenderBlock (anonymous) at (0,0) size 784x54
+      RenderBlock (anonymous) at (0,0) size 784x71
         RenderText {#text} at (300,36) size 4x18
           text run at (300,36) width 4: " "
         RenderText {#text} at (0,0) size 0x0
-      RenderBlock {P} at (0,70) size 784x36
+      RenderBlock {P} at (0,87) size 784x36
         RenderText {#text} at (0,0) size 753x36
           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"
           text run at (0,18) width 53: "textarea."
-layer at (8,8) size 300x50 clip at (11,11) size 279x44 scrollHeight 52
+layer at (8,8) size 300x50 clip at (11,11) size 294x44
   RenderTextControl {TEXTAREA} at (0,0) size 300x50 [color=#0000FF] [bgcolor=#FFFFFF] [border: (3px solid #FFFF00)]
-    RenderBlock {DIV} at (18,18) size 249x22
-      RenderText {#text} at (0,-17) size 180x46
+    RenderBlock {DIV} at (18,18) size 264x0
+      RenderText {#text} at (0,-17) size 180x35
         text run at (0,-17) width 162: "ggggggggg"
         text run at (162,-17) width 18: " "
-        text run at (0,-6) width 162: "ggggggggg"
-layer at (312,8) size 300x50 clip at (315,11) size 279x44 scrollHeight 52
-  RenderBlock {DIV} at (304,0) size 300x50 [color=#0000FF] [border: (3px solid #FFFF00)]
-    RenderBlock {DIV} at (18,18) size 249x22
-      RenderText {#text} at (0,-17) size 162x46
         text run at (0,-17) width 162: "ggggggggg"
-        text run at (0,-6) width 162: "ggggggggg"
+layer at (312,29) size 300x50 clip at (315,32) size 294x44
+  RenderBlock {DIV} at (304,21) size 300x50 [color=#0000FF] [border: (3px solid #FFFF00)]
+    RenderBlock {DIV} at (18,18) size 264x0
+      RenderText {#text} at (0,-17) size 162x35
+        text run at (0,-17) width 162: "ggggggggg"
+        text run at (0,-17) width 162: "ggggggggg"
diff --git a/LayoutTests/platform/mac/fast/parser/style-script-head-test-expected.png b/LayoutTests/platform/mac/fast/parser/style-script-head-test-expected.png
index 2217df2..30ce509 100644
Binary files a/LayoutTests/platform/mac/fast/parser/style-script-head-test-expected.png and b/LayoutTests/platform/mac/fast/parser/style-script-head-test-expected.png differ
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7e83558..6df97b9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2010-11-16  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=11004
+        
+        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.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):
+
 2010-11-16  Darin Adler  <darin at apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=49611
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index a75fb98..d2602d2 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -383,7 +383,7 @@ __ZN7WebCore16DeviceMotionData12Acceleration6createEbdbdbd
 __ZN7WebCore16DeviceMotionData12RotationRate6createEbdbdbd
 __ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd
 __ZN7WebCore16FontFallbackList15releaseFontDataEv
-__ZN7WebCore16FontPlatformDataC1EP6NSFontbbNS_15FontOrientationE
+__ZN7WebCore16FontPlatformDataC1EP6NSFontfbbNS_15FontOrientationE
 __ZN7WebCore16FontPlatformDataD1Ev
 __ZN7WebCore16HTMLInputElement13setAutofilledEb
 __ZN7WebCore16LegacyWebArchive19createFromSelectionEPNS_5FrameE
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index a3c94dc..af67fb3 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -6292,7 +6292,7 @@ float CSSStyleSelector::getComputedSizeFromSpecifiedSize(Document* document, Ren
     
     // Also clamp to a reasonable maximum to prevent insane font sizes from causing crashes on various
     // platforms (I'm looking at you, Windows.)
-    return min(1000000.0f, max(zoomedSize, 1.0f));
+    return min(1000000.0f, zoomedSize);
 }
 
 const int fontSizeTableMax = 16;
diff --git a/WebCore/platform/graphics/cocoa/FontPlatformData.h b/WebCore/platform/graphics/cocoa/FontPlatformData.h
index 17ae4b5..7ab84f5 100644
--- a/WebCore/platform/graphics/cocoa/FontPlatformData.h
+++ b/WebCore/platform/graphics/cocoa/FontPlatformData.h
@@ -73,7 +73,7 @@ class FontPlatformData {
     {
     }
 
-    FontPlatformData(NSFont *nsFont, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal);
+    FontPlatformData(NSFont *nsFont, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal);
     
     FontPlatformData(CGFontRef cgFont, ATSUFontID fontID, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation)
         : m_syntheticBold(syntheticBold)
diff --git a/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm b/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
index d902d3c..52a88ed 100644
--- a/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
+++ b/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
@@ -44,9 +44,10 @@ void FontPlatformData::loadFont(NSFont* nsFont, float, NSFont*& outNSFont, CGFon
 }
 #endif  // PLATFORM(MAC)
 
-FontPlatformData::FontPlatformData(NSFont *nsFont, bool syntheticBold, bool syntheticOblique, FontOrientation orientation)
+FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation)
     : m_syntheticBold(syntheticBold)
     , m_syntheticOblique(syntheticOblique)
+    , m_size(size)
     , m_font(nsFont)
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     // FIXME: Chromium: The following code isn't correct for the Chromium port since the sandbox might
@@ -58,10 +59,8 @@ FontPlatformData::FontPlatformData(NSFont *nsFont, bool syntheticBold, bool synt
 {
     ASSERT_ARG(nsFont, nsFont);
 
-    m_size = [nsFont pointSize];
-    
     CGFontRef cgFont = 0;
-    loadFont(nsFont, m_size, m_font, cgFont, m_atsuFontID);
+    loadFont(nsFont, size, m_font, cgFont, m_atsuFontID);
 
     m_orientation = orientation;
 
diff --git a/WebCore/platform/graphics/mac/FontCacheMac.mm b/WebCore/platform/graphics/mac/FontCacheMac.mm
index 313db1c..068bd8e 100644
--- a/WebCore/platform/graphics/mac/FontCacheMac.mm
+++ b/WebCore/platform/graphics/mac/FontCacheMac.mm
@@ -140,7 +140,7 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
     NSFontTraitMask substituteFontTraits = [fontManager traitsOfFont:substituteFont];
     NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont];
 
-    FontPlatformData alternateFont(substituteFont, 
+    FontPlatformData alternateFont(substituteFont, platformData.size(),
         !font.isPlatformFont() && isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(substituteFontWeight),
         !font.isPlatformFont() && (traits & NSFontItalicTrait) && !(substituteFontTraits & NSFontItalicTrait),
         platformData.m_orientation);
@@ -211,7 +211,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
     bool syntheticBold = isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(actualWeight);
     bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait);
 
-    return new FontPlatformData(platformFont, syntheticBold, syntheticOblique, fontDescription.orientation());
+    return new FontPlatformData(platformFont, size, syntheticBold, syntheticOblique, fontDescription.orientation());
 }
 
 } // namespace WebCore
diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
index 27f9588..e1d3f43 100644
--- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
+++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
@@ -382,8 +382,8 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes
             m_smallCapsFontData = new SimpleFontData(smallCapsFontData, true, false);
         } else {
             BEGIN_BLOCK_OBJC_EXCEPTIONS;
-            float size = [m_platformData.font() pointSize] * smallCapsFontSizeMultiplier;
-            FontPlatformData smallCapsFont([[NSFontManager sharedFontManager] convertFont:m_platformData.font() toSize:size]);
+            float size = m_platformData.size() * smallCapsFontSizeMultiplier;
+            FontPlatformData smallCapsFont([[NSFontManager sharedFontManager] convertFont:m_platformData.font() toSize:size], size);
             
             // AppKit resets the type information (screen/printer) when you convert a font to a different size.
             // We have to fix up the font that we're handed back.
diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp
index 8525673..f486695 100644
--- a/WebCore/rendering/InlineFlowBox.cpp
+++ b/WebCore/rendering/InlineFlowBox.cpp
@@ -397,8 +397,19 @@ static int verticalPositionForBox(InlineBox* curr, bool firstLine)
 }
 
 void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
-                                             int& maxAscent, int& maxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
+                                             int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,
+                                             bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap)
 {
+    // The primary purpose of this function is to compute the maximal ascent and descent values for
+    // a line.
+    //
+    // The maxAscent value represents the distance of the highest point of any box (including line-height) from
+    // the root box's baseline.  The maxDescent value represents the distance of the lowest point of any box
+    // (also including line-height) from the root box baseline.  These values can be negative.
+    //
+    // A secondary purpose of this function is to store the offset of very box's baseline from the root box's
+    // baseline.  This information is cached in the logicalTop() of every box. We're effectively just using
+    // the logicalTop() as scratch space. 
     if (isRootInlineBox()) {
         // Examine our root box.
         int height = lineHeight();
@@ -406,10 +417,14 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
         if (hasTextChildren() || strictMode) {
             int ascent = baseline;
             int descent = height - ascent;
-            if (maxAscent < ascent)
+            if (maxAscent < ascent || !setMaxAscent) {
                 maxAscent = ascent;
-            if (maxDescent < descent)
+                setMaxAscent = true;
+            }
+            if (maxDescent < descent || !setMaxDescent) {
                 maxDescent = descent;
+                setMaxDescent = true;
+            }
         }
     }
 
@@ -418,7 +433,18 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
             continue; // Positioned placeholders don't affect calculations.
         
         bool isInlineFlow = curr->isInlineFlowBox();
-
+        
+        // Because a box can be positioned such that it ends up fully above or fully below the
+        // root line box, we only consider it to affect the maxAscent and maxDescent values if some
+        // part of the box (EXCLUDING line-height) is above (for ascent) or below (for descent) the root box's baseline.
+        bool affectsAscent = false;
+        bool affectsDescent = false;
+        
+        // The verticalPositionForBox function returns the distance between the child box's baseline
+        // and the root box's baseline.  The value is negative if the child box's baseline is above the
+        // root box's baseline, and it is positive if the child box's baseline is below the root box's baseline.
+        curr->setLogicalTop(verticalPositionForBox(curr, m_firstLine));
+        
         int lineHeight;
         int baseline;
         Vector<const SimpleFontData*>* usedFonts = 0;
@@ -437,6 +463,10 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
                     int halfLeading = (usedFonts->at(i)->lineSpacing() - usedFonts->at(i)->ascent() - usedFonts->at(i)->descent()) / 2;
                     baseline = max(baseline, halfLeading + usedFonts->at(i)->ascent());
                     baselineToBottom = max(baselineToBottom, usedFonts->at(i)->lineSpacing() - usedFonts->at(i)->ascent() - usedFonts->at(i)->descent() - halfLeading);
+                    if (!affectsAscent)
+                        affectsAscent = usedFonts->at(i)->ascent() - curr->logicalTop() > 0;
+                    if (!affectsDescent)
+                        affectsDescent = usedFonts->at(i)->descent() + curr->logicalTop() > 0;
                 }
                 lineHeight = baseline + baselineToBottom;
             } else if (parentLineHeight.isPercent()) {
@@ -445,6 +475,10 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
                 for (size_t i = 0; i < usedFonts->size(); ++i) {
                     int halfLeading = (lineHeight - usedFonts->at(i)->ascent() - usedFonts->at(i)->descent()) / 2;
                     baseline = max(baseline, halfLeading + usedFonts->at(i)->ascent());
+                    if (!affectsAscent)
+                        affectsAscent = usedFonts->at(i)->ascent() - curr->logicalTop() > 0;
+                    if (!affectsDescent)
+                        affectsDescent = usedFonts->at(i)->descent() + curr->logicalTop() > 0;
                 }
             } else {
                 lineHeight = parentLineHeight.value();
@@ -452,14 +486,31 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
                 for (size_t i = 0; i < usedFonts->size(); ++i) {
                     int halfLeading = (lineHeight - usedFonts->at(i)->ascent() - usedFonts->at(i)->descent()) / 2;
                     baseline = max(baseline, halfLeading + usedFonts->at(i)->ascent());
+                    if (!affectsAscent)
+                        affectsAscent = usedFonts->at(i)->ascent() - curr->logicalTop() > 0;
+                    if (!affectsDescent)
+                        affectsDescent = usedFonts->at(i)->descent() + curr->logicalTop() > 0;
                 }
             }
         } else {
             lineHeight = curr->lineHeight();
             baseline = curr->baselinePosition();
+            if (curr->isText() || isInlineFlow) {
+                // Examine the font box for inline flows and text boxes to see if any part of it is above the baseline.
+                // If the top of our font box relative to the root box baseline is above the root box baseline, then
+                // we are contributing to the maxAscent value.
+                affectsAscent = curr->renderer()->style(m_firstLine)->font().ascent() - curr->logicalTop() > 0;
+                
+                // Descent is similar.  If any part of our font box is below the root box's baseline, then
+                // we contribute to the maxDescent value.
+                affectsDescent = curr->renderer()->style(m_firstLine)->font().descent() + curr->logicalTop() > 0;
+            } else {
+                // Replaced elements always affect both the ascent and descent.
+                affectsAscent = true;
+                affectsDescent = true;
+            }
         }
 
-        curr->setLogicalTop(verticalPositionForBox(curr, m_firstLine));
         if (curr->logicalTop() == PositionTop) {
             if (maxPositionTop < lineHeight)
                 maxPositionTop = lineHeight;
@@ -467,16 +518,26 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
             if (maxPositionBottom < lineHeight)
                 maxPositionBottom = lineHeight;
         } else if ((!isInlineFlow || static_cast<InlineFlowBox*>(curr)->hasTextChildren()) || curr->boxModelObject()->hasInlineDirectionBordersOrPadding() || strictMode) {
+            // Note that these values can be negative.  Even though we only affect the maxAscent and maxDescent values
+            // if our box (excluding line-height) was above (for ascent) or below (for descent) the root baseline, once you factor in line-height
+            // the final box can end up being fully above or fully below the root box's baseline!  This is ok, but what it
+            // means is that ascent and descent (including leading), can end up being negative.  The setMaxAscent and
+            // setMaxDescent booleans are used to ensure that we're willing to initially set maxAscent/Descent to negative
+            // values.
             int ascent = baseline - curr->logicalTop();
             int descent = lineHeight - ascent;
-            if (maxAscent < ascent)
+            if (affectsAscent && (maxAscent < ascent || !setMaxAscent)) {
                 maxAscent = ascent;
-            if (maxDescent < descent)
+                setMaxAscent = true;
+            }
+            if (affectsDescent && (maxDescent < descent || !setMaxDescent)) {
                 maxDescent = descent;
+                setMaxDescent = true;
+            }
         }
 
         if (curr->isInlineFlowBox())
-            static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, strictMode, textBoxDataMap);
+            static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, strictMode, textBoxDataMap);
     }
 }
 
diff --git a/WebCore/rendering/InlineFlowBox.h b/WebCore/rendering/InlineFlowBox.h
index be6dfd2..b37ef84 100644
--- a/WebCore/rendering/InlineFlowBox.h
+++ b/WebCore/rendering/InlineFlowBox.h
@@ -155,7 +155,8 @@ public:
     bool onEndChain(RenderObject* endObject);
     int placeBoxesInInlineDirection(int logicalLeft, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&);
     void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom,
-                                  int& maxAscent, int& maxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&);
+                                  int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent,
+                                  bool strictMode, GlyphOverflowAndFallbackFontsMap&);
     void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent,
                                    int maxPositionTop, int maxPositionBottom);
     void placeBoxesInBlockDirection(int logicalTop, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom, bool& setLineTop);
diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp
index 2a6706a..00c2c51 100644
--- a/WebCore/rendering/RootInlineBox.cpp
+++ b/WebCore/rendering/RootInlineBox.cpp
@@ -226,11 +226,13 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn
     int maxPositionBottom = 0;
     int maxAscent = 0;
     int maxDescent = 0;
+    bool setMaxAscent = false;
+    bool setMaxDescent = false;
 
     // Figure out if we're in no-quirks mode.
     bool noQuirksMode = renderer()->document()->inNoQuirksMode();
 
-    computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, noQuirksMode, textBoxDataMap);
+    computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode, textBoxDataMap);
 
     if (maxAscent + maxDescent < max(maxPositionTop, maxPositionBottom))
         adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom);
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 70bd49c..686fc00 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,37 @@
+2010-11-16  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=11004
+        
+        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.
+
+        * Misc/WebKitNSStringExtras.mm:
+        (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
+        (-[NSString _web_widthWithFont:]):
+        * Misc/WebStringTruncator.mm:
+        (fontFromNSFont):
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+
 2010-11-16  Anders Carlsson  <andersca at apple.com>
 
         Fix clang++ build.
diff --git a/WebKit/mac/Misc/WebKitNSStringExtras.mm b/WebKit/mac/Misc/WebKitNSStringExtras.mm
index 4785de5..4bf268c 100644
--- a/WebKit/mac/Misc/WebKitNSStringExtras.mm
+++ b/WebKit/mac/Misc/WebKitNSStringExtras.mm
@@ -88,7 +88,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
         if (!flipped)
             CGContextScaleCTM(cgContext, 1, -1);
 
-        Font webCoreFont(FontPlatformData(font), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
+        Font webCoreFont(FontPlatformData(font, [font pointSize]), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
         TextRun run(buffer.data(), length);
         run.disableRoundingHacks();
 
@@ -134,7 +134,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
     [self getCharacters:buffer.data()];
 
     if (canUseFastRenderer(buffer.data(), length)) {
-        Font webCoreFont(FontPlatformData(font), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
+        Font webCoreFont(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
         TextRun run(buffer.data(), length);
         run.disableRoundingHacks();
         return webCoreFont.floatWidth(run);
diff --git a/WebKit/mac/Misc/WebStringTruncator.mm b/WebKit/mac/Misc/WebStringTruncator.mm
index fb31bbb..8081b92 100644
--- a/WebKit/mac/Misc/WebStringTruncator.mm
+++ b/WebKit/mac/Misc/WebStringTruncator.mm
@@ -58,7 +58,7 @@ static Font& fontFromNSFont(NSFont *font)
         CFRelease(currentFont);
     currentFont = font;
     CFRetain(currentFont);
-    FontPlatformData f(font);
+    FontPlatformData f(font, [font pointSize]);
     currentRenderer = Font(f, ![[NSGraphicsContext currentContext] isDrawingToScreen]);
     return currentRenderer;
 }
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index ed06188..1bacb85 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -305,7 +305,7 @@ static WebCacheModel cacheModelForMainBundle(void)
         @"Helvetica",                   WebKitSansSerifFontPreferenceKey,
         @"Apple Chancery",              WebKitCursiveFontPreferenceKey,
         @"Papyrus",                     WebKitFantasyFontPreferenceKey,
-        @"1",                           WebKitMinimumFontSizePreferenceKey,
+        @"0",                           WebKitMinimumFontSizePreferenceKey,
         @"9",                           WebKitMinimumLogicalFontSizePreferenceKey, 
         @"16",                          WebKitDefaultFontSizePreferenceKey,
         @"13",                          WebKitDefaultFixedFontSizePreferenceKey,
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index f4e0a30..93aa3d6 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,32 @@
+2010-11-16  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=11004
+        
+        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.
+
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+
 2010-11-16  Steve Falkenburg  <sfalken at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp
index d4bfd3e..0854ac8 100644
--- a/WebKit/win/WebPreferences.cpp
+++ b/WebKit/win/WebPreferences.cpp
@@ -190,7 +190,7 @@ void WebPreferences::initializeDefaultSettings()
     CFDictionaryAddValue(defaults, CFSTR(WebKitSansSerifFontPreferenceKey), CFSTR("Arial"));
     CFDictionaryAddValue(defaults, CFSTR(WebKitCursiveFontPreferenceKey), CFSTR("Comic Sans MS"));
     CFDictionaryAddValue(defaults, CFSTR(WebKitFantasyFontPreferenceKey), CFSTR("Comic Sans MS"));
-    CFDictionaryAddValue(defaults, CFSTR(WebKitMinimumFontSizePreferenceKey), CFSTR("1"));
+    CFDictionaryAddValue(defaults, CFSTR(WebKitMinimumFontSizePreferenceKey), CFSTR("0"));
     CFDictionaryAddValue(defaults, CFSTR(WebKitMinimumLogicalFontSizePreferenceKey), CFSTR("9"));
     CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultFontSizePreferenceKey), CFSTR("16"));
     CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultFixedFontSizePreferenceKey), CFSTR("13"));
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 1506055..74a1eaf 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,32 @@
+2010-11-16  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=11004
+        
+        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.
+
+        * Shared/WebPreferencesStore.cpp:
+        (WebKit::WebPreferencesStore::WebPreferencesStore):
+
 2010-11-16  Anders Carlsson  <andersca at apple.com>
 
         Fix clang++ build.
diff --git a/WebKit2/Shared/WebPreferencesStore.cpp b/WebKit2/Shared/WebPreferencesStore.cpp
index 1cb6433..5a59d0e 100644
--- a/WebKit2/Shared/WebPreferencesStore.cpp
+++ b/WebKit2/Shared/WebPreferencesStore.cpp
@@ -47,7 +47,7 @@ WebPreferencesStore::WebPreferencesStore()
     , privateBrowsingEnabled(false)
     , developerExtrasEnabled(false)
     , fontSmoothingLevel(FontSmoothingLevelMedium)
-    , minimumFontSize(1)
+    , minimumFontSize(0)
     , minimumLogicalFontSize(9)
     , defaultFontSize(16)
     , defaultFixedFontSize(13)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list