Diff
Modified: trunk/LayoutTests/ChangeLog (99331 => 99332)
--- trunk/LayoutTests/ChangeLog 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/LayoutTests/ChangeLog 2011-11-04 23:07:20 UTC (rev 99332)
@@ -1,3 +1,13 @@
+2011-11-04 Fady Samuel <fsam...@chromium.org>
+
+ CSS Aspect Ratio Property Parsing Stage
+ https://bugs.webkit.org/show_bug.cgi?id=70707
+
+ Reviewed by Ojan Vafai.
+
+ * fast/css/aspect-ratio-parsing-tests-expected.txt: Added.
+ * fast/css/aspect-ratio-parsing-tests.html: Added.
+
2011-11-04 Adam Barth <aba...@webkit.org>
Delete FrameLoader::isSandboxed
Added: trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt (0 => 99332)
--- trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt 2011-11-04 23:07:20 UTC (rev 99332)
@@ -0,0 +1,27 @@
+CSS Aspect Ratio Parsing Test
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testParsing("aspectRatioTest", "2/1", "-webkit-aspect-ratio") is "2/1"
+PASS testParsing("aspectRatioTest", "1/1", "-webkit-aspect-ratio") is "1/1"
+PASS testParsing("aspectRatioTest", "1/4", "-webkit-aspect-ratio") is "1/4"
+PASS testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio") is "1/2"
+PASS testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio") is "1.2/2"
+PASS testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio") is "2/0.5"
+PASS testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio") is "none"
+PASS testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio") is "none"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html (0 => 99332)
--- trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html (rev 0)
+++ trunk/LayoutTests/fast/css/aspect-ratio-parsing-tests.html 2011-11-04 23:07:20 UTC (rev 99332)
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <link rel="stylesheet" href=""
+ <script src=""
+ </head>
+ <body>
+ <p id="description"></p>
+ <div id="console"></div>
+ <div id="aspectRatioTest"></div>
+ <script>
+ description('CSS Aspect Ratio Parsing Test');
+ function testParsing(elementId, value, styleAttribute)
+ {
+ var div = document.getElementById(elementId);
+ div.style[styleAttribute] = value;
+ return div.style[styleAttribute];
+ }
+
+ shouldBeEqualToString('testParsing("aspectRatioTest", "2/1", "-webkit-aspect-ratio")', '2/1');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1/1", "-webkit-aspect-ratio")', '1/1');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1/4", "-webkit-aspect-ratio")', '1/4');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio")', '1/2');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio")', '1.2/2');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio")', '2/0.5');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "none", "-webkit-aspect-ratio")', 'none');
+
+ // The following are invalid and should get ignored.
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1 2", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "a/1", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1/a", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "abc123", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 0", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 1", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "0 / 0", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / 8", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "1 / -9", "-webkit-aspect-ratio")', 'none');
+ shouldBeEqualToString('testParsing("aspectRatioTest", "-1 / -4", "-webkit-aspect-ratio")', 'none');
+ </script>
+ <script src=""
+ </body>
+</html>
Modified: trunk/Source/WebCore/CMakeLists.txt (99331 => 99332)
--- trunk/Source/WebCore/CMakeLists.txt 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/CMakeLists.txt 2011-11-04 23:07:20 UTC (rev 99332)
@@ -416,6 +416,7 @@
bindings/generic/ActiveDOMCallback.cpp
bindings/generic/RuntimeEnabledFeatures.cpp
+ css/CSSAspectRatioValue.cpp
css/CSSBorderImageValue.cpp
css/CSSBorderImageSliceValue.cpp
css/CSSCanvasValue.cpp
Modified: trunk/Source/WebCore/ChangeLog (99331 => 99332)
--- trunk/Source/WebCore/ChangeLog 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/ChangeLog 2011-11-04 23:07:20 UTC (rev 99332)
@@ -1,3 +1,42 @@
+2011-11-04 Fady Samuel <fsam...@chromium.org>
+
+ CSS Aspect Ratio Property Parsing Stage
+ https://bugs.webkit.org/show_bug.cgi?id=70707
+
+ Reviewed by Ojan Vafai.
+
+ Added parsing support for -webkit-aspect-ratio CSS property.
+ The spec can be found here: http://www.xanthir.com/blog/b4810
+
+ Test: fast/css/aspect-ratio-parsing-tests.html
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSAspectRatioValue.cpp: Added.
+ (WebCore::CSSAspectRatioValue::~CSSAspectRatioValue):
+ (WebCore::CSSAspectRatioValue::cssText):
+ * css/CSSAspectRatioValue.h: Added.
+ (WebCore::CSSAspectRatioValue::create):
+ (WebCore::CSSAspectRatioValue::numeratorValue):
+ (WebCore::CSSAspectRatioValue::denominatorValue):
+ (WebCore::CSSAspectRatioValue::CSSAspectRatioValue):
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+ * css/CSSMutableStyleDeclaration.cpp:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ (WebCore::CSSParser::parseAspectRatio):
+ * css/CSSParser.h:
+ * css/CSSProperty.cpp:
+ (WebCore::CSSProperty::isInheritedProperty):
+ * css/CSSPropertyNames.in:
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+
2011-11-04 Adam Barth <aba...@webkit.org>
Delete FrameLoader::isSandboxed
Modified: trunk/Source/WebCore/GNUmakefile.list.am (99331 => 99332)
--- trunk/Source/WebCore/GNUmakefile.list.am 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2011-11-04 23:07:20 UTC (rev 99332)
@@ -962,6 +962,8 @@
Source/WebCore/bridge/runtime_root.h \
Source/WebCore/config.h \
Source/WebCore/css/Counter.h \
+ Source/WebCore/css/CSSAspectRatioValue.cpp \
+ Source/WebCore/css/CSSAspectRatioValue.h \
Source/WebCore/css/CSSBorderImageSliceValue.cpp \
Source/WebCore/css/CSSBorderImageSliceValue.h \
Source/WebCore/css/CSSBorderImageValue.cpp \
Modified: trunk/Source/WebCore/Target.pri (99331 => 99332)
--- trunk/Source/WebCore/Target.pri 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/Target.pri 2011-11-04 23:07:20 UTC (rev 99332)
@@ -397,6 +397,7 @@
}
SOURCES += \
+ css/CSSAspectRatioValue.cpp \
css/CSSBorderImageSliceValue.cpp \
css/CSSBorderImageValue.cpp \
css/CSSCanvasValue.cpp \
@@ -1487,6 +1488,7 @@
}
HEADERS += \
+ css/CSSAspectRatioValue.h \
css/CSSBorderImageSliceValue.h \
css/CSSBorderImageValue.h \
css/CSSCanvasValue.h \
Modified: trunk/Source/WebCore/WebCore.gypi (99331 => 99332)
--- trunk/Source/WebCore/WebCore.gypi 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/WebCore.gypi 2011-11-04 23:07:20 UTC (rev 99332)
@@ -2335,6 +2335,8 @@
'bridge/testbindings.mm',
'bridge/testqtbindings.cpp',
'config.h',
+ 'css/CSSAspectRatioValue.cpp',
+ 'css/CSSAspectRatioValue.h',
'css/CSSBorderImageValue.cpp',
'css/CSSBorderImageValue.h',
'css/CSSBorderImageSliceValue.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (99331 => 99332)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-11-04 23:07:20 UTC (rev 99332)
@@ -32378,6 +32378,14 @@
>
</File>
<File
+ RelativePath="..\css\CSSAspectRatioValue.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\css\CSSAspectRatioValue.h"
+ >
+ </File>
+ <File
RelativePath="..\css\CSSBorderImageSliceValue.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (99331 => 99332)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-11-04 23:07:20 UTC (rev 99332)
@@ -5463,6 +5463,8 @@
C6F41047130C6E8900393DE4 /* EntryBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F41046130C6E8900393DE4 /* EntryBase.cpp */; };
CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */; };
+ CAE9F910146441F000C245B0 /* CSSAspectRatioValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */; };
CD0DBF011422768500280263 /* IRC_Composite_C_R0195_T000_P000.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD0DBD201422759500280263 /* IRC_Composite_C_R0195_T000_P000.wav */; };
CD0DBF021422768500280263 /* IRC_Composite_C_R0195_T000_P015.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD0DBD211422759500280263 /* IRC_Composite_C_R0195_T000_P015.wav */; };
CD0DBF031422768500280263 /* IRC_Composite_C_R0195_T000_P030.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD0DBD221422759500280263 /* IRC_Composite_C_R0195_T000_P030.wav */; };
@@ -12756,6 +12758,8 @@
C6F41046130C6E8900393DE4 /* EntryBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EntryBase.cpp; path = fileapi/EntryBase.cpp; sourceTree = "<group>"; };
CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = "<group>"; };
CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
+ CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAspectRatioValue.cpp; sourceTree = "<group>"; };
+ CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSAspectRatioValue.h; sourceTree = "<group>"; };
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; };
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; };
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; };
@@ -20491,6 +20495,8 @@
F523D18402DE42E8018635CA /* css */ = {
isa = PBXGroup;
children = (
+ CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */,
+ CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */,
93CA4C9C09DF93FA00DF8677 /* maketokenizer */,
A80E6CDA0A1989CA007FB8C5 /* Counter.h */,
930705C709E0C95F00B17FE4 /* Counter.idl */,
@@ -24591,6 +24597,7 @@
07846385145B1B8E00A58DF1 /* JSTrackCustom.h in Headers */,
2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */,
3169379C14609C6C00C01362 /* DragSession.h in Headers */,
+ CAE9F910146441F000C245B0 /* CSSAspectRatioValue.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -27442,6 +27449,7 @@
07846342145B151A00A58DF1 /* JSTrackEvent.cpp in Sources */,
07689D6E145B52CC001CD132 /* JSTrackEventCustom.cpp in Sources */,
2D8FEBDC143E3EF70072502B /* CSSCrossfadeValue.cpp in Sources */,
+ CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */,
CDEA763014608A53008B31F1 /* PlatformClockCA.cpp in Sources */,
CDEA76341460B56F008B31F1 /* PlatformClockPOSIX.cpp in Sources */,
CDEA76351460B71A008B31F1 /* Clock.cpp in Sources */,
Added: trunk/Source/WebCore/css/CSSAspectRatioValue.cpp (0 => 99332)
--- trunk/Source/WebCore/css/CSSAspectRatioValue.cpp (rev 0)
+++ trunk/Source/WebCore/css/CSSAspectRatioValue.cpp 2011-11-04 23:07:20 UTC (rev 99332)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSAspectRatioValue.h"
+
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+CSSAspectRatioValue::~CSSAspectRatioValue()
+{
+}
+
+String CSSAspectRatioValue::cssText() const
+{
+ StringBuilder result;
+ result.append(String::number(m_numeratorValue));
+ result.append("/");
+ result.append(String::number(m_denominatorValue));
+ return result.toString();
+}
+
+}
Added: trunk/Source/WebCore/css/CSSAspectRatioValue.h (0 => 99332)
--- trunk/Source/WebCore/css/CSSAspectRatioValue.h (rev 0)
+++ trunk/Source/WebCore/css/CSSAspectRatioValue.h 2011-11-04 23:07:20 UTC (rev 99332)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSAspectRatioValue_h
+#define CSSAspectRatioValue_h
+
+#include "CSSPrimitiveValue.h"
+#include "CSSValue.h"
+
+namespace WebCore {
+
+class CSSAspectRatioValue : public CSSValue {
+public:
+ static PassRefPtr<CSSAspectRatioValue> create(float numeratorValue, float denominatorValue)
+ {
+ return adoptRef(new CSSAspectRatioValue(numeratorValue, denominatorValue));
+ }
+
+ virtual ~CSSAspectRatioValue();
+
+ virtual String cssText() const;
+
+ float numeratorValue() const { return m_numeratorValue; }
+ float denominatorValue() const { return m_denominatorValue; }
+
+private:
+ CSSAspectRatioValue(float numeratorValue, float denominatorValue)
+ : m_numeratorValue(numeratorValue)
+ , m_denominatorValue(denominatorValue)
+ {
+ }
+
+ float m_numeratorValue;
+ float m_denominatorValue;
+};
+
+}
+
+#endif
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (99331 => 99332)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2011-11-04 23:07:20 UTC (rev 99332)
@@ -2033,6 +2033,7 @@
break;
/* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
+ case CSSPropertyWebkitAspectRatio:
case CSSPropertyWebkitTextEmphasis:
case CSSPropertyTextLineThrough:
case CSSPropertyTextLineThroughColor:
Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp (99331 => 99332)
--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2011-11-04 23:07:20 UTC (rev 99332)
@@ -787,6 +787,7 @@
static const int blockProperties[] = {
CSSPropertyOrphans,
CSSPropertyOverflow, // This can be also be applied to replaced elements
+ CSSPropertyWebkitAspectRatio,
CSSPropertyWebkitColumnCount,
CSSPropertyWebkitColumnGap,
CSSPropertyWebkitColumnRuleColor,
Modified: trunk/Source/WebCore/css/CSSParser.cpp (99331 => 99332)
--- trunk/Source/WebCore/css/CSSParser.cpp 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2011-11-04 23:07:20 UTC (rev 99332)
@@ -25,6 +25,7 @@
#include "config.h"
#include "CSSParser.h"
+#include "CSSAspectRatioValue.h"
#include "CSSBorderImageValue.h"
#include "CSSCanvasValue.h"
#include "CSSCharsetRule.h"
@@ -1509,6 +1510,8 @@
addProperty(propId, val.release(), important);
return true;
}
+ case CSSPropertyWebkitAspectRatio:
+ return parseAspectRatio(important);
case CSSPropertyBorderRadius:
case CSSPropertyWebkitBorderRadius:
return parseBorderRadius(propId, important);
@@ -5648,6 +5651,35 @@
return true;
}
+bool CSSParser::parseAspectRatio(bool important)
+{
+ unsigned num = m_valueList->size();
+ if (num == 1 && m_valueList->valueAt(0)->id == CSSValueNone) {
+ addProperty(CSSPropertyWebkitAspectRatio, primitiveValueCache()->createIdentifierValue(CSSValueNone), important);
+ return true;
+ }
+
+ if (num != 3)
+ return false;
+
+ CSSParserValue* lvalue = m_valueList->valueAt(0);
+ CSSParserValue* op = m_valueList->valueAt(1);
+ CSSParserValue* rvalue = m_valueList->valueAt(2);
+
+ if (op->unit != CSSParserValue::Operator || op->iValue != '/')
+ return false;
+
+ if (!validUnit(lvalue, FNumber | FNonNeg, m_strict) || !validUnit(rvalue, FNumber | FNonNeg, m_strict))
+ return false;
+
+ if (!lvalue->fValue || !rvalue->fValue)
+ return false;
+
+ addProperty(CSSPropertyWebkitAspectRatio, CSSAspectRatioValue::create(lvalue->fValue, rvalue->fValue), important);
+
+ return true;
+}
+
bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
{
enum { ID, VAL } state = ID;
Modified: trunk/Source/WebCore/css/CSSParser.h (99331 => 99332)
--- trunk/Source/WebCore/css/CSSParser.h 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/css/CSSParser.h 2011-11-04 23:07:20 UTC (rev 99332)
@@ -171,6 +171,8 @@
bool parseBorderImageOutset(RefPtr<CSSPrimitiveValue>&);
bool parseBorderRadius(int propId, bool important);
+ bool parseAspectRatio(bool important);
+
bool parseReflect(int propId, bool important);
bool parseFlex(int propId, bool important);
Modified: trunk/Source/WebCore/css/CSSProperty.cpp (99331 => 99332)
--- trunk/Source/WebCore/css/CSSProperty.cpp 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/css/CSSProperty.cpp 2011-11-04 23:07:20 UTC (rev 99332)
@@ -317,6 +317,7 @@
case CSSPropertyTextShadow:
case CSSPropertyTextTransform:
case CSSPropertyVisibility:
+ case CSSPropertyWebkitAspectRatio:
case CSSPropertyWebkitBorderHorizontalSpacing:
case CSSPropertyWebkitBorderVerticalSpacing:
case CSSPropertyWebkitBoxDirection:
Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (99331 => 99332)
--- trunk/Source/WebCore/css/CSSPropertyNames.in 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in 2011-11-04 23:07:20 UTC (rev 99332)
@@ -193,6 +193,7 @@
-webkit-animation-play-state
-webkit-animation-timing-function
-webkit-appearance
+-webkit-aspect-ratio
-webkit-backface-visibility
-webkit-background-clip
-webkit-background-composite
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (99331 => 99332)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-11-04 22:52:26 UTC (rev 99331)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-11-04 23:07:20 UTC (rev 99332)
@@ -3772,6 +3772,7 @@
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
case CSSPropertyTextUnderlineWidth:
+ case CSSPropertyWebkitAspectRatio:
case CSSPropertyWebkitFontSizeDelta:
case CSSPropertyWebkitTextDecorationsInEffect:
case CSSPropertyWebkitTextStroke: