Bug with line-height (font shorthand)

Dirk Mueller khtml-devel@kde.org
Sat, 22 Feb 2003 13:30:37 +0100


--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fre, 21 Feb 2003, David Hyatt wrote:

> font: 1em/1em Ahem;

doh. can you confirm that the attached patch works?


-- 
Dirk (received 325 mails today)

--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cssstyleselector.diff"

Index: cssstyleselector.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssstyleselector.cpp,v
retrieving revision 1.272
diff -u -5 -d -p -r1.272 cssstyleselector.cpp
--- cssstyleselector.cpp	21 Feb 2003 15:28:37 -0000	1.272
+++ cssstyleselector.cpp	22 Feb 2003 12:30:10 -0000
@@ -691,11 +691,11 @@ bool CSSStyleSelector::checkOneSelector(
         return false;
 
 //     qDebug("element: %d", e->id());
 //     sel->print();
 
-    int element_id = e->id();
+    DOM::NodeImpl::Id element_id = e->id();
     if ( (sel->tag & NodeImpl_IdNSMask) == NodeImpl_IdNSMask ) {
 	// all namespaces would match
 	unsigned int sel_id = sel->tag & NodeImpl_IdLocalMask;
 	if ( (element_id & NodeImpl_IdLocalMask) != sel_id &&
 	     sel_id != NodeImpl_IdLocalMask )
@@ -2504,10 +2504,15 @@ void CSSStyleSelector::applyRule( int id
 	float toPix = paintDeviceMetrics->logicalDpiY()/72.;
 	if (toPix  < 96./72.) toPix = 96./72.;
 
         int minFontSize = int(settings->minFontSize() * toPix);
 
+        if ( fontDirty ) {
+            style->htmlFont().update( paintDeviceMetrics );
+            fontDirty = false;
+        }
+ 
         if(parentNode) {
             oldSize = parentStyle->font().pixelSize();
         } else
             oldSize = m_fontSizes[3];
 
@@ -2564,11 +2569,11 @@ void CSSStyleSelector::applyRule( int id
 
         //kdDebug( 6080 ) << "computed raw font size: " << size << endl;
 
 	fontDef.size = int(size);
         if (style->setFontDef( fontDef ))
-	fontDirty = true;
+                fontDirty = true;
         return;
     }
 
 // angle
 //    case CSS_PROP_ELEVATION:
@@ -2614,10 +2619,16 @@ void CSSStyleSelector::applyRule( int id
             if(!parentNode) return;
             lineHeight = parentStyle->lineHeight();
         } else {
             if(!primitiveValue) return;
             int type = primitiveValue->primitiveType();
+
+            if ( fontDirty ) {
+                style->htmlFont().update( paintDeviceMetrics );
+                fontDirty = false;
+            }
+
             if(primitiveValue->getIdent() == CSS_VAL_NORMAL)
                 lineHeight = Length( -100, Percent );
             else if(type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
                 lineHeight = Length(primitiveValue->computeLength(style, paintDeviceMetrics), Fixed);
             else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)

--1yeeQ81UyVL57Vl7--