[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:26:59 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f4829be4481dca527feadade7e94b39b7aaf88c4
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 24 20:37:31 2002 +0000

    top level:
    
            * Site/Internal/Quality/fontsizes.html: Added test cases for "+/-" and "0".
    
    WebCore:
    
    	- fixed 2906567 -- Font size calculations should use 96 dpi instead of 72 dpi
    	- fixed 3005932 -- fonts specified in 'ex' units rendered waaaaaaay too large
    
            * khtml/css/cssstyleselector.cpp: (CSSStyleSelector::computeFontSizes):
    	Use a default font size that's the same as small, rather than a "medium font
    	size". Don't multiply the values from settings by the scaling factor.
    	(CSSStyleSelector::applyRule): Make the default font size here for nodes with
    	no parents be small (m_fontSizes[2]) rather than medium (m_fontSizes[3]).
    
            * khtml/html/html_inlineimpl.cpp: (parseFontSizeNumber): Added. Tolerant of
    	non-numeric characters after the numeric size. Also distinguishes a size like
    	"0" from something that's not a numeric size at all.
            (HTMLFontElementImpl::parseAttribute): Use parseFontSizeNumber, but also make
    	size 3 be the same as CSS_VAL_SMALL, not CSS_VAL_MEDIUM. This mistake (using
    	CSS_VAL_MEDIUM) led to all kinds of strangeness in the KHTML code, including
    	mishandling of 0 and the need to create CSS_VAL__KONQ_XXX_LARGE. Also change
    	code so that 0 is treated as CSS_VAL_SMALL (same as 3) rather than CSS_VAL_XX_SMALL.
    	This makes 0 between -1 and +1.
    
            * khtml/xml/dom_docimpl.cpp: (DocumentImpl::recalcStyle): Make default font
    	size be small (fontSizes()[2]) rather than medium (fontSizes()[3]).
            * khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::HTMLTableElementImpl):
    	Make default font size be CSS_VAL_SMALL, not CSS_VAL_MEDIUM.
    
            * kwq/qt/qfontmetrics.h:
            * kwq/KWQFontMetrics.mm: (QFontMetrics::xHeight): Added.
            * kwq/WebCoreTextRenderer.h: Added xHeight.
    
            * khtml/css/css_valueimpl.cpp: (CSSPrimitiveValueImpl::computeLengthFloat):
    	Use xHeight rather than computing the height of an actual letter 'x'.
            * khtml/rendering/render_object.cpp: (RenderObject::getVerticalPosition):
    	Use xHeight rather than computing the height of an actual letter 'x'.
    
            * kwq/WebCoreBridge.mm: (-[WebCoreBridge reapplyStyles]): Fixed backwards
    	if that prevented font changes from being reflected in the browser window.
    
            * kwq/khtml/khtml_settings.h:
            * kwq/KWQKHTMLSettings.mm:
    	(KHTMLSettings::defaultFontSize):
            * kwq/WebCoreSettings.h:
            * kwq/WebCoreSettings.m:
            (-[WebCoreSettings setDefaultFontSize:]):
            (-[WebCoreSettings defaultFontSize]):
    	Replace mediumFontSize with defaultFontSize.
    
            * WebCore.pbproj/project.pbxproj: Rearrange some of the files.
    
    WebKit:
    
            * WebCoreSupport.subproj/WebTextRenderer.m:
            (-[WebTextRenderer xHeight]): Added. Calls [NSFont xHeight].
    
            * WebView.subproj/WebPreferences.h:
            * WebView.subproj/WebPreferences.m:
            (+[WebPreferences load]):
            (-[WebPreferences defaultFontSize]):
            (-[WebPreferences setDefaultFontSize:]):
    	Renamed minimumFont to defaultFont, and changed it from 11 to 16.
    	Also changed default monospaced font to Courier instead of Monaco.
    
    WebBrowser:
    
            * Preferences.subproj/TextPreferences.m:
            (-[TextPreferences defaultFontSize]), (-[TextPreferences setDefaultFontSize:]):
    	Change to use new WebPreferences mediumFontSize (since default is the same as small,
    	not medium).
    
            * BrowserDocument.m: (-[BrowserDocument reapplyStyles:]): Use setNeedsDisplay:
    	instead of display. It's impolite and unnecessary to do an explicit display.
    
            * WebBrowser.pbproj/project.pbxproj: Small name tweak.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1655 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index a42e274..dde505d 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,52 @@
