Source/WebCore/ChangeLog

 12011-11-04 Fady Samuel <fsamuel@chromium.org>
 2
 3 CSS Aspect Ratio Property Parsing Stage
 4 https://bugs.webkit.org/show_bug.cgi?id=70707
 5
 6 Reviewed by Ojan Vafai.
 7
 8 Added parsing support for -webkit-aspect-ratio CSS property.
 9 The spec can be found here: http://www.xanthir.com/blog/b4810
 10
 11 Test: fast/css/aspect-ratio-parsing-tests.html
 12
 13 * CMakeLists.txt:
 14 * GNUmakefile.list.am:
 15 * WebCore.gypi:
 16 * WebCore.vcproj/WebCore.vcproj:
 17 * WebCore.xcodeproj/project.pbxproj:
 18 * css/CSSAspectRatioValue.cpp: Added.
 19 (WebCore::CSSAspectRatioValue::~CSSAspectRatioValue):
 20 (WebCore::CSSAspectRatioValue::cssText):
 21 * css/CSSAspectRatioValue.h: Added.
 22 (WebCore::CSSAspectRatioValue::create):
 23 (WebCore::CSSAspectRatioValue::numeratorValue):
 24 (WebCore::CSSAspectRatioValue::denominatorValue):
 25 (WebCore::CSSAspectRatioValue::CSSAspectRatioValue):
 26 * css/CSSComputedStyleDeclaration.cpp:
 27 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
 28 * css/CSSMutableStyleDeclaration.cpp:
 29 * css/CSSParser.cpp:
 30 (WebCore::CSSParser::parseValue):
 31 (WebCore::CSSParser::parseAspectRatio):
 32 * css/CSSParser.h:
 33 * css/CSSProperty.cpp:
 34 (WebCore::CSSProperty::isInheritedProperty):
 35 * css/CSSPropertyNames.in:
 36 * css/CSSStyleSelector.cpp:
 37 (WebCore::CSSStyleSelector::applyProperty):
 38
1392011-11-04 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
240
341 [Qt] Refactor and clean up the qmake build system

Source/WebCore/CMakeLists.txt

@@SET(WebCore_SOURCES
416416 bindings/generic/ActiveDOMCallback.cpp
417417 bindings/generic/RuntimeEnabledFeatures.cpp
418418
 419 css/CSSAspectRatioValue.cpp
419420 css/CSSBorderImageValue.cpp
420421 css/CSSBorderImageSliceValue.cpp
421422 css/CSSCanvasValue.cpp

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
962962 Source/WebCore/bridge/runtime_root.h \
963963 Source/WebCore/config.h \
964964 Source/WebCore/css/Counter.h \
 965 Source/WebCore/css/CSSAspectRatioValue.cpp \
 966 Source/WebCore/css/CSSAspectRatioValue.h \
965967 Source/WebCore/css/CSSBorderImageSliceValue.cpp \
966968 Source/WebCore/css/CSSBorderImageSliceValue.h \
967969 Source/WebCore/css/CSSBorderImageValue.cpp \

Source/WebCore/WebCore.gypi

23352335 'bridge/testbindings.mm',
23362336 'bridge/testqtbindings.cpp',
23372337 'config.h',
 2338 'css/CSSAspectRatioValue.cpp',
 2339 'css/CSSAspectRatioValue.h',
23382340 'css/CSSBorderImageValue.cpp',
23392341 'css/CSSBorderImageValue.h',
23402342 'css/CSSBorderImageSliceValue.cpp',

Source/WebCore/WebCore.vcproj/WebCore.vcproj

3237832378 >
3237932379 </File>
3238032380 <File
 32381 RelativePath="..\css\CSSAspectRatioValue.cpp"
 32382 >
 32383 </File>
 32384 <File
 32385 RelativePath="..\css\CSSAspectRatioValue.h"
 32386 >
 32387 </File>
 32388 <File
3238132389 RelativePath="..\css\CSSBorderImageSliceValue.cpp"
3238232390 >
3238332391 </File>

Source/WebCore/WebCore.xcodeproj/project.pbxproj

54635463 C6F41047130C6E8900393DE4 /* EntryBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F41046130C6E8900393DE4 /* EntryBase.cpp */; };
54645464 CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
54655465 CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 5466 CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */; };
 5467 CAE9F910146441F000C245B0 /* CSSAspectRatioValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */; };
