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

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:42:51 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 754b201d4ba8ab95dde85b66502f5d591c4f05cd
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu May 22 05:58:37 2003 +0000

    	This patch deals with the main cause of regressions from
    	the minimum font size removal.  Because we stored font sizes
    	as integers, we ended up flooring font sizes, and when percentages
    	were nested, the magnitude of error increased dramatically.
    
    	This patch changes FontDef to store a float size instead of an
    	integer size.  The style system thus always computes a precise
    	floating point value for a font, with no error introduced and
    	only once it has that final computed value does it round to the
    	nearest pixel for the QFont.
    
    	This fixes 3265628, www.anandtech.com.
    
            Reviewed by rjw
    
            * khtml/css/css_valueimpl.cpp:
            (CSSPrimitiveValueImpl::computeLengthFloat):
            * khtml/css/cssstyleselector.cpp:
            * khtml/rendering/font.cpp:
            (Font::update):
            * khtml/rendering/font.h:
            * khtml/xml/dom_docimpl.cpp:
            (DocumentImpl::recalcStyle):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4411 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 1e9ad9e..6da6788 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,31 @@
 2003-05-21  David Hyatt  <hyatt at apple.com>
 
+	This patch deals with the main cause of regressions from
+	the minimum font size removal.  Because we stored font sizes
+	as integers, we ended up flooring font sizes, and when percentages
+	were nested, the magnitude of error increased dramatically.
+
+	This patch changes FontDef to store a float size instead of an
+	integer size.  The style system thus always computes a precise
+	floating point value for a font, with no error introduced and
+	only once it has that final computed value does it round to the
+	nearest pixel for the QFont.
+
+	This fixes 3265628, www.anandtech.com.
+	
+        Reviewed by rjw
+
+        * khtml/css/css_valueimpl.cpp:
+        (CSSPrimitiveValueImpl::computeLengthFloat):
+        * khtml/css/cssstyleselector.cpp:
+        * khtml/rendering/font.cpp:
+        (Font::update):
+        * khtml/rendering/font.h:
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::recalcStyle):
+
+2003-05-21  David Hyatt  <hyatt at apple.com>
+
 	Fix for 3257990, attributes in HTML should always be case-insensitive
 	when matching CSS attribute selectors.  Instead of relying on 
 	the strict mode check, I patched the code to use an isXMLDoc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1e9ad9e..6da6788 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,31 @@
 2003-05-21  David Hyatt  <hyatt at apple.com>
 
+	This patch deals with the main cause of regressions from
+	the minimum font size removal.  Because we stored font sizes
+	as integers, we ended up flooring font sizes, and when percentages
+	were nested, the magnitude of error increased dramatically.
+
+	This patch changes FontDef to store a float size instead of an
+	integer size.  The style system thus always computes a precise
+	floating point value for a font, with no error introduced and
+	only once it has that final computed value does it round to the
+	nearest pixel for the QFont.
+
+	This fixes 3265628, www.anandtech.com.
+	
+        Reviewed by rjw
+
+        * khtml/css/css_valueimpl.cpp:
+        (CSSPrimitiveValueImpl::computeLengthFloat):
+        * khtml/css/cssstyleselector.cpp:
+        * khtml/rendering/font.cpp:
+        (Font::update):
+        * khtml/rendering/font.h:
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::recalcStyle):
+
+2003-05-21  David Hyatt  <hyatt at apple.com>
+
 	Fix for 3257990, attributes in HTML should always be case-insensitive
 	when matching CSS attribute selectors.  Instead of relying on 
 	the strict mode check, I patched the code to use an isXMLDoc