+2002-07-24  Darin Adler  <darin at apple.com>
+
+	- fixed 2906567 -- Font size calculations should use 96 dpi instead of 72 dpi
+	- fixed 3005932 -- fonts specified in 'ex' units rendered waaaaaaay too large
+	
+        * khtml/css/cssstyleselector.cpp: (CSSStyleSelector::computeFontSizes):
+	Use a default font size that's the same as small, rather than a "medium font
+	size". Don't multiply the values from settings by the scaling factor.
+	(CSSStyleSelector::applyRule): Make the default font size here for nodes with
+	no parents be small (m_fontSizes[2]) rather than medium (m_fontSizes[3]).
+
+        * khtml/html/html_inlineimpl.cpp: (parseFontSizeNumber): Added. Tolerant of
+	non-numeric characters after the numeric size. Also distinguishes a size like
+	"0" from something that's not a numeric size at all.
+        (HTMLFontElementImpl::parseAttribute): Use parseFontSizeNumber, but also make
+	size 3 be the same as CSS_VAL_SMALL, not CSS_VAL_MEDIUM. This mistake (using
+	CSS_VAL_MEDIUM) led to all kinds of strangeness in the KHTML code, including
+	mishandling of 0 and the need to create CSS_VAL__KONQ_XXX_LARGE. Also change
+	code so that 0 is treated as CSS_VAL_SMALL (same as 3) rather than CSS_VAL_XX_SMALL.
+	This makes 0 between -1 and +1.
+
+        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::recalcStyle): Make default font
+	size be small (fontSizes()[2]) rather than medium (fontSizes()[3]).
+        * khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::HTMLTableElementImpl):
+	Make default font size be CSS_VAL_SMALL, not CSS_VAL_MEDIUM.
+
+        * kwq/qt/qfontmetrics.h:
+        * kwq/KWQFontMetrics.mm: (QFontMetrics::xHeight): Added.
+        * kwq/WebCoreTextRenderer.h: Added xHeight.
+
+        * khtml/css/css_valueimpl.cpp: (CSSPrimitiveValueImpl::computeLengthFloat):
+	Use xHeight rather than computing the height of an actual letter 'x'.
+        * khtml/rendering/render_object.cpp: (RenderObject::getVerticalPosition):
+	Use xHeight rather than computing the height of an actual letter 'x'.
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge reapplyStyles]): Fixed backwards
+	if that prevented font changes from being reflected in the browser window.
+
+        * kwq/khtml/khtml_settings.h:
+        * kwq/KWQKHTMLSettings.mm:
+	(KHTMLSettings::defaultFontSize):
+        * kwq/WebCoreSettings.h:
+        * kwq/WebCoreSettings.m:
+        (-[WebCoreSettings setDefaultFontSize:]):
+        (-[WebCoreSettings defaultFontSize]):
+	Replace mediumFontSize with defaultFontSize.
+
+        * WebCore.pbproj/project.pbxproj: Rearrange some of the files.
+
 2002-07-24  Richard Williamson (Local)  <rjw at apple.com>
 
         Support for find in HTML.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index a42e274..dde505d 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,52 @@
+2002-07-24  Darin Adler  <darin at apple.com>
+
+	- fixed 2906567 -- Font size calculations should use 96 dpi instead of 72 dpi
+	- fixed 3005932 -- fonts specified in 'ex' units rendered waaaaaaay too large
+	
+        * khtml/css/cssstyleselector.cpp: (CSSStyleSelector::computeFontSizes):
+	Use a default font size that's the same as small, rather than a "medium font
+	size". Don't multiply the values from settings by the scaling factor.
+	(CSSStyleSelector::applyRule): Make the default font size here for nodes with
+	no parents be small (m_fontSizes[2]) rather than medium (m_fontSizes[3]).
+
+        * khtml/html/html_inlineimpl.cpp: (parseFontSizeNumber): Added. Tolerant of
+	non-numeric characters after the numeric size. Also distinguishes a size like
+	"0" from something that's not a numeric size at all.
+        (HTMLFontElementImpl::parseAttribute): Use parseFontSizeNumber, but also make
+	size 3 be the same as CSS_VAL_SMALL, not CSS_VAL_MEDIUM. This mistake (using
+	CSS_VAL_MEDIUM) led to all kinds of strangeness in the KHTML code, including
+	mishandling of 0 and the need to create CSS_VAL__KONQ_XXX_LARGE. Also change
+	code so that 0 is treated as CSS_VAL_SMALL (same as 3) rather than CSS_VAL_XX_SMALL.
+	This makes 0 between -1 and +1.
+
+        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::recalcStyle): Make default font
+	size be small (fontSizes()[2]) rather than medium (fontSizes()[3]).
+        * khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::HTMLTableElementImpl):
+	Make default font size be CSS_VAL_SMALL, not CSS_VAL_MEDIUM.
+
+        * kwq/qt/qfontmetrics.h:
+        * kwq/KWQFontMetrics.mm: (QFontMetrics::xHeight): Added.
+        * kwq/WebCoreTextRenderer.h: Added xHeight.
+
+        * khtml/css/css_valueimpl.cpp: (CSSPrimitiveValueImpl::computeLengthFloat):
+	Use xHeight rather than computing the height of an actual letter 'x'.
+        * khtml/rendering/render_object.cpp: (RenderObject::getVerticalPosition):
+	Use xHeight rather than computing the height of an actual letter 'x'.
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge reapplyStyles]): Fixed backwards
+	if that prevented font changes from being reflected in the browser window.
+
+        * kwq/khtml/khtml_settings.h:
+        * kwq/KWQKHTMLSettings.mm:
+	(KHTMLSettings::defaultFontSize):
+        * kwq/WebCoreSettings.h:
+        * kwq/WebCoreSettings.m:
+        (-[WebCoreSettings setDefaultFontSize:]):
+        (-[WebCoreSettings defaultFontSize]):
+	Replace mediumFontSize with defaultFontSize.
+
+        * WebCore.pbproj/project.pbxproj: Rearrange some of the files.
+
 2002-07-24  Richard Williamson (Local)  <rjw at apple.com>
 
         Support for find in HTML.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a42e274..dde505d 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,52 @@
+2002-07-24  Darin Adler  <darin at apple.com>
+
+	- fixed 2906567 -- Font size calculations should use 96 dpi instead of 72 dpi
+	- fixed 3005932 -- fonts specified in 'ex' units rendered waaaaaaay too large
+	
+        * khtml/css/cssstyleselector.cpp: (CSSStyleSelector::computeFontSizes):
+	Use a default font size that's the same as small, rather than a "medium font
+	size". Don't multiply the values from settings by the scaling factor.
+	(CSSStyleSelector::applyRule): Make the default font size here for nodes with
+	no parents be small (m_fontSizes[2]) rather than medium (m_fontSizes[3]).
+
+        * khtml/html/html_inlineimpl.cpp: (parseFontSizeNumber): Added. Tolerant of
+	non-numeric characters after the numeric size. Also distinguishes a size like
+	"0" from something that's not a numeric size at all.
+        (HTMLFontElementImpl::parseAttribute): Use parseFontSizeNumber, but also make
+	size 3 be the same as CSS_VAL_SMALL, not CSS_VAL_MEDIUM. This mistake (using
+	CSS_VAL_MEDIUM) led to all kinds of strangeness in the KHTML code, including
+	mishandling of 0 and the need to create CSS_VAL__KONQ_XXX_LARGE. Also change
+	code so that 0 is treated as CSS_VAL_SMALL (same as 3) rather than CSS_VAL_XX_SMALL.
+	This makes 0 between -1 and +1.
+
+        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::recalcStyle): Make default font
+	size be small (fontSizes()[2]) rather than medium (fontSizes()[3]).
+        * khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::HTMLTableElementImpl):
+	Make default font size be CSS_VAL_SMALL, not CSS_VAL_MEDIUM.
+
+        * kwq/qt/qfontmetrics.h:
+        * kwq/KWQFontMetrics.mm: (QFontMetrics::xHeight): Added.
+        * kwq/WebCoreTextRenderer.h: Added xHeight.
+
+        * khtml/css/css_valueimpl.cpp: (CSSPrimitiveValueImpl::computeLengthFloat):
+	Use xHeight rather than computing the height of an actual letter 'x'.
+        * khtml/rendering/render_object.cpp: (RenderObject::getVerticalPosition):
+	Use xHeight rather than computing the height of an actual letter 'x'.
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge reapplyStyles]): Fixed backwards
+	if that prevented font changes from being reflected in the browser window.
+
+        * kwq/khtml/khtml_settings.h:
+        * kwq/KWQKHTMLSettings.mm:
+	(KHTMLSettings::defaultFontSize):
+        * kwq/WebCoreSettings.h:
+        * kwq/WebCoreSettings.m:
+        (-[WebCoreSettings setDefaultFontSize:]):
+        (-[WebCoreSettings defaultFontSize]):
+	Replace mediumFontSize with defaultFontSize.
+
+        * WebCore.pbproj/project.pbxproj: Rearrange some of the files.
+
 2002-07-24  Richard Williamson (Local)  <rjw at apple.com>
 
         Support for find in HTML.
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index fa55567..f71d25f 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -3249,20 +3249,20 @@
 		};
 		F523D2F302DE443B018635CA = {
 			children = (
-				F523D29D02DE4438018635CA,
 				F523D29E02DE4438018635CA,
-				F523D29F02DE4438018635CA,
+				F523D29D02DE4438018635CA,
 				F523D2A002DE4438018635CA,
-				F523D2A102DE4438018635CA,
+				F523D29F02DE4438018635CA,
 				F523D2A202DE4438018635CA,
-				F523D2A302DE4438018635CA,
+				F523D2A102DE4438018635CA,
 				F523D2A402DE4438018635CA,
-				F523D2A502DE4438018635CA,
+				F523D2A302DE4438018635CA,
 				F523D2A602DE4438018635CA,
-				F523D2A702DE4438018635CA,
+				F523D2A502DE4438018635CA,
 				F523D2A802DE4438018635CA,
-				F523D2A902DE4438018635CA,
+				F523D2A702DE4438018635CA,
 				F523D2AA02DE4438018635CA,
+				F523D2A902DE4438018635CA,
 				F523D2AB02DE4438018635CA,
 				F523D2AC02DE4438018635CA,
 				F523D2AD02DE4438018635CA,
@@ -3279,19 +3279,19 @@
 				F523D2B802DE4438018635CA,
 				F523D2B902DE4438018635CA,
 				F523D2BA02DE4438018635CA,
-				F523D2BB02DE4438018635CA,
 				F523D2BC02DE4438018635CA,
-				F523D2BD02DE4438018635CA,
+				F523D2BB02DE4438018635CA,
 				F523D2BE02DE4438018635CA,
+				F523D2BD02DE4438018635CA,
 				F523D2BF02DE4438018635CA,
-				F523D2C002DE4438018635CA,
 				F523D2C102DE4438018635CA,
-				F523D2C202DE4438018635CA,
+				F523D2C002DE4438018635CA,
 				F523D2C302DE4438018635CA,
-				F523D2C402DE4438018635CA,
+				F523D2C202DE4438018635CA,
 				F523D2C502DE4438018635CA,
-				F523D2C602DE4438018635CA,
+				F523D2C402DE4438018635CA,
 				F523D2C702DE4438018635CA,
+				F523D2C602DE4438018635CA,
 			);
 			isa = PBXGroup;
 			path = rendering;
diff --git a/WebCore/khtml/css/css_valueimpl.cpp b/WebCore/khtml/css/css_valueimpl.cpp
index 3afacaf..6c011af 100644
--- a/WebCore/khtml/css/css_valueimpl.cpp
+++ b/WebCore/khtml/css/css_valueimpl.cpp
@@ -403,8 +403,12 @@ float CSSPrimitiveValueImpl::computeLengthFloat( khtml::RenderStyle *style, QPai
     case CSSPrimitiveValue::CSS_EXS:
 	{
         QFontMetrics fm = style->fontMetrics();
+#ifdef APPLE_CHANGES
+        factor = fm.xHeight();
+#else
         QRect b = fm.boundingRect('x');
         factor = b.height();
+#endif
         break;
 	}
     case CSSPrimitiveValue::CSS_PX:
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index def900c..acb440e 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -231,28 +231,35 @@ void CSSStyleSelector::clear()
 
 void CSSStyleSelector::computeFontSizes(QPaintDeviceMetrics* paintDeviceMetrics,  int zoomFactor)
 {
+#ifndef APPLE_CHANGES
     // ### get rid of float / double
     float toPix = paintDeviceMetrics->logicalDpiY()/72.;
     if (toPix  < 96./72.) toPix = 96./72.;
+#endif
 
     m_fontSizes.clear();
     const float factor = 1.2;
-    float scale = 1.0 / (factor*factor*factor);
-    float mediumFontSize;
+    float scale = 1.0 / (factor*factor);
+    float defaultFontSize;
     float minFontSize;
     if (!khtml::printpainter) {
         scale *= zoomFactor / 100.0;
-        mediumFontSize = settings->mediumFontSize() * toPix;
+#ifdef APPLE_CHANGES
+        defaultFontSize = settings->defaultFontSize();
+        minFontSize = settings->minFontSize();
+#else
+        defaultFontSize = settings->defaultFontSize() * toPix;
         minFontSize = settings->minFontSize() * toPix;
+#endif
     }
     else {
         // ## depending on something / configurable ?
-        mediumFontSize = 12;
+        defaultFontSize = 12;
         minFontSize = 6;
     }
 
     for ( int i = 0; i < MAXFONTSIZES; i++ ) {
-        m_fontSizes << int(KMAX( mediumFontSize * scale + 0.5f, minFontSize));
+        m_fontSizes << int(KMAX( defaultFontSize * scale + 0.5f, minFontSize));
         scale *= factor;
     }
 }
@@ -2234,7 +2241,7 @@ void CSSStyleSelector::applyRule( DOM::CSSProperty *prop )
         if(parentNode) {
             oldSize = parentStyle->font().pixelSize();
         } else
-            oldSize = m_fontSizes[3];
+            oldSize = m_fontSizes[2]; // default size is same as CSS_VAL_SMALL
 
         if(value->cssValueType() == CSSValue::CSS_INHERIT) {
             size = oldSize;
diff --git a/WebCore/khtml/html/html_inlineimpl.cpp b/WebCore/khtml/html/html_inlineimpl.cpp
index a2cd4d3..9b13282 100644
--- a/WebCore/khtml/html/html_inlineimpl.cpp
+++ b/WebCore/khtml/html/html_inlineimpl.cpp
@@ -235,35 +235,76 @@ NodeImpl::Id HTMLFontElementImpl::id() const
     return ID_FONT;
 }
 
+// Allows leading spaces.
+// Allows trailing nonnumeric characters.
+// Returns 10 for any size greater than 9.
+static bool parseFontSizeNumber(const DOMString &s, int &size)
+{
+    unsigned pos = 0;
+    
+    // Skip leading spaces.
+    while (pos < s.length() && s[pos].isSpace())
+        ++pos;
+    
+    // Skip a plus or minus.
+    bool sawPlus = false;
+    bool sawMinus = false;
+    if (pos < s.length() && s[pos] == '+') {
+        ++pos;
+        sawPlus = true;
+    } else if (pos < s.length() && s[pos] == '-') {
+        ++pos;
+        sawMinus = true;
+    }
+    
+    // Parse a single digit.
+    if (pos >= s.length() || !s[pos].isNumber())
+        return false;
+    int num = s[pos++].digitValue();
+    
+    // Check for an additional digit.
+    if (pos < s.length() && s[pos].isNumber())
+        num = 10;
+    
+    if (sawPlus) {
+        size = num + 3;
+        return true;
+    }
+    
+    // Don't return 0 (which means 3) or a negative number (which means the same as 1).
+    if (sawMinus) {
+        size = num == 1 ? 2 : 1;
+        return true;
+    }
+    
+    size = num;
+    return true;
+}
+
 void HTMLFontElementImpl::parseAttribute(AttributeImpl *attr)
 {
     switch(attr->id())
     {
     case ATTR_SIZE:
     {
-        DOMString s = attr->value();
-        if(!s.isNull()) {
-            int num = s.toInt();
-            if ( *s.unicode() == '+' || *s.unicode() == '-' ) {
-                num += 3;
-            }
-            int size = 0;
+        int num;
+        if (parseFontSizeNumber(attr->value(), num)) {
+            int size;
             switch (num)
             {
-            case 1: size = CSS_VAL_X_SMALL; break;
-            case 2: size = CSS_VAL_SMALL;   break;
-            case 3: size = CSS_VAL_MEDIUM;  break;
-            case 4: size = CSS_VAL_LARGE;   break;
-            case 5: size = CSS_VAL_X_LARGE; break;
-            case 6: size = CSS_VAL_XX_LARGE;break;
+            case 2: size = CSS_VAL_X_SMALL; break;
+            case 0: // treat 0 the same as 3, because people expect it to be between -1 and +1
+            case 3: size = CSS_VAL_SMALL; break;
+            case 4: size = CSS_VAL_MEDIUM; break;
+            case 5: size = CSS_VAL_LARGE; break;
+            case 6: size = CSS_VAL_X_LARGE; break;
             default:
-                if (num >= 6)
-                    size = CSS_VAL__KONQ_XXX_LARGE;
-                else if (num < 1)
+                if (num > 6)
+                    size = CSS_VAL_XX_LARGE;
+                else
                     size = CSS_VAL_XX_SMALL;
             }
-            if ( size )
-                addCSSProperty(CSS_PROP_FONT_SIZE, size);
+            addCSSProperty(CSS_PROP_FONT_SIZE, size);
         }
         break;
     }
diff --git a/WebCore/khtml/html/html_tableimpl.cpp b/WebCore/khtml/html/html_tableimpl.cpp
index 67dc207..ff47f11 100644
--- a/WebCore/khtml/html/html_tableimpl.cpp
+++ b/WebCore/khtml/html/html_tableimpl.cpp
@@ -64,7 +64,7 @@ HTMLTableElementImpl::HTMLTableElementImpl(DocumentPtr *doc)
     // this is 90% compatible to ie and mozilla, and the by way easiest solution...
     // only difference to 100% correct is that in strict mode <font> elements are propagated into tables.
     if ( getDocument()->parseMode() != DocumentImpl::Strict ) {
-        addCSSProperty( CSS_PROP_FONT_SIZE, CSS_VAL_MEDIUM );
+        addCSSProperty( CSS_PROP_FONT_SIZE, CSS_VAL_SMALL ); // browser defaults use small, not medium
         addCSSProperty( CSS_PROP_COLOR, getDocument()->textColor() );
         addCSSProperty( CSS_PROP_FONT_FAMILY, "konq_default" );
     }
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index fb1175a..45c94b0 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -933,8 +933,12 @@ short RenderObject::getVerticalPosition( bool firstLine ) const
                 vpos += ( baselinePosition( firstLine ) - parent()->baselinePosition( firstLine ) +
                         halfleading );
 	    } else if ( va == MIDDLE ) {
+#ifdef APPLE_CHANGES
+		vpos += - (int)(QFontMetrics(f).xHeight()/2) - lineHeight( firstLine )/2 + baselinePosition( firstLine );
+#else
 		QRect b = QFontMetrics(f).boundingRect('x');
 		vpos += -b.height()/2 - lineHeight( firstLine )/2 + baselinePosition( firstLine );
+#endif
 	    } else if ( va == TEXT_BOTTOM ) {
 		vpos += QFontMetrics(f).descent();
 		if ( !isReplaced() )
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 2454d56..c1f1f5f 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -888,7 +888,7 @@ void DocumentImpl::recalcStyle( StyleChange change )
 	    if ( !stdfont.isEmpty() )
 		fontDef.family = stdfont;
 
-            fontDef.size = m_styleSelector->fontSizes()[3];
+            fontDef.size = m_styleSelector->fontSizes()[2]; // default to small [2], not medium [3] (confusingly, this is the same as size=3)
         }
 
         //kdDebug() << "DocumentImpl::attach: setting to charset " << settings->charset() << endl;
diff --git a/WebCore/kwq/KWQFontMetrics.h b/WebCore/kwq/KWQFontMetrics.h
index 2084245..43bfcfb 100644
--- a/WebCore/kwq/KWQFontMetrics.h
+++ b/WebCore/kwq/KWQFontMetrics.h
@@ -46,6 +46,7 @@ public:
     int descent() const;
     int height() const;
     int lineSpacing() const;
+    float xHeight() const;
     
     int width(QChar) const;
     int width(char) const;
@@ -56,7 +57,6 @@ public:
     float floatCharacterWidth(const QChar *, int slen, int pos) const;
 
     QRect boundingRect(const QString &, int len=-1) const;
-    QRect boundingRect(QChar) const;
     QRect boundingRect(int, int, int, int, int, const QString &) const;
 
     QSize size(int, const QString &) const;
diff --git a/WebCore/kwq/KWQFontMetrics.mm b/WebCore/kwq/KWQFontMetrics.mm
index a1973aa..a168e8a 100644
--- a/WebCore/kwq/KWQFontMetrics.mm
+++ b/WebCore/kwq/KWQFontMetrics.mm
@@ -104,6 +104,11 @@ int QFontMetrics::lineSpacing() const
     return [data->getRenderer() lineSpacing];
 }
 
+float QFontMetrics::xHeight() const
+{
+    return [data->getRenderer() xHeight];
+}
+
 int QFontMetrics::width(QChar qc) const
 {
     UniChar c = qc.unicode();
@@ -157,11 +162,6 @@ QRect QFontMetrics::boundingRect(int x, int y, int width, int height, int flags,
     return QRect(x, y, width, height).intersect(boundingRect(str));
 }
 
-QRect QFontMetrics::boundingRect(QChar qc) const
-{
-    return QRect(0, 0, width(qc), height());
-}
-
 QSize QFontMetrics::size(int, const QString &qstring) const
 {
     return QSize(width(qstring), height());
diff --git a/WebCore/kwq/KWQKHTMLSettings.h b/WebCore/kwq/KWQKHTMLSettings.h
index b3e712b..0ad0fef 100644
--- a/WebCore/kwq/KWQKHTMLSettings.h
+++ b/WebCore/kwq/KWQKHTMLSettings.h
@@ -58,7 +58,7 @@ public:
     const QString &encoding() const;
 
     int minFontSize() const;
-    int mediumFontSize() const;
+    int defaultFontSize() const;
 
     bool changeCursor() const;
 
diff --git a/WebCore/kwq/KWQKHTMLSettings.mm b/WebCore/kwq/KWQKHTMLSettings.mm
index 9f0c2b3..12082c0 100644
--- a/WebCore/kwq/KWQKHTMLSettings.mm
+++ b/WebCore/kwq/KWQKHTMLSettings.mm
@@ -75,9 +75,9 @@ int KHTMLSettings::minFontSize() const
     return [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitMinimumFontSize"];
 }
 
-int KHTMLSettings::mediumFontSize() const
+int KHTMLSettings::defaultFontSize() const
 {
-    return [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitMediumFontSize"];
+    return [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitDefaultFontSize"];
 }
 
 bool KHTMLSettings::changeCursor() const
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 003cbbf..02f32f6 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -169,9 +169,8 @@ using namespace khtml;
 {
     DOM::DocumentImpl *doc = part->xmlDocImpl();
     if (doc && doc->renderer()) {
-        return;
+        doc->updateStyleSelector();
     }
-    doc->updateStyleSelector();
 }
 
 - (void)forceLayout
diff --git a/WebCore/kwq/WebCoreSettings.h b/WebCore/kwq/WebCoreSettings.h
index c015e0a..ac116a1 100644
--- a/WebCore/kwq/WebCoreSettings.h
+++ b/WebCore/kwq/WebCoreSettings.h
@@ -34,7 +34,7 @@
     NSString *cursiveFontFamily;
     NSString *fantasyFontFamily;
     float minimumFontSize;
-    float mediumFontSize;
+    float defaultFontSize;
     BOOL JavaEnabled;
     BOOL pluginsEnabled;
     BOOL JavaScriptEnabled;
@@ -64,8 +64,8 @@
 - (void)setMinimumFontSize:(float)size;
 - (float)minimumFontSize;
 
-- (void)setMediumFontSize:(float)size;
-- (float)mediumFontSize;
+- (void)setDefaultFontSize:(float)size;
+- (float)defaultFontSize;
 
 - (void)setJavaEnabled:(BOOL)enabled;
 - (BOOL)JavaEnabled;
diff --git a/WebCore/kwq/WebCoreSettings.m b/WebCore/kwq/WebCoreSettings.m
index 6211023..49692a4 100644
--- a/WebCore/kwq/WebCoreSettings.m
+++ b/WebCore/kwq/WebCoreSettings.m
@@ -130,14 +130,14 @@
     return minimumFontSize;
 }
 
-- (void)setMediumFontSize:(float)size
+- (void)setDefaultFontSize:(float)size
 {
-    mediumFontSize = size;
+    defaultFontSize = size;
 }
 
-- (float)mediumFontSize
+- (float)defaultFontSize
 {
-    return mediumFontSize;
+    return defaultFontSize;
 }
 
 - (void)setJavaEnabled:(BOOL)enabled
diff --git a/WebCore/kwq/WebCoreTextRenderer.h b/WebCore/kwq/WebCoreTextRenderer.h
index 9424704..75f46a7 100644
--- a/WebCore/kwq/WebCoreTextRenderer.h
+++ b/WebCore/kwq/WebCoreTextRenderer.h
@@ -31,6 +31,7 @@
 - (int)ascent;
 - (int)descent;
 - (int)lineSpacing;
+- (float)xHeight;
 
 // horizontal metrics
 - (int)widthForString:(NSString *)string;
diff --git a/WebCore/kwq/khtml/khtml_settings.h b/WebCore/kwq/khtml/khtml_settings.h
index b3e712b..0ad0fef 100644
--- a/WebCore/kwq/khtml/khtml_settings.h
+++ b/WebCore/kwq/khtml/khtml_settings.h
@@ -58,7 +58,7 @@ public:
     const QString &encoding() const;
 
     int minFontSize() const;
-    int mediumFontSize() const;
+    int defaultFontSize() const;
 
     bool changeCursor() const;
 
diff --git a/WebCore/kwq/qt/qfontmetrics.h b/WebCore/kwq/qt/qfontmetrics.h
index 2084245..43bfcfb 100644
--- a/WebCore/kwq/qt/qfontmetrics.h
+++ b/WebCore/kwq/qt/qfontmetrics.h
@@ -46,6 +46,7 @@ public:
     int descent() const;
     int height() const;
     int lineSpacing() const;
+    float xHeight() const;
     
     int width(QChar) const;
     int width(char) const;
@@ -56,7 +57,6 @@ public:
     float floatCharacterWidth(const QChar *, int slen, int pos) const;
 
     QRect boundingRect(const QString &, int len=-1) const;
-    QRect boundingRect(QChar) const;
     QRect boundingRect(int, int, int, int, int, const QString &) const;
 
     QSize size(int, const QString &) const;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9735d56..7f05447 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,16 @@
+2002-07-24  Darin Adler  <darin at apple.com>
+
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (-[WebTextRenderer xHeight]): Added. Calls [NSFont xHeight].
+
+        * WebView.subproj/WebPreferences.h:
+        * WebView.subproj/WebPreferences.m:
+        (+[WebPreferences load]):
+        (-[WebPreferences defaultFontSize]):
+        (-[WebPreferences setDefaultFontSize:]):
+	Renamed minimumFont to defaultFont, and changed it from 11 to 16.
+	Also changed default monospaced font to Courier instead of Monaco.
+
 2002-07-24  Richard Williamson (Local)  <rjw at apple.com>
 
         Support for find in HTML, find in text view coming soon.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 9735d56..7f05447 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,16 @@
+2002-07-24  Darin Adler  <darin at apple.com>
+
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (-[WebTextRenderer xHeight]): Added. Calls [NSFont xHeight].
+
+        * WebView.subproj/WebPreferences.h:
+        * WebView.subproj/WebPreferences.m:
+        (+[WebPreferences load]):
+        (-[WebPreferences defaultFontSize]):
+        (-[WebPreferences setDefaultFontSize:]):
+	Renamed minimumFont to defaultFont, and changed it from 11 to 16.
+	Also changed default monospaced font to Courier instead of Monaco.
+
 2002-07-24  Richard Williamson (Local)  <rjw at apple.com>
 
         Support for find in HTML, find in text view coming soon.
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 6220a3c..2d29e6e 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -379,6 +379,12 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
 }
 
 
+- (float)xHeight
+{
+    return [font xHeight];
+}
+
+
 - (void) slowPackGlyphsForCharacters:(const UniChar *)characters numCharacters: (unsigned int)numCharacters glyphBuffer:(CGGlyph **)glyphBuffer numGlyphs:(unsigned int *)numGlyphs
 {
     ATSGlyphVector glyphVector;
diff --git a/WebKit/WebView.subproj/WebPreferences.h b/WebKit/WebView.subproj/WebPreferences.h
index d961d95..7b84d36 100644
--- a/WebKit/WebView.subproj/WebPreferences.h
+++ b/WebKit/WebView.subproj/WebPreferences.h
@@ -29,8 +29,8 @@
 - (NSString *)fantasyFontFamily;
 - (void)setFantasyFontFamily:(NSString *)family;
 
-- (int)mediumFontSize;
-- (void)setMediumFontSize:(int)size;
+- (int)defaultFontSize;
+- (void)setDefaultFontSize:(int)size;
 
 - (int)minimumFontSize;
 - (void)setMinimumFontSize:(int)size;
diff --git a/WebKit/WebView.subproj/WebPreferences.m b/WebKit/WebView.subproj/WebPreferences.m
index bed3b14..53d6653 100644
--- a/WebKit/WebView.subproj/WebPreferences.m
+++ b/WebKit/WebView.subproj/WebPreferences.m
@@ -15,7 +15,7 @@
 #define	WebKitCursiveFontPreferenceKey		@"WebKitCursiveFont"
 #define	WebKitFantasyFontPreferenceKey		@"WebKitFantasyFont"
 #define	WebKitMinimumFontSizePreferenceKey	@"WebKitMinimumFontSize"
-#define	WebKitMediumFontSizePreferenceKey	@"WebKitMediumFontSize"
+#define	WebKitDefaultFontSizePreferenceKey	@"WebKitDefaultFontSize"
 #define	WebKitJavaEnabledPreferenceKey		@"WebKitJavaEnabled"
 #define	WebKitJavaScriptEnabledPreferenceKey	@"WebKitJavaScriptEnabled"
 #define	WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey	@"WebKitJavaScriptCanOpenWindowsAutomatically"
@@ -58,13 +58,13 @@ static WebPreferences *_standardPreferences = nil;
     NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
         @"0x0", 			WebKitLogLevelPreferenceKey,
         @"Times New Roman", 		WebKitStandardFontPreferenceKey,
-        @"Monaco",	  		WebKitFixedFontPreferenceKey,
+        @"Courier",	  		WebKitFixedFontPreferenceKey,
         @"Times New Roman", 		WebKitSerifFontPreferenceKey,
         @"Arial", 			WebKitSansSerifFontPreferenceKey,
         @"Apple Chancery", 		WebKitCursiveFontPreferenceKey,
         @"Papyrus", 			WebKitFantasyFontPreferenceKey,
         @"6", 				WebKitMinimumFontSizePreferenceKey,
-        @"11", 				WebKitMediumFontSizePreferenceKey,
+        @"16", 				WebKitDefaultFontSizePreferenceKey,
         @"1.85",		 	WebKitInitialTimedLayoutDelayPreferenceKey,
         @"4096", 			WebKitInitialTimedLayoutSizePreferenceKey,
         @"1.85", 			WebKitResourceTimedLayoutDelayPreferenceKey,
@@ -143,14 +143,14 @@ static WebPreferences *_standardPreferences = nil;
     [[NSUserDefaults standardUserDefaults] setObject:family forKey:WebKitFantasyFontPreferenceKey];
 }
 
-- (int)mediumFontSize
+- (int)defaultFontSize
 {
-    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitMediumFontSizePreferenceKey];
+    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitDefaultFontSizePreferenceKey];
 }
 
-- (void)setMediumFontSize:(int)size
+- (void)setDefaultFontSize:(int)size
 {
-    [[NSUserDefaults standardUserDefaults] setInteger:size forKey:WebKitMediumFontSizePreferenceKey];
+    [[NSUserDefaults standardUserDefaults] setInteger:size forKey:WebKitDefaultFontSizePreferenceKey];
 }
 
 - (int)minimumFontSize

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list