54665468 CD0DBF011422768500280263 /* IRC_Composite_C_R0195_T000_P000.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD0DBD201422759500280263 /* IRC_Composite_C_R0195_T000_P000.wav */; };
54675469 CD0DBF021422768500280263 /* IRC_Composite_C_R0195_T000_P015.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD0DBD211422759500280263 /* IRC_Composite_C_R0195_T000_P015.wav */; };
54685470 CD0DBF031422768500280263 /* IRC_Composite_C_R0195_T000_P030.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD0DBD221422759500280263 /* IRC_Composite_C_R0195_T000_P030.wav */; };

1275612758 C6F41046130C6E8900393DE4 /* EntryBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EntryBase.cpp; path = fileapi/EntryBase.cpp; sourceTree = "<group>"; };
1275712759 CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = "<group>"; };
1275812760 CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
 12761 CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAspectRatioValue.cpp; sourceTree = "<group>"; };
 12762 CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSAspectRatioValue.h; sourceTree = "<group>"; };
1275912763 CD0DBD201422759500280263 /* IRC_Composite_C_R0195_T000_P000.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = IRC_Composite_C_R0195_T000_P000.wav; path = platform/audio/resources/IRC_Composite_C_R0195_T000_P000.wav; sourceTree = SOURCE_ROOT; };
1276012764 CD0DBD211422759500280263 /* IRC_Composite_C_R0195_T000_P015.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = IRC_Composite_C_R0195_T000_P015.wav; path = platform/audio/resources/IRC_Composite_C_R0195_T000_P015.wav; sourceTree = SOURCE_ROOT; };
1276112765 CD0DBD221422759500280263 /* IRC_Composite_C_R0195_T000_P030.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = IRC_Composite_C_R0195_T000_P030.wav; path = platform/audio/resources/IRC_Composite_C_R0195_T000_P030.wav; sourceTree = SOURCE_ROOT; };

2049120495 F523D18402DE42E8018635CA /* css */ = {
2049220496 isa = PBXGroup;
2049320497 children = (
 20498 CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */,
 20499 CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */,
2049420500 93CA4C9C09DF93FA00DF8677 /* maketokenizer */,
2049520501 A80E6CDA0A1989CA007FB8C5 /* Counter.h */,
2049620502 930705C709E0C95F00B17FE4 /* Counter.idl */,

2459124597 07846385145B1B8E00A58DF1 /* JSTrackCustom.h in Headers */,
2459224598 2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */,
2459324599 3169379C14609C6C00C01362 /* DragSession.h in Headers */,
 24600 CAE9F910146441F000C245B0 /* CSSAspectRatioValue.h in Headers */,
2459424601 );
2459524602 runOnlyForDeploymentPostprocessing = 0;
2459624603 };

2744227449 07846342145B151A00A58DF1 /* JSTrackEvent.cpp in Sources */,
2744327450 07689D6E145B52CC001CD132 /* JSTrackEventCustom.cpp in Sources */,
2744427451 2D8FEBDC143E3EF70072502B /* CSSCrossfadeValue.cpp in Sources */,
 27452 CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */,
2744527453 CDEA763014608A53008B31F1 /* PlatformClockCA.cpp in Sources */,
2744627454 CDEA76341460B56F008B31F1 /* PlatformClockPOSIX.cpp in Sources */,
2744727455 CDEA76351460B71A008B31F1 /* Clock.cpp in Sources */,

Source/WebCore/css/CSSAspectRatioValue.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#include "config.h"
 30#include "CSSAspectRatioValue.h"
 31
 32#include <wtf/text/StringBuilder.h>
 33
 34namespace WebCore {
 35
 36CSSAspectRatioValue::~CSSAspectRatioValue()
 37{
 38}
 39
 40String CSSAspectRatioValue::cssText() const
 41{
 42 StringBuilder result;
 43 result.append(String::number(m_numeratorValue));
 44 result.append("/");
 45 result.append(String::number(m_denominatorValue));
 46 return result.toString();
 47}
 48
 49}

Source/WebCore/css/CSSAspectRatioValue.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#ifndef CSSAspectRatioValue_h
 30#define CSSAspectRatioValue_h
 31
 32#include "CSSPrimitiveValue.h"
 33#include "CSSValue.h"
 34
 35namespace WebCore {
 36
 37class CSSAspectRatioValue : public CSSValue {
 38public:
 39 static PassRefPtr<CSSAspectRatioValue> create(float numeratorValue, float denominatorValue)
 40 {
 41 return adoptRef(new CSSAspectRatioValue(numeratorValue, denominatorValue));
 42 }
 43
 44 virtual ~CSSAspectRatioValue();
 45
 46 virtual String cssText() const;
 47
 48 float numeratorValue() const { return m_numeratorValue; }
 49 float denominatorValue() const { return m_denominatorValue; }
 50
 51private:
 52 CSSAspectRatioValue(float numeratorValue, float denominatorValue)
 53 : m_numeratorValue(numeratorValue)
 54 , m_denominatorValue(denominatorValue)
 55 {
 56 }
 57
 58 float m_numeratorValue;
 59 float m_denominatorValue;
 60};
 61
 62}
 63
 64#endif

Source/WebCore/css/CSSComputedStyleDeclaration.cpp

@@PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
20332033 break;
20342034
20352035 /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
 2036 case CSSPropertyWebkitAspectRatio:
20362037 case CSSPropertyWebkitTextEmphasis:
20372038 case CSSPropertyTextLineThrough:
20382039 case CSSPropertyTextLineThroughColor:

Source/WebCore/css/CSSMutableStyleDeclaration.cpp

@@void CSSMutableStyleDeclaration::addSubresourceStyleURLs(ListHashSet<KURL>& urls
787787static const int blockProperties[] = {
788788 CSSPropertyOrphans,
789789 CSSPropertyOverflow, // This can be also be applied to replaced elements
 790 CSSPropertyWebkitAspectRatio,
790791 CSSPropertyWebkitColumnCount,
791792 CSSPropertyWebkitColumnGap,
792793 CSSPropertyWebkitColumnRuleColor,

Source/WebCore/css/CSSParser.cpp

2525#include "config.h"
2626#include "CSSParser.h"
2727
 28#include "CSSAspectRatioValue.h"
2829#include "CSSBorderImageValue.h"
2930#include "CSSCanvasValue.h"
3031#include "CSSCharsetRule.h"

@@bool CSSParser::parseValue(int propId, bool important)
15101511 return true;
15111512 }
15121513 case CSSPropertyBorderRadius:
 1514 case CSSPropertyWebkitAspectRatio:
 1515 return parseAspectRatio(important);
15131516 case CSSPropertyWebkitBorderRadius:
15141517 return parseBorderRadius(propId, important);
15151518 case CSSPropertyOutlineOffset:

@@bool CSSParser::parseBorderRadius(int propId, bool important)
56485651 return true;
56495652}
56505653
 5654bool CSSParser::parseAspectRatio(bool important)
 5655{
 5656 unsigned num = m_valueList->size();
 5657 if (num == 1 && m_valueList->valueAt(0)->id == CSSValueNone) {
 5658 addProperty(CSSPropertyWebkitAspectRatio, primitiveValueCache()->createIdentifierValue(CSSValueNone), important);
 5659 return true;
 5660 }
 5661
 5662 if (num != 3)
 5663 return false;
 5664
 5665 CSSParserValue* lvalue = m_valueList->valueAt(0);
 5666 CSSParserValue* op = m_valueList->valueAt(1);
 5667 CSSParserValue* rvalue = m_valueList->valueAt(2);
 5668
 5669 if (op->unit != CSSParserValue::Operator || op->iValue != '/')
 5670 return false;
 5671
 5672 if (!validUnit(lvalue, FNumber | FNonNeg, m_strict) || !validUnit(rvalue, FNumber | FNonNeg, m_strict))
 5673 return false;
 5674
 5675 if (!lvalue->fValue || !rvalue->fValue)
 5676 return false;
 5677
 5678 addProperty(CSSPropertyWebkitAspectRatio, CSSAspectRatioValue::create(lvalue->fValue, rvalue->fValue), important);
 5679
 5680 return true;
 5681}
 5682
56515683bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
56525684{
56535685 enum { ID, VAL } state = ID;

Source/WebCore/css/CSSParser.h

@@public:
171171 bool parseBorderImageOutset(RefPtr<CSSPrimitiveValue>&);
172172 bool parseBorderRadius(int propId, bool important);
173173
 174 bool parseAspectRatio(bool important);
 175
174176 bool parseReflect(int propId, bool important);
175177
176178 bool parseFlex(int propId, bool important);

Source/WebCore/css/CSSProperty.cpp

@@bool CSSProperty::isInheritedProperty(unsigned propertyID)
317317 case CSSPropertyTextShadow:
318318 case CSSPropertyTextTransform:
319319 case CSSPropertyVisibility:
 320 case CSSPropertyWebkitAspectRatio:
320321 case CSSPropertyWebkitBorderHorizontalSpacing:
321322 case CSSPropertyWebkitBorderVerticalSpacing:
322323 case CSSPropertyWebkitBoxDirection:

Source/WebCore/css/CSSPropertyNames.in

@@z-index
193193-webkit-animation-play-state
194194-webkit-animation-timing-function
195195-webkit-appearance
 196-webkit-aspect-ratio
196197-webkit-backface-visibility
197198-webkit-background-clip
198199-webkit-background-composite

Source/WebCore/css/CSSStyleSelector.cpp

@@void CSSStyleSelector::applyProperty(int id, CSSValue *value)
37723772 case CSSPropertyTextUnderlineMode:
37733773 case CSSPropertyTextUnderlineStyle:
37743774 case CSSPropertyTextUnderlineWidth:
 3775 case CSSPropertyWebkitAspectRatio:
37753776 case CSSPropertyWebkitFontSizeDelta:
37763777 case CSSPropertyWebkitTextDecorationsInEffect:
37773778 case CSSPropertyWebkitTextStroke:

LayoutTests/ChangeLog

 12011-11-04 Fady Samuel <fsamuel@chromium.org>
 2
 3 CSS Aspect Ratio Property Parsing Stage
 4 https://bugs.webkit.org/show_bug.cgi?id=70707
 5
 6 Reviewed by Ojan Vafai.
 7
 8 * fast/css/aspect-ratio-parsing-tests-expected.txt: Added.
 9 * fast/css/aspect-ratio-parsing-tests.html: Added.
 10
1112011-11-04 Csaba Osztrogonác <ossy@webkit.org>
212
313 [Qt] Unreviewed gardening.

LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt

 1CSS Aspect Ratio Parsing Test
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6PASS testParsing("aspectRatioTest", "2/1", "-webkit-aspect-ratio") is "2/1"
 7PASS testParsing("aspectRatioTest", "1/1", "-webkit-aspect-ratio") is "1/1"
 8PASS testParsing("aspectRatioTest", "1/4", "-webkit-aspect-ratio") is "1/4"
 9PASS testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio") is "1/2"
 10PASS testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio") is "1.2/2"
 11PASS testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio") is "2/0.5"
 12PASS testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio") is "none"
 13PASS testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio") is "none"
 14PASS testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio") is "none"
 15PASS testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio") is "none"
 16PASS testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio") is "none"
 17PASS testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio") is "none"
 18PASS testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio") is "none"
 19PASS testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio") is "none"
 20PASS testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio") is "none"
 21PASS testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio") is "none"
 22PASS testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio") is "none"
 23PASS testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio") is "none"
 24PASS successfullyParsed is true
 25
 26TEST COMPLETE
 27

LayoutTests/fast/css/aspect-ratio-parsing-tests.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3 <head>
 4 <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
 5 <script src="../../fast/js/resources/js-test-pre.js"></script>
 6 </head>
 7 <body>
 8 <p id="description"></p>
 9 <div id="console"></div>
 10 <div id="aspectRatioTest"></div>
 11 <script>
 12 description('CSS Aspect Ratio Parsing Test');
 13 function testParsing(elementId, value, styleAttribute)
 14 {
 15 var div = document.getElementById(elementId);
 16 div.style[styleAttribute] = value;
 17 return div.style[styleAttribute];
 18 }
 19
 20 shouldBeEqualToString('testParsing("aspectRatioTest", "2/1", "-webkit-aspect-ratio")', '2/1');
 21 shouldBeEqualToString('testParsing("aspectRatioTest", "1/1", "-webkit-aspect-ratio")', '1/1');
 22 shouldBeEqualToString('testParsing("aspectRatioTest", "1/4", "-webkit-aspect-ratio")', '1/4');
 23 shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio")', '1/2');
 24 shouldBeEqualToString('testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio")', '1.2/2');
 25 shouldBeEqualToString('testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio")', '2/0.5');
 26 shouldBeEqualToString('testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio")', 'none');
 27
 28 // The following are invalid and should get ignored.
 29 shouldBeEqualToString('testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio")', 'none');
 30 shouldBeEqualToString('testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio")', 'none');
 31 shouldBeEqualToString('testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio")', 'none');
 32 shouldBeEqualToString('testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio")', 'none');
 33 shouldBeEqualToString('testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio")', 'none');
 34 shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio")', 'none');
 35 shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio")', 'none');
 36 shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio")', 'none');
 37 shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio")', 'none');
 38 shouldBeEqualToString('testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio")', 'none');
 39 shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio")', 'none');
 40 </script>
 41 <script src="../../fast/js/resources/js-test-post.js"></script>
 42 </body>
 43</html>