Reviewed by John.
[WebKit-https.git] / WebCore / khtml / css / css_computedstyle.cpp
index 9c82c07325810add0e3ad5bd02a7b1c64504167f..4b6ad2c0fcd6b373d46d594519635682189660eb 100644 (file)
@@ -715,8 +715,12 @@ CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyI
        if (length.value < 0)
             return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL);
         if (length.isPercent()) {
-            float computedSize = style->htmlFont().getFontDef().computedSize;
-            return new CSSPrimitiveValueImpl((int)(length.length() * computedSize) / 100, CSSPrimitiveValue::CSS_PX);
+            // This is imperfect, because it doesn't include the zoom factor and the real computation
+            // for how high to be in pixels does include things like minimum font size and the zoom factor.
+            // On the other hand, since font-size doesn't include the zoom factor, we really can't do
+            // that here either.
+            float fontSize = style->htmlFont().getFontDef().specifiedSize;
+            return new CSSPrimitiveValueImpl((int)(length.length() * fontSize) / 100, CSSPrimitiveValue::CSS_PX);
         }
         else {
             return new CSSPrimitiveValueImpl(length.length(), CSSPrimitiveValue::CSS_PX);