Changeset 101275 in webkit


Ignore:
Timestamp:
Nov 28, 2011 12:55:26 PM (12 years ago)
Author:
fsamuel@chromium.org
Message:

Fix Aspect Ratio Property Inheritance And Make the Computed Value Equal the Specified Value
https://bugs.webkit.org/show_bug.cgi?id=73038

Source/WebCore:

Reviewed by Ojan Vafai.

hasAspectRatio was not being set if the -webkit-aspect-ratio property was inherited from the parent.

Additionally, the computed value of -webkit-aspect-ratio was returning a number instead of a ratio.

Test: fast/css/aspect-ratio-inheritance.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSStyleApplyProperty.cpp:

(WebCore::ApplyPropertyAspectRatio::applyInheritValue):

LayoutTests:

Reviewed by Ojan Vafai.

Updated the parsing test to make sure that the -webkit-aspect-ratio property accepts inherit as a possible value.

Added an inheritance test that checks the computed value is correctly inherited.

  • fast/css/aspect-ratio-inheritance-expected.txt: Added.
  • fast/css/aspect-ratio-inheritance.html: Added.
  • fast/css/aspect-ratio-parsing-tests-expected.txt:
  • fast/css/aspect-ratio-parsing-tests.html:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r101272 r101275  
     12011-11-28  Fady Samuel  <fsamuel@chromium.org>
     2
     3        Fix Aspect Ratio Property Inheritance And Make the Computed Value Equal the Specified Value
     4        https://bugs.webkit.org/show_bug.cgi?id=73038
     5
     6        Reviewed by Ojan Vafai.
     7       
     8        Updated the parsing test to make sure that the -webkit-aspect-ratio property accepts inherit as a possible value.
     9
     10        Added an inheritance test that checks the computed value is correctly inherited.
     11
     12        * fast/css/aspect-ratio-inheritance-expected.txt: Added.
     13        * fast/css/aspect-ratio-inheritance.html: Added.
     14        * fast/css/aspect-ratio-parsing-tests-expected.txt:
     15        * fast/css/aspect-ratio-parsing-tests.html:
     16
    1172011-11-28  Ken Buchanan  <kenrb@chromium.org>
    218
  • trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt

    r99332 r101275  
    1010PASS testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio") is "1.2/2"
    1111PASS testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio") is "2/0.5"
     12PASS testParsing("aspectRatioTest", "inherit", "-webkit-aspect-ratio") is "inherit"
    1213PASS testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio") is "none"
    1314PASS testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio") is "none"
  • trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html

    r99332 r101275  
    2424      shouldBeEqualToString('testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio")', '1.2/2');
    2525      shouldBeEqualToString('testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio")', '2/0.5');
     26      shouldBeEqualToString('testParsing("aspectRatioTest", "inherit", "-webkit-aspect-ratio")', 'inherit');
    2627      shouldBeEqualToString('testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio")', 'none');
    2728
  • trunk/Source/WebCore/ChangeLog

    r101272 r101275  
     12011-11-28  Fady Samuel  <fsamuel@chromium.org>
     2
     3        Fix Aspect Ratio Property Inheritance And Make the Computed Value Equal the Specified Value
     4        https://bugs.webkit.org/show_bug.cgi?id=73038
     5
     6        Reviewed by Ojan Vafai.
     7
     8        hasAspectRatio was not being set if the -webkit-aspect-ratio property was inherited from the parent.
     9
     10        Additionally, the computed value of -webkit-aspect-ratio was returning a number instead of a ratio.
     11
     12        Test: fast/css/aspect-ratio-inheritance.html
     13
     14        * css/CSSComputedStyleDeclaration.cpp:
     15        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     16        * css/CSSStyleApplyProperty.cpp:
     17        (WebCore::ApplyPropertyAspectRatio::applyInheritValue):
     18
    1192011-11-28  Ken Buchanan  <kenrb@chromium.org>
    220
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r101078 r101275  
    2626
    2727#include "AnimationController.h"
    28 #include "ContentData.h"
    29 #include "CounterContent.h"
    30 #include "CursorList.h"
     28#include "CSSAspectRatioValue.h"
    3129#include "CSSBorderImageValue.h"
    3230#include "CSSLineBoxContainValue.h"
     
    4139#include "CSSTimingFunctionValue.h"
    4240#include "CSSValueList.h"
     41#include "ContentData.h"
     42#include "CounterContent.h"
     43#include "CursorList.h"
    4344#if ENABLE(CSS_SHADERS)
    4445#include "CustomFilterOperation.h"
     
    5354#include "RenderBox.h"
    5455#include "RenderLayer.h"
     56#include "RenderStyle.h"
    5557#include "ShadowValue.h"
    5658#if ENABLE(CSS_FILTERS)
     
    18961898            if (!style->hasAspectRatio())
    18971899                return primitiveValueCache->createIdentifierValue(CSSValueNone);
    1898             return primitiveValueCache->createValue(style->aspectRatio(), CSSPrimitiveValue::CSS_NUMBER);
     1900            return CSSAspectRatioValue::create(style->aspectRatioNumerator(), style->aspectRatioDenominator());
    18991901        case CSSPropertyWebkitBackfaceVisibility:
    19001902            return primitiveValueCache->createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r101238 r101275  
    950950        if (!selector->parentStyle()->hasAspectRatio())
    951951            return;
     952        selector->style()->setHasAspectRatio(true);
    952953        selector->style()->setAspectRatioDenominator(selector->parentStyle()->aspectRatioDenominator());
    953954        selector->style()->setAspectRatioNumerator(selector->parentStyle()->aspectRatioNumerator());
Note: See TracChangeset for help on using the changeset viewer.