Changeset 67568 in webkit


Ignore:
Timestamp:
Sep 15, 2010 2:23:52 PM (14 years ago)
Author:
arv@chromium.org
Message:

2010-09-14 Erik Arvidsson <arv@chromium.org>

Reviewed by Darin Adler.

getComputedStyle() returns different values for different zoom levels
https://bugs.webkit.org/show_bug.cgi?id=32230

Test: fast/css/getComputedStyle/computed-style-with-zoom.html

  • css/CSSComputedStyleDeclaration.cpp: (WebCore::zoomAdjustedPixelValue): (WebCore::zoomAdjustedNumberValue): (WebCore::valueForReflection): (WebCore::getPositionOffsetValue): (WebCore::getBorderRadiusCornerValue): (WebCore::computedTransform): (WebCore::CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword): (WebCore::CSSComputedStyleDeclaration::valueForShadow): (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
  • css/CSSComputedStyleDeclaration.h:
  • css/SVGCSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue):
  • rendering/RenderObject.h: (WebCore::adjustForAbsoluteZoom):
  • rendering/style/RenderStyle.h: (WebCore::adjustForAbsoluteZoom):
Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r67563 r67568  
     12010-09-14  Erik Arvidsson  <arv@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        getComputedStyle() returns different values for different zoom levels
     6        https://bugs.webkit.org/show_bug.cgi?id=32230
     7
     8        * fast/css/getComputedStyle/computed-style-with-zoom-expected.txt: Added.
     9        * fast/css/getComputedStyle/computed-style-with-zoom.html: Added.
     10        * fast/css/getComputedStyle/script-tests/computed-style-with-zoom.js: Added.
     11        (testProperty):
     12        (testPropertyValue):
     13
    1142010-09-15  Chris Fleizach  <cfleizach@apple.com>
    215
  • trunk/WebCore/ChangeLog

    r67567 r67568  
     12010-09-14  Erik Arvidsson  <arv@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        getComputedStyle() returns different values for different zoom levels
     6        https://bugs.webkit.org/show_bug.cgi?id=32230
     7
     8        Test: fast/css/getComputedStyle/computed-style-with-zoom.html
     9
     10        * css/CSSComputedStyleDeclaration.cpp:
     11        (WebCore::zoomAdjustedPixelValue):
     12        (WebCore::zoomAdjustedNumberValue):
     13        (WebCore::valueForReflection):
     14        (WebCore::getPositionOffsetValue):
     15        (WebCore::getBorderRadiusCornerValue):
     16        (WebCore::computedTransform):
     17        (WebCore::CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword):
     18        (WebCore::CSSComputedStyleDeclaration::valueForShadow):
     19        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     20        * css/CSSComputedStyleDeclaration.h:
     21        * css/SVGCSSComputedStyleDeclaration.cpp:
     22        (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue):
     23        * rendering/RenderObject.h:
     24        (WebCore::adjustForAbsoluteZoom):
     25        * rendering/style/RenderStyle.h:
     26        (WebCore::adjustForAbsoluteZoom):
     27
    1282010-09-14  Martin Robinson  <mrobinson@igalia.com>
    229
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r67102 r67568  
    328328}
    329329
    330 static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection)
     330inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(int value, const RenderStyle* style)
     331{
     332    return CSSPrimitiveValue::create(adjustForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
     333}
     334
     335inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle* style)
     336{
     337    return CSSPrimitiveValue::create(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
     338}
     339
     340static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle* style)
    331341{
    332342    if (!reflection)
     
    337347        offset = CSSPrimitiveValue::create(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
    338348    else
    339         offset = CSSPrimitiveValue::create(reflection->offset().value(), CSSPrimitiveValue::CSS_PX);
     349        offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
    340350   
    341351    return CSSReflectValue::create(reflection->direction(), offset.release(), valueForNinePieceImage(reflection->mask()));
     
    365375    }
    366376
    367     if (style->position() == AbsolutePosition || style->position() == FixedPosition)
     377    if (style->position() == AbsolutePosition || style->position() == FixedPosition) {
     378        if (l.type() == WebCore::Fixed)
     379            return zoomAdjustedPixelValue(l.value(), style);
    368380        return CSSPrimitiveValue::create(l);
     381    }
    369382
    370383    if (style->position() == RelativePosition)
     
    385398}
    386399
    387 static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius)
     400static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style)
    388401{
    389402    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     
    391404        if (radius.width().type() == Percent)
    392405            return CSSPrimitiveValue::create(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
    393         return CSSPrimitiveValue::create(radius.width().value(), CSSPrimitiveValue::CSS_PX);
     406        return zoomAdjustedPixelValue(radius.width().value(), style);
    394407    }
    395408    if (radius.width().type() == Percent)
    396409        list->append(CSSPrimitiveValue::create(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
    397410    else
    398         list->append(CSSPrimitiveValue::create(radius.width().value(), CSSPrimitiveValue::CSS_PX));
     411        list->append(zoomAdjustedPixelValue(radius.width().value(), style));
    399412    if (radius.height().type() == Percent)
    400413        list->append(CSSPrimitiveValue::create(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
    401414    else
    402         list->append(CSSPrimitiveValue::create(radius.height().value(), CSSPrimitiveValue::CSS_PX));
     415        list->append(zoomAdjustedPixelValue(radius.height().value(), style));
    403416    return list.release();
    404417}
     
    439452        transformVal->append(CSSPrimitiveValue::create(transform.c(), CSSPrimitiveValue::CSS_NUMBER));
    440453        transformVal->append(CSSPrimitiveValue::create(transform.d(), CSSPrimitiveValue::CSS_NUMBER));
    441         transformVal->append(CSSPrimitiveValue::create(transform.e(), CSSPrimitiveValue::CSS_NUMBER));
    442         transformVal->append(CSSPrimitiveValue::create(transform.f(), CSSPrimitiveValue::CSS_NUMBER));
     454        transformVal->append(zoomAdjustedNumberValue(transform.e(), style));
     455        transformVal->append(zoomAdjustedNumberValue(transform.f(), style));
    443456    } else {
    444457        transformVal = WebKitCSSTransformValue::create(WebKitCSSTransformValue::Matrix3DTransformOperation);
     
    459472        transformVal->append(CSSPrimitiveValue::create(transform.m34(), CSSPrimitiveValue::CSS_NUMBER));
    460473
    461         transformVal->append(CSSPrimitiveValue::create(transform.m41(), CSSPrimitiveValue::CSS_NUMBER));
    462         transformVal->append(CSSPrimitiveValue::create(transform.m42(), CSSPrimitiveValue::CSS_NUMBER));
    463         transformVal->append(CSSPrimitiveValue::create(transform.m43(), CSSPrimitiveValue::CSS_NUMBER));
     474        transformVal->append(zoomAdjustedNumberValue(transform.m41(), style));
     475        transformVal->append(zoomAdjustedNumberValue(transform.m42(), style));
     476        transformVal->append(zoomAdjustedNumberValue(transform.m43(), style));
    464477        transformVal->append(CSSPrimitiveValue::create(transform.m44(), CSSPrimitiveValue::CSS_NUMBER));
    465478    }
     
    584597        return CSSPrimitiveValue::createIdentifier(cssIdentifierForFontSizeKeyword(keywordSize));
    585598
    586     return CSSPrimitiveValue::create(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX);
     599
     600    return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get());
    587601}
    588602
     
    599613}
    600614
    601 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id) const
     615PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id, RenderStyle* style) const
    602616{
    603617    if (!shadow)
     
    608622    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
    609623    for (const ShadowData* s = shadow; s; s = s->next()) {
    610         RefPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(s->x(), CSSPrimitiveValue::CSS_PX);
    611         RefPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(s->y(), CSSPrimitiveValue::CSS_PX);
    612         RefPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(s->blur(), CSSPrimitiveValue::CSS_PX);
    613         RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : CSSPrimitiveValue::create(s->spread(), CSSPrimitiveValue::CSS_PX);
     624        RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(s->x(), style);
     625        RefPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(s->y(), style);
     626        RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(s->blur(), style);
     627        RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? 0 : zoomAdjustedPixelValue(s->spread(), style);
    614628        RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? 0 : CSSPrimitiveValue::createIdentifier(CSSValueInset);
    615629        RefPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor(s->color().rgb());
     
    775789        case CSSPropertyBorderSpacing: {
    776790            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
    777             list->append(CSSPrimitiveValue::create(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX));
    778             list->append(CSSPrimitiveValue::create(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX));
     791            list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get()));
     792            list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get()));
    779793            return list.release();
    780794        } 
    781795        case CSSPropertyWebkitBorderHorizontalSpacing:
    782             return CSSPrimitiveValue::create(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX);
     796            return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), style.get());
    783797        case CSSPropertyWebkitBorderVerticalSpacing:
    784             return CSSPrimitiveValue::create(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX);
     798            return zoomAdjustedPixelValue(style->verticalBorderSpacing(), style.get());
    785799        case CSSPropertyBorderTopColor:
    786800            return m_allowVisitedStyle ? CSSPrimitiveValue::createColor(style->visitedDependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style.get(), style->borderTopColor());
     
    800814            return CSSPrimitiveValue::create(style->borderLeftStyle());
    801815        case CSSPropertyBorderTopWidth:
    802             return CSSPrimitiveValue::create(style->borderTopWidth(), CSSPrimitiveValue::CSS_PX);
     816            return zoomAdjustedPixelValue(style->borderTopWidth(), style.get());
    803817        case CSSPropertyBorderRightWidth:
    804             return CSSPrimitiveValue::create(style->borderRightWidth(), CSSPrimitiveValue::CSS_PX);
     818            return zoomAdjustedPixelValue(style->borderRightWidth(), style.get());
    805819        case CSSPropertyBorderBottomWidth:
    806             return CSSPrimitiveValue::create(style->borderBottomWidth(), CSSPrimitiveValue::CSS_PX);
     820            return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get());
    807821        case CSSPropertyBorderLeftWidth:
    808             return CSSPrimitiveValue::create(style->borderLeftWidth(), CSSPrimitiveValue::CSS_PX);
     822            return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get());
    809823        case CSSPropertyBottom:
    810824            return getPositionOffsetValue(style.get(), CSSPropertyBottom);
     
    832846        }
    833847        case CSSPropertyWebkitBoxReflect:
    834             return valueForReflection(style->boxReflect());
     848            return valueForReflection(style->boxReflect(), style.get());
    835849        case CSSPropertyWebkitBoxShadow:
    836             return valueForShadow(style->boxShadow(), propertyID);
     850            return valueForShadow(style->boxShadow(), propertyID, style.get());
    837851        case CSSPropertyCaptionSide:
    838852            return CSSPrimitiveValue::create(style->captionSide());
     
    854868            return CSSPrimitiveValue::create(style->columnRuleStyle());
    855869        case CSSPropertyWebkitColumnRuleWidth:
    856             return CSSPrimitiveValue::create(style->columnRuleWidth(), CSSPrimitiveValue::CSS_PX);
     870            return zoomAdjustedPixelValue(style->columnRuleWidth(), style.get());
    857871        case CSSPropertyWebkitColumnSpan:
    858872            if (style->columnSpan())
     
    902916        }
    903917        case CSSPropertyFontSize:
    904             return CSSPrimitiveValue::create(style->fontDescription().computedPixelSize(), CSSPrimitiveValue::CSS_PX);
     918            return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(), style.get());
    905919        case CSSPropertyFontStyle:
    906920            if (style->fontDescription().italic())
     
    936950        case CSSPropertyHeight:
    937951            if (renderer)
    938                 return CSSPrimitiveValue::create(sizingBox(renderer).height(), CSSPrimitiveValue::CSS_PX);
     952                return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get());
    939953            return CSSPrimitiveValue::create(style->height());
    940954        case CSSPropertyWebkitHighlight:
     
    961975            if (!style->letterSpacing())
    962976                return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
    963             return CSSPrimitiveValue::create(style->letterSpacing(), CSSPrimitiveValue::CSS_PX);
     977            return zoomAdjustedPixelValue(style->letterSpacing(), style.get());
    964978        case CSSPropertyWebkitLineClamp:
    965979            if (style->lineClamp().isNone())
     
    975989                // On the other hand, since font-size doesn't include the zoom factor, we really can't do
    976990                // that here either.
    977                 return CSSPrimitiveValue::create(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, CSSPrimitiveValue::CSS_PX);
    978             return CSSPrimitiveValue::create(length.value(), CSSPrimitiveValue::CSS_PX);
     991                return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style.get());
     992            return zoomAdjustedPixelValue(length.value(), style.get());
    979993        }
    980994        case CSSPropertyListStyleImage:
     
    9891003            if (renderer && renderer->isBox())
    9901004                // FIXME: Supposed to return the percentage if percentage was specified.
    991                 return CSSPrimitiveValue::create(toRenderBox(renderer)->marginTop(), CSSPrimitiveValue::CSS_PX);
     1005                return zoomAdjustedPixelValue(toRenderBox(renderer)->marginTop(), style.get());
    9921006            return CSSPrimitiveValue::create(style->marginTop());
    9931007        case CSSPropertyMarginRight:
    9941008            if (renderer && renderer->isBox())
    9951009                // FIXME: Supposed to return the percentage if percentage was specified.
    996                 return CSSPrimitiveValue::create(toRenderBox(renderer)->marginRight(), CSSPrimitiveValue::CSS_PX);
     1010                return zoomAdjustedPixelValue(toRenderBox(renderer)->marginRight(), style.get());
    9971011            return CSSPrimitiveValue::create(style->marginRight());
    9981012        case CSSPropertyMarginBottom:
    9991013            if (renderer && renderer->isBox())
    10001014                // FIXME: Supposed to return the percentage if percentage was specified.
    1001                 return CSSPrimitiveValue::create(toRenderBox(renderer)->marginBottom(), CSSPrimitiveValue::CSS_PX);
     1015                return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(), style.get());
    10021016            return CSSPrimitiveValue::create(style->marginBottom());
    10031017        case CSSPropertyMarginLeft:
    10041018            if (renderer && renderer->isBox())
    10051019                // FIXME: Supposed to return the percentage if percentage was specified.
    1006                 return CSSPrimitiveValue::create(toRenderBox(renderer)->marginLeft(), CSSPrimitiveValue::CSS_PX);
     1020                return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), style.get());
    10071021            return CSSPrimitiveValue::create(style->marginLeft());
    10081022        case CSSPropertyWebkitMarqueeDirection:
     
    10831097            return CSSPrimitiveValue::create(style->outlineStyle());
    10841098        case CSSPropertyOutlineWidth:
    1085             return CSSPrimitiveValue::create(style->outlineWidth(), CSSPrimitiveValue::CSS_PX);
     1099            return zoomAdjustedPixelValue(style->outlineWidth(), style.get());
    10861100        case CSSPropertyOverflow:
    10871101            return CSSPrimitiveValue::create(max(style->overflowX(), style->overflowY()));
     
    10921106        case CSSPropertyPaddingTop:
    10931107            if (renderer && renderer->isBox())
    1094                 return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingTop(false), CSSPrimitiveValue::CSS_PX);
     1108                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingTop(false), style.get());
    10951109            return CSSPrimitiveValue::create(style->paddingTop());
    10961110        case CSSPropertyPaddingRight:
    10971111            if (renderer && renderer->isBox())
    1098                 return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingRight(false), CSSPrimitiveValue::CSS_PX);
     1112                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingRight(false), style.get());
    10991113            return CSSPrimitiveValue::create(style->paddingRight());
    11001114        case CSSPropertyPaddingBottom:
    11011115            if (renderer && renderer->isBox())
    1102                 return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingBottom(false), CSSPrimitiveValue::CSS_PX);
     1116                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingBottom(false), style.get());
    11031117            return CSSPrimitiveValue::create(style->paddingBottom());
    11041118        case CSSPropertyPaddingLeft:
    11051119            if (renderer && renderer->isBox())
    1106                 return CSSPrimitiveValue::create(toRenderBox(renderer)->paddingLeft(false), CSSPrimitiveValue::CSS_PX);
     1120                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingLeft(false), style.get());
    11071121            return CSSPrimitiveValue::create(style->paddingLeft());
    11081122        case CSSPropertyPageBreakAfter:
     
    11341148            return CSSPrimitiveValue::create(style->textIndent());
    11351149        case CSSPropertyTextShadow:
    1136             return valueForShadow(style->textShadow(), propertyID);
     1150            return valueForShadow(style->textShadow(), propertyID, style.get());
    11371151        case CSSPropertyTextRendering:
    11381152            return CSSPrimitiveValue::create(style->fontDescription().textRenderingMode());
     
    11501164            return currentColorOrValidColor(style.get(), style->textStrokeColor());
    11511165        case CSSPropertyWebkitTextStrokeWidth:
    1152             return CSSPrimitiveValue::create(style->textStrokeWidth(), CSSPrimitiveValue::CSS_PX);
     1166            return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get());
    11531167        case CSSPropertyTextTransform:
    11541168            return CSSPrimitiveValue::create(style->textTransform());
     
    11901204        case CSSPropertyWidth:
    11911205            if (renderer)
    1192                 return CSSPrimitiveValue::create(sizingBox(renderer).width(), CSSPrimitiveValue::CSS_PX);
     1206                return zoomAdjustedPixelValue(sizingBox(renderer).width(), style.get());
    11931207            return CSSPrimitiveValue::create(style->width());
    11941208        case CSSPropertyWordBreak:
    11951209            return CSSPrimitiveValue::create(style->wordBreak());
    11961210        case CSSPropertyWordSpacing:
    1197             return CSSPrimitiveValue::create(style->wordSpacing(), CSSPrimitiveValue::CSS_PX);
     1211            return zoomAdjustedPixelValue(style->wordSpacing(), style.get());
    11981212        case CSSPropertyWordWrap:
    11991213            return CSSPrimitiveValue::create(style->wordWrap());
     
    12341248                region->m_label = styleRegion.label;
    12351249                LengthBox offset = styleRegion.offset;
    1236                 region->setTop(CSSPrimitiveValue::create(offset.top().value(), CSSPrimitiveValue::CSS_PX));
    1237                 region->setRight(CSSPrimitiveValue::create(offset.right().value(), CSSPrimitiveValue::CSS_PX));
    1238                 region->setBottom(CSSPrimitiveValue::create(offset.bottom().value(), CSSPrimitiveValue::CSS_PX));
    1239                 region->setLeft(CSSPrimitiveValue::create(offset.left().value(), CSSPrimitiveValue::CSS_PX));
     1250                region->setTop(zoomAdjustedPixelValue(offset.top().value(), style.get()));
     1251                region->setRight(zoomAdjustedPixelValue(offset.right().value(), style.get()));
     1252                region->setBottom(zoomAdjustedPixelValue(offset.bottom().value(), style.get()));
     1253                region->setLeft(zoomAdjustedPixelValue(offset.left().value(), style.get()));
    12401254                region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle);
    12411255                region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle);
     
    13581372            if (renderer) {
    13591373                IntRect box = sizingBox(renderer);
    1360                 list->append(CSSPrimitiveValue::create(style->perspectiveOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX));
    1361                 list->append(CSSPrimitiveValue::create(style->perspectiveOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX));
     1374                list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get()));
     1375                list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get()));
    13621376            }
    13631377            else {
     
    13761390            return CSSPrimitiveValue::create(style->userSelect());
    13771391        case CSSPropertyBorderBottomLeftRadius:
    1378             return getBorderRadiusCornerValue(style->borderBottomLeftRadius());
     1392            return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), style.get());
    13791393        case CSSPropertyBorderBottomRightRadius:
    1380             return getBorderRadiusCornerValue(style->borderBottomRightRadius());
     1394            return getBorderRadiusCornerValue(style->borderBottomRightRadius(), style.get());
    13811395        case CSSPropertyBorderTopLeftRadius:
    1382             return getBorderRadiusCornerValue(style->borderTopLeftRadius());
     1396            return getBorderRadiusCornerValue(style->borderTopLeftRadius(), style.get());
    13831397        case CSSPropertyBorderTopRightRadius:
    1384             return getBorderRadiusCornerValue(style->borderTopRightRadius());
     1398            return getBorderRadiusCornerValue(style->borderTopRightRadius(), style.get());
    13851399        case CSSPropertyClip: {
    13861400            if (!style->hasClip())
    13871401                return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
    13881402            RefPtr<Rect> rect = Rect::create();
    1389             rect->setTop(CSSPrimitiveValue::create(style->clip().top().value(), CSSPrimitiveValue::CSS_PX));
    1390             rect->setRight(CSSPrimitiveValue::create(style->clip().right().value(), CSSPrimitiveValue::CSS_PX));
    1391             rect->setBottom(CSSPrimitiveValue::create(style->clip().bottom().value(), CSSPrimitiveValue::CSS_PX));
    1392             rect->setLeft(CSSPrimitiveValue::create(style->clip().left().value(), CSSPrimitiveValue::CSS_PX));
     1403            rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), style.get()));
     1404            rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(), style.get()));
     1405            rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(), style.get()));
     1406            rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), style.get()));
    13931407            return CSSPrimitiveValue::create(rect.release());
    13941408        }
     
    13991413            if (renderer) {
    14001414                IntRect box = sizingBox(renderer);
    1401                 list->append(CSSPrimitiveValue::create(style->transformOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX));
    1402                 list->append(CSSPrimitiveValue::create(style->transformOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX));
     1415                list->append(zoomAdjustedPixelValue(style->transformOriginX().calcMinValue(box.width()), style.get()));
     1416                list->append(zoomAdjustedPixelValue(style->transformOriginY().calcMinValue(box.height()), style.get()));
    14031417                if (style->transformOriginZ() != 0)
    1404                     list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX));
     1418                    list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
    14051419            } else {
    14061420                list->append(CSSPrimitiveValue::create(style->transformOriginX()));
    14071421                list->append(CSSPrimitiveValue::create(style->transformOriginY()));
    14081422                if (style->transformOriginZ() != 0)
    1409                     list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX));
     1423                    list->append(zoomAdjustedPixelValue(style->transformOriginZ(), style.get()));
    14101424            }
    14111425            return list.release();
  • trunk/WebCore/css/CSSComputedStyleDeclaration.h

    r67102 r67568  
    7575    virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&);
    7676
    77     PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int) const;
     77    PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int, RenderStyle*) const;
    7878    PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
    7979   
  • trunk/WebCore/css/SVGCSSComputedStyleDeclaration.cpp

    r64830 r67568  
    181181        }
    182182        case CSSPropertyWebkitSvgShadow:
    183             return valueForShadow(svgStyle->shadow(), propertyID);
     183            return valueForShadow(svgStyle->shadow(), propertyID, style);
    184184        case CSSPropertyVectorEffect:
    185185            return CSSPrimitiveValue::create(svgStyle->vectorEffect());
  • trunk/WebCore/rendering/RenderObject.h

    r67200 r67568  
    990990inline int adjustForAbsoluteZoom(int value, RenderObject* renderer)
    991991{
    992     double zoomFactor = renderer->style()->effectiveZoom();
    993     if (zoomFactor == 1)
    994         return value;
    995     // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
    996     if (zoomFactor > 1)
    997         value++;
    998 
    999     return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(value / zoomFactor);
     992    return adjustForAbsoluteZoom(value, renderer->style());
    1000993}
    1001994
  • trunk/WebCore/rendering/style/RenderStyle.h

    r66615 r67568  
    12401240};
    12411241
     1242inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
     1243{
     1244    double zoomFactor = style->effectiveZoom();
     1245    if (zoomFactor == 1)
     1246        return value;
     1247    // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
     1248    if (zoomFactor > 1)
     1249        value++;
     1250
     1251    return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(value / zoomFactor);
     1252}
     1253
    12421254} // namespace WebCore
    12431255
Note: See TracChangeset for help on using the changeset viewer.