diff --git a/WebCore/khtml/css/css_valueimpl.cpp b/WebCore/khtml/css/css_valueimpl.cpp
index b6c984d..02d8301 100644
--- a/WebCore/khtml/css/css_valueimpl.cpp
+++ b/WebCore/khtml/css/css_valueimpl.cpp
@@ -538,7 +538,7 @@ double CSSPrimitiveValueImpl::computeLengthFloat( khtml::RenderStyle *style, QPa
     switch(type)
     {
     case CSSPrimitiveValue::CSS_EMS:
-        factor = style->font().pixelSize();
+        factor = style->htmlFont().getFontDef().floatSize();
         break;
     case CSSPrimitiveValue::CSS_EXS:
 	{
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index 282bd7d..dc850df 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -2625,12 +2625,12 @@ void CSSStyleSelector::applyRule( int id, DOM::CSSValueImpl *value )
     case CSS_PROP_FONT_SIZE:
     {
         FontDef fontDef = style->htmlFont().fontDef;
-        int oldSize;
+        float oldSize;
         float size = 0;
         int minFontSize = settings->minFontSize();
 
         if(parentNode) {
-            oldSize = parentStyle->font().pixelSize();
+            oldSize = parentStyle->htmlFont().fontDef.floatSize();
         } else
             oldSize = m_fontSizes[3];
 
@@ -2687,7 +2687,7 @@ void CSSStyleSelector::applyRule( int id, DOM::CSSValueImpl *value )
                     size *= element->getDocument()->view()->part()->zoomFactor() / 100.0;
             } else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
                 size = (primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE)
-                        * parentStyle->font().pixelSize()) / 100;
+                        * oldSize) / 100;
             else
                 return;
         }
@@ -2699,7 +2699,7 @@ void CSSStyleSelector::applyRule( int id, DOM::CSSValueImpl *value )
 
         //kdDebug( 6080 ) << "computed raw font size: " << size << endl;
 
-        fontDef.size = int(size);
+        fontDef.setSize(size);
         if (style->setFontDef( fontDef ))
 	    fontDirty = true;
         return;
@@ -3159,7 +3159,7 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* aStyle, RenderSt
     size = minFontSize;
   
   FontDef newFontDef(childFont);
-  newFontDef.size = size;
+  newFontDef.setSize(size);
   aStyle->setFontDef(newFontDef);
 }
 
diff --git a/WebCore/khtml/rendering/font.cpp b/WebCore/khtml/rendering/font.cpp
index 3e600a7..9016f01 100644
--- a/WebCore/khtml/rendering/font.cpp
+++ b/WebCore/khtml/rendering/font.cpp
@@ -186,7 +186,7 @@ void Font::update( QPaintDeviceMetrics* devMetrics ) const
 	f.setFirstFamily(fontDef.family);
     f.setItalic(fontDef.italic);
     f.setWeight(fontDef.weight);
-    f.setPixelSize(fontDef.size);
+    f.setPixelSize(fontDef.pixelSize());
     f.setPrinterFont(fontDef.usePrinterFont);
 
     fm.setFont(f);
diff --git a/WebCore/khtml/rendering/font.h b/WebCore/khtml/rendering/font.h
index 2bb2ea3..d00c613 100644
--- a/WebCore/khtml/rendering/font.h
+++ b/WebCore/khtml/rendering/font.h
@@ -42,7 +42,7 @@ class FontDef
 {
 public:
     FontDef()
-        : size( 0 ), italic( false ), smallCaps( false ), sizeSpecified(false), weight( 50 ), 
+        : size( 0.0f ), italic( false ), smallCaps( false ), sizeSpecified(false), weight( 50 ), 
           genericFamily(0), hasNbsp( true )
 #if APPLE_CHANGES
           , usePrinterFont( false )
@@ -71,7 +71,16 @@ public:
     KWQFontFamily &firstFamily() { return family; }
     
     KWQFontFamily family;
-    short int size;
+
+    int pixelSize() const { return int(size + 0.5f); }
+    float floatSize() const { return size; }
+    void setSize(float s) { size = s; }
+    
+private:
+    float size; // Making this private forces people to think about what value they want,
+                // either the floatSize or the pixelSize.
+
+public:
     bool italic 		: 1;
     bool smallCaps 		: 1;
     bool sizeSpecified		: 1;  // Whether or not CSS specified an explicit size
@@ -110,6 +119,8 @@ public:
                 wordSpacing == other.wordSpacing );
     }
 
+    const FontDef& getFontDef() const { return fontDef; }
+    
     void update( QPaintDeviceMetrics *devMetrics ) const;
 
                    
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 856c98f..691c63a 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -925,7 +925,7 @@ void DocumentImpl::recalcStyle( StyleChange change )
                 fontDef.family.setFamily(stdfont);
                 fontDef.family.appendFamily(0);
             }
-            fontDef.size = m_styleSelector->fontSizes()[3];
+            fontDef.setSize(m_styleSelector->fontSizes()[3]);
         }
 
         //kdDebug() << "DocumentImpl::attach: setting to charset " << settings->charset() << endl;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list