Reviewed by Hyatt.
authorbdakin <bdakin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Apr 2006 08:01:36 +0000 (08:01 +0000)
committerbdakin <bdakin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Apr 2006 08:01:36 +0000 (08:01 +0000)
commit6066e2a11f4b7581ae63048551b0fe899408505d
tree0fdb78ae41feffa4a8f6e8c991996e32c480c572
parent433d516432b4a60ba8ebf2bf8d33895cd7133637
    Reviewed by Hyatt.

        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=6141
        DOMCSSPrimitiveValue is always returning values in pixels when
        using getComputedStyle:

        getFloatValue() took a unit type as a parameter, ignored it, and
        returned m_value.num. This patch writes a second version of the
        function that actually converts m_value.num to the specified unites
        before returning it. Where a conversion is not required, I removed
        the unit type from the caller so that it would go directly to the
        inline version of the function.

        * css/css_valueimpl.cpp:
        (WebCore::CSSPrimitiveValue::computeLengthFloat): Remove type
        parameter since a conversion is not needed.
        (WebCore::scaleFactorForConversion): Helper function for
        conversion.
        (WebCore::CSSPrimitiveValue::getFloatValue): This version of
        getFloatValue() takes a unit type parameter and converts
        m_value.num.
        * css/css_valueimpl.h:
        (WebCore::CSSPrimitiveValue::getFloatValue): This version does not
        take a parameter and just returns m_value.num.
        * css/cssparser.cpp:
        (WebCore::BorderImageParseContext::commitBorderImage): Remove type
        parameter since a conversion is not needed.
        * css/cssstyleselector.cpp:
        (WebCore::convertToLength): Same.
        (WebCore::CSSStyleSelector::applyProperty): Same.
        (WebCore::CSSStyleSelector::mapBackgroundSize): Same.
        (WebCore::CSSStyleSelector::mapBackgroundXPosition): Same.
        (WebCore::CSSStyleSelector::mapBackgroundYPosition): Same.
        * editing/ApplyStyleCommand.cpp:
        (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): Same.
        * ksvg2/css/SVGCSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::applySVGProperty): Same.
        * ksvg2/misc/KCanvasRenderingStyle.cpp:
        (WebCore::KSVGPainterFactory::cssPrimitiveToLength): Same.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/getFloatValueForUnit-expected.checksum [new file with mode: 0644]
LayoutTests/fast/css/getFloatValueForUnit-expected.png [new file with mode: 0644]
LayoutTests/fast/css/getFloatValueForUnit-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/getFloatValueForUnit.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/css_valueimpl.cpp
WebCore/css/css_valueimpl.h
WebCore/css/cssparser.cpp
WebCore/css/cssstyleselector.cpp
WebCore/editing/ApplyStyleCommand.cpp
WebCore/ksvg2/css/SVGCSSStyleSelector.cpp
WebCore/ksvg2/misc/KCanvasRenderingStyle.cpp