⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 107301 in webkit


Ignore:
Timestamp:
Feb 9, 2012, 4:05:10 PM (15 years ago)
Author:
mdelaney@apple.com
Message:

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

Reviewed by Beth Dakin.

Source/WebCore:

Test: fast/css/getComputedStyle/getComputedStyle-zoom-and-background-size.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::fillSizeToCSSValue): Pass down the RenderStyle for use in adjusting
values to account for zoom.
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Adjust additional
properties that are affected by zoom.

LayoutTests:

  • fast/css/getComputedStyle/getComputedStyle-zoom-and-background-size-expected.txt: Added.
  • fast/css/getComputedStyle/getComputedStyle-zoom-and-background-size.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107298 r107301  
     12012-02-09  Matthew Delaney  <mdelaney@apple.com>
     2
     3        getComputedStyle() returns different values for different zoom levels
     4        https://bugs.webkit.org/show_bug.cgi?id=32230
     5
     6        Reviewed by Beth Dakin.
     7
     8        * fast/css/getComputedStyle/getComputedStyle-zoom-and-background-size-expected.txt: Added.
     9        * fast/css/getComputedStyle/getComputedStyle-zoom-and-background-size.html: Added.
     10
    1112012-02-09  Julien Chaffraix  <jchaffraix@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r107299 r107301  
     12012-02-09  Matthew Delaney  <mdelaney@apple.com>
     2
     3        getComputedStyle() returns different values for different zoom levels
     4        https://bugs.webkit.org/show_bug.cgi?id=32230
     5
     6        Reviewed by Beth Dakin.
     7
     8        Test: fast/css/getComputedStyle/getComputedStyle-zoom-and-background-size.html
     9
     10        * css/CSSComputedStyleDeclaration.cpp:
     11        (WebCore::fillSizeToCSSValue): Pass down the RenderStyle for use in adjusting
     12        values to account for zoom.
     13        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Adjust additional
     14        properties that are affected by zoom.
     15
    1162012-02-09  Kentaro Hara  <haraken@chromium.org>
    217
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r107289 r107301  
    11341134}
    11351135
    1136 static PassRefPtr<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, CSSValuePool* cssValuePool)
     1136static PassRefPtr<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderStyle* style, CSSValuePool* cssValuePool)
    11371137{
    11381138    if (fillSize.type == Contain)
     
    11431143
    11441144    if (fillSize.size.height().isAuto())
    1145         return cssValuePool->createValue(fillSize.size.width());
     1145        return zoomAdjustedPixelValueForLength(fillSize.size.width(), style, cssValuePool);
    11461146
    11471147    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
    1148     list->append(cssValuePool->createValue(fillSize.size.width()));
    1149     list->append(cssValuePool->createValue(fillSize.size.height()));
     1148    list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style, cssValuePool));
     1149    list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style, cssValuePool));
    11501150    return list.release();
    11511151}
     
    13251325            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
    13261326            if (!layers->next())
    1327                 return fillSizeToCSSValue(layers->size(), cssValuePool);
     1327                return fillSizeToCSSValue(layers->size(), style.get(), cssValuePool);
    13281328
    13291329            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
    13301330            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
    1331                 list->append(fillSizeToCSSValue(currLayer->size(), cssValuePool));
     1331                list->append(fillSizeToCSSValue(currLayer->size(), style.get(), cssValuePool));
    13321332
    13331333            return list.release();
     
    13951395            if (!layers->next()) {
    13961396                RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
    1397                 list->append(cssValuePool->createValue(layers->xPosition()));
    1398                 list->append(cssValuePool->createValue(layers->yPosition()));
     1397                list->append(zoomAdjustedPixelValueForLength(layers->xPosition(), style.get(), cssValuePool));
     1398                list->append(zoomAdjustedPixelValueForLength(layers->yPosition(), style.get(), cssValuePool));
    13991399                return list.release();
    14001400            }
     
    14031403            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
    14041404                RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated();
    1405                 positionList->append(cssValuePool->createValue(currLayer->xPosition()));
    1406                 positionList->append(cssValuePool->createValue(currLayer->yPosition()));
     1405                positionList->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(), style.get(), cssValuePool));
     1406                positionList->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(), style.get(), cssValuePool));
    14071407                list->append(positionList);
    14081408            }
     
    17421742            if (maxHeight.isUndefined())
    17431743                return cssValuePool->createIdentifierValue(CSSValueNone);
    1744             return cssValuePool->createValue(maxHeight);
     1744            return zoomAdjustedPixelValueForLength(maxHeight, style.get(), cssValuePool);
    17451745        }
    17461746        case CSSPropertyMaxWidth: {
     
    17481748            if (maxWidth.isUndefined())
    17491749                return cssValuePool->createIdentifierValue(CSSValueNone);
    1750             return cssValuePool->createValue(maxWidth);
     1750            return zoomAdjustedPixelValueForLength(maxWidth, style.get(), cssValuePool);
    17511751        }
    17521752        case CSSPropertyMinHeight:
    1753             return cssValuePool->createValue(style->minHeight());
     1753            return zoomAdjustedPixelValueForLength(style->minHeight(), style.get(), cssValuePool);
    17541754        case CSSPropertyMinWidth:
    1755             return cssValuePool->createValue(style->minWidth());
     1755            return zoomAdjustedPixelValueForLength(style->minWidth(), style.get(), cssValuePool);
    17561756        case CSSPropertyOpacity:
    17571757            return cssValuePool->createValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER);
     
    17771777            if (renderer && renderer->isBox())
    17781778                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingTop(false), style.get(), cssValuePool);
    1779             return cssValuePool->createValue(style->paddingTop());
     1779            return zoomAdjustedPixelValueForLength(style->paddingTop(), style.get(), cssValuePool);
    17801780        case CSSPropertyPaddingRight:
    17811781            if (renderer && renderer->isBox())
    17821782                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingRight(false), style.get(), cssValuePool);
    1783             return cssValuePool->createValue(style->paddingRight());
     1783            return zoomAdjustedPixelValueForLength(style->paddingRight(), style.get(), cssValuePool);
    17841784        case CSSPropertyPaddingBottom:
    17851785            if (renderer && renderer->isBox())
    17861786                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingBottom(false), style.get(), cssValuePool);
    1787             return cssValuePool->createValue(style->paddingBottom());
     1787            return zoomAdjustedPixelValueForLength(style->paddingBottom(), style.get(), cssValuePool);
    17881788        case CSSPropertyPaddingLeft:
    17891789            if (renderer && renderer->isBox())
    17901790                return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingLeft(false), style.get(), cssValuePool);
    1791             return cssValuePool->createValue(style->paddingLeft());
     1791            return zoomAdjustedPixelValueForLength(style->paddingLeft(), style.get(), cssValuePool);
    17921792        case CSSPropertyPageBreakAfter:
    17931793            return cssValuePool->createValue(style->pageBreakAfter());
     
    18401840            }
    18411841        case CSSPropertyTextIndent:
    1842             return cssValuePool->createValue(style->textIndent());
     1842            return zoomAdjustedPixelValueForLength(style->textIndent(), style.get(), cssValuePool);
    18431843        case CSSPropertyTextShadow:
    18441844            return valueForShadow(style->textShadow(), propertyID, style.get());
Note: See TracChangeset for help on using the changeset viewer.