[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/khtml/css
From:       Maks Orlovich <maksim () kde ! org>
Date:       2010-04-05 17:02:49
Message-ID: 20100405170249.BD825AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1111438 by orlovich:

Implement application of system font keywords. Also make parsing of them not \
fall-through to list-style (ooops). Brain bootup confirmed :)

BUG: 197544


 M  +1 -0      cssparser.cpp  
 M  +45 -0     cssstyleselector.cpp  


--- trunk/KDE/kdelibs/khtml/css/cssparser.cpp #1111437:1111438
@@ -1156,6 +1156,7 @@
             valid_primitive = true;
         else
             return parseFont(important);
+        break;
 
     case CSS_PROP_LIST_STYLE:
     {
--- trunk/KDE/kdelibs/khtml/css/cssstyleselector.cpp #1111437:1111438
@@ -3931,6 +3931,51 @@
 
 	    applyRule( CSS_PROP_LINE_HEIGHT, font->lineHeight );
 	    applyRule( CSS_PROP_FONT_FAMILY, font->family );
+	} else if (primitiveValue) {
+            // Handle system fonts. We extract out properties from a QFont
+            // into the RenderStyle. 
+            QFont f;
+            switch (primitiveValue->getIdent()) {
+            case CSS_VAL_ICON:
+                f = KGlobalSettings::toolBarFont();
+                break;
+
+            case CSS_VAL_MENU:
+                f = KGlobalSettings::menuFont();
+                break;
+
+            case CSS_VAL_SMALL_CAPTION:
+                f = KGlobalSettings::smallestReadableFont();
+                break;
+
+            case CSS_VAL_CAPTION:
+            case CSS_VAL_MESSAGE_BOX:
+            case CSS_VAL_STATUS_BAR:
+                f = KGlobalSettings::generalFont();
+                break;
+            default:
+                return;
+            }
+
+            FontDef fontDef = style->htmlFont().fontDef;
+            fontDef.family    = f.family();
+            fontDef.italic    = f.italic();
+            fontDef.smallCaps = (f.capitalization() == QFont::SmallCaps);
+            fontDef.weight    = f.weight();
+            fontDirty |= style->setFontDef( fontDef );
+
+            // Use applyRule to apply height, so it can convert
+            // point sizes, and cap pixel sizes appropriately.
+            if (f.pixelSize() != -1) {
+                CSSPrimitiveValueImpl size( f.pixelSize(), CSSPrimitiveValue::CSS_PX \
); +                applyRule( CSS_PROP_FONT_SIZE, &size );
+            } else {
+                CSSPrimitiveValueImpl size( f.pointSize(), CSSPrimitiveValue::CSS_PT \
); +                applyRule( CSS_PROP_FONT_SIZE, &size );
+            }
+
+            // line-height just gets default.
+            style->setLineHeight(RenderStyle::initialLineHeight());            
 	}
 	return;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic