Title: [109279] trunk/Source/WebCore
- Revision
- 109279
- Author
- [email protected]
- Date
- 2012-02-29 16:11:45 -0800 (Wed, 29 Feb 2012)
Log Message
Clean up CSSPrimitiveValue::computeLengthDouble().
https://bugs.webkit.org/show_bug.cgi?id=77065
Reviewed by Eric Seidel.
Refactoring only / no behavioral change.
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeLengthDouble):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (109278 => 109279)
--- trunk/Source/WebCore/ChangeLog 2012-02-29 23:59:59 UTC (rev 109278)
+++ trunk/Source/WebCore/ChangeLog 2012-03-01 00:11:45 UTC (rev 109279)
@@ -1,3 +1,15 @@
+2012-02-29 Luke Macpherson <[email protected]>
+
+ Clean up CSSPrimitiveValue::computeLengthDouble().
+ https://bugs.webkit.org/show_bug.cgi?id=77065
+
+ Reviewed by Eric Seidel.
+
+ Refactoring only / no behavioral change.
+
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::CSSPrimitiveValue::computeLengthDouble):
+
2012-02-29 Beth Dakin <[email protected]>
Speculative build-fix.
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (109278 => 109279)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2012-02-29 23:59:59 UTC (rev 109278)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2012-03-01 00:11:45 UTC (rev 109279)
@@ -429,33 +429,26 @@
double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
{
- unsigned short type = primitiveType();
+ double factor;
- // We do not apply the zoom factor when we are computing the value of the font-size property. The zooming
- // for font sizes is much more complicated, since we have to worry about enforcing the minimum font size preference
- // as well as enforcing the implicit "smart minimum." In addition the CSS property text-size-adjust is used to
- // prevent text from zooming at all. Therefore we will not apply the zoom here if we are computing font-size.
- bool applyZoomMultiplier = !computingFontSize;
-
- double factor = 1.0;
- switch (type) {
+ switch (primitiveType()) {
case CSS_EMS:
- applyZoomMultiplier = false;
factor = computingFontSize ? style->fontDescription().specifiedSize() : style->fontDescription().computedSize();
break;
case CSS_EXS:
// FIXME: We have a bug right now where the zoom will be applied twice to EX units.
// We really need to compute EX using fontMetrics for the original specifiedSize and not use
// our actual constructed rendering font.
- applyZoomMultiplier = false;
factor = style->fontMetrics().xHeight();
break;
case CSS_REMS:
- applyZoomMultiplier = false;
if (rootStyle)
factor = computingFontSize ? rootStyle->fontDescription().specifiedSize() : rootStyle->fontDescription().computedSize();
+ else
+ factor = 1.0;
break;
case CSS_PX:
+ factor = 1.0;
break;
case CSS_CM:
factor = cssPixelsPerInch / 2.54; // (2.54 cm/in)
@@ -489,15 +482,19 @@
else
computedValue = getDoubleValue();
+ // We do not apply the zoom factor when we are computing the value of the font-size property. The zooming
+ // for font sizes is much more complicated, since we have to worry about enforcing the minimum font size preference
+ // as well as enforcing the implicit "smart minimum." In addition the CSS property text-size-adjust is used to
+ // prevent text from zooming at all. Therefore we will not apply the zoom here if we are computing font-size.
double result = computedValue * factor;
- if (!applyZoomMultiplier || multiplier == 1.0f)
+ if (computingFontSize || isFontRelativeLength())
return result;
// Any original result that was >= 1 should not be allowed to fall below 1. This keeps border lines from
// vanishing.
double zoomedResult = result * multiplier;
- if (result >= 1.0)
- zoomedResult = max(1.0, zoomedResult);
+ if (zoomedResult < 1.0 && result >= 1.0)
+ return 1.0;
return zoomedResult;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes