WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-70707-20111031153318.patch (text/plain), 16.04 KB, created by
Fady Samuel
on 2011-10-31 12:33:19 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Fady Samuel
Created:
2011-10-31 12:33:19 PDT
Size:
16.04 KB
patch
obsolete
>Subversion Revision: 98867 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 38dd6d05adc84f2cab09b3a9a3cc2591071e2355..8822f72e1018f4a12a3002f3b90fcdd1cfea4a72 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,39 @@ >+2011-10-31 Fady Samuel <fsamuel@chromium.org> >+ >+ CSS Aspect Ratio Property Parsing Stage >+ https://bugs.webkit.org/show_bug.cgi?id=70707 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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 >+ >+ * 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): >+ * rendering/style/RenderStyle.h: >+ (WebCore::InheritedFlags::hasAspectRatio): >+ (WebCore::InheritedFlags::setHasAspectRatio): >+ (WebCore::InheritedFlags::aspectRatio): >+ (WebCore::InheritedFlags::setAspectRatio): >+ * rendering/style/StyleBoxData.cpp: >+ (WebCore::StyleBoxData::StyleBoxData): >+ (WebCore::StyleBoxData::operator==): >+ * rendering/style/StyleBoxData.h: >+ (WebCore::StyleBoxData::aspectRatio): >+ (WebCore::StyleBoxData::hasAspectRatio): >+ > 2011-10-31 Andreas Kling <kling@webkit.org> > > CSSRule: Devirtualize insertedIntoParent() >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index bf958a019936d26f9ee3f3bc52c2ad12cbce5a8f..bc6d7c0dd7932c003a1655cafe5f48c38ceac97e 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -1120,7 +1120,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper > switch (static_cast<CSSPropertyID>(propertyID)) { > case CSSPropertyInvalid: > break; >- >+ case CSSPropertyWebkitAspectRatio: >+ return primitiveValueCache->createValue(style->aspectRatio()); > case CSSPropertyBackgroundColor: > return primitiveValueCache->createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb()); > case CSSPropertyBackgroundImage: >diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp >index 44cf807c6c613ac1bf9b08e562dcab14e45891a2..c4ebb8b06c12b62ee7737e2018f30d3505c1d9a1 100644 >--- a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp >@@ -787,6 +787,7 @@ void CSSMutableStyleDeclaration::addSubresourceStyleURLs(ListHashSet<KURL>& urls > static const int blockProperties[] = { > CSSPropertyOrphans, > CSSPropertyOverflow, // This can be also be applied to replaced elements >+ CSSPropertyWebkitAspectRatio, > CSSPropertyWebkitColumnCount, > CSSPropertyWebkitColumnGap, > CSSPropertyWebkitColumnRuleColor, >diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp >index 8030b33991109d2cadca8d36e63eabde6fa55e9b..813c5e6c086b0aa39cf8ee3597f773ee1ed5ba09 100644 >--- a/Source/WebCore/css/CSSParser.cpp >+++ b/Source/WebCore/css/CSSParser.cpp >@@ -1510,6 +1510,8 @@ bool CSSParser::parseValue(int propId, bool important) > return true; > } > case CSSPropertyBorderRadius: >+ case CSSPropertyWebkitAspectRatio: >+ return parseAspectRatio(important); > case CSSPropertyWebkitBorderRadius: > return parseBorderRadius(propId, important); > case CSSPropertyOutlineOffset: >@@ -5649,6 +5651,35 @@ bool CSSParser::parseBorderRadius(int propId, bool important) > 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, primitiveValueCache()->createValue(lvalue->fValue / rvalue->fValue, CSSPrimitiveValue::CSS_NUMBER), important); >+ >+ return true; >+} >+ > bool CSSParser::parseCounter(int propId, int defaultValue, bool important) > { > enum { ID, VAL } state = ID; >diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h >index 744d3c75c95e0ca194ca2e58078b9d2eaf5720a2..b12e8c92187f5a01542aab9b072dd0a88e74d1d3 100644 >--- a/Source/WebCore/css/CSSParser.h >+++ b/Source/WebCore/css/CSSParser.h >@@ -171,6 +171,8 @@ public: > 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); >diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp >index 00b25f15cf3a3fd095ad1da6d4fb9d03c0e17c4d..73a0c9b256a627e62962d007630eba90a6cad892 100644 >--- a/Source/WebCore/css/CSSProperty.cpp >+++ b/Source/WebCore/css/CSSProperty.cpp >@@ -317,6 +317,7 @@ bool CSSProperty::isInheritedProperty(unsigned propertyID) > case CSSPropertyTextShadow: > case CSSPropertyTextTransform: > case CSSPropertyVisibility: >+ case CSSPropertyWebkitAspectRatio: > case CSSPropertyWebkitBorderHorizontalSpacing: > case CSSPropertyWebkitBorderVerticalSpacing: > case CSSPropertyWebkitBoxDirection: >diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in >index 04f3da43515fc4c2bdfceebfde75c8b527724bad..41684feebe2f6daf0b47f34b8859af370f115232 100644 >--- a/Source/WebCore/css/CSSPropertyNames.in >+++ b/Source/WebCore/css/CSSPropertyNames.in >@@ -183,6 +183,7 @@ word-break > word-spacing > word-wrap > z-index >+-webkit-aspect-ratio > -webkit-animation > -webkit-animation-delay > -webkit-animation-direction >diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp >index 13be0d40c4c61fb132fc40db83e088ff92588f4c..dbcf01d905465a107662faf19bdb2048f6ad92d2 100644 >--- a/Source/WebCore/css/CSSStyleSelector.cpp >+++ b/Source/WebCore/css/CSSStyleSelector.cpp >@@ -3771,6 +3771,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) > case CSSPropertyTextUnderlineMode: > case CSSPropertyTextUnderlineStyle: > case CSSPropertyTextUnderlineWidth: >+ case CSSPropertyWebkitAspectRatio: > case CSSPropertyWebkitFontSizeDelta: > case CSSPropertyWebkitTextDecorationsInEffect: > case CSSPropertyWebkitTextStroke: >diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h >index 7a8bed17e89fdbebed101a6bfd9c8e360da22248..63a41c670dbded1d302689e719cdb27877c32503 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -1091,6 +1091,11 @@ public: > int zIndex() const { return m_box->zIndex(); } > void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v) } > >+ bool hasAspectRatio() const { return m_box->hasAspectRatio(); } >+ void setHasAspectRatio(bool v) { SET_VAR(m_box, m_hasAspectRatio, v); SET_VAR(m_box, m_aspectRatio, 1.0f) } >+ float aspectRatio() const { return m_box->aspectRatio(); } >+ void setAspectRatio(float v) { SET_VAR(m_box, m_hasAspectRatio, true); SET_VAR(m_box, m_aspectRatio, v) } >+ > void setWidows(short w) { SET_VAR(rareInheritedData, widows, w); } > void setOrphans(short o) { SET_VAR(rareInheritedData, orphans, o); } > // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props >diff --git a/Source/WebCore/rendering/style/StyleBoxData.cpp b/Source/WebCore/rendering/style/StyleBoxData.cpp >index 2c523da6999b498c36dacc6d9bd49fff4b39d7ba..02384deab373fb8c244f42bcdea21dbffc1c6b77 100644 >--- a/Source/WebCore/rendering/style/StyleBoxData.cpp >+++ b/Source/WebCore/rendering/style/StyleBoxData.cpp >@@ -33,7 +33,9 @@ StyleBoxData::StyleBoxData() > , m_minHeight(RenderStyle::initialMinSize()) > , m_maxHeight(RenderStyle::initialMaxSize()) > , m_zIndex(0) >+ , m_aspectRatio(1) > , m_hasAutoZIndex(true) >+ , m_hasAspectRatio(false) > , m_boxSizing(CONTENT_BOX) > { > } >@@ -47,7 +49,9 @@ StyleBoxData::StyleBoxData(const StyleBoxData& o) > , m_minHeight(o.m_minHeight) > , m_maxHeight(o.m_maxHeight) > , m_zIndex(o.m_zIndex) >+ , m_aspectRatio(o.m_aspectRatio) > , m_hasAutoZIndex(o.m_hasAutoZIndex) >+ , m_hasAspectRatio(o.m_hasAspectRatio) > , m_boxSizing(o.m_boxSizing) > { > } >@@ -62,6 +66,8 @@ bool StyleBoxData::operator==(const StyleBoxData& o) const > && m_maxHeight == o.m_maxHeight > && m_zIndex == o.m_zIndex > && m_hasAutoZIndex == o.m_hasAutoZIndex >+ && m_aspectRatio == o.m_aspectRatio >+ && m_hasAspectRatio == o.m_hasAspectRatio > && m_boxSizing == o.m_boxSizing; > } > >diff --git a/Source/WebCore/rendering/style/StyleBoxData.h b/Source/WebCore/rendering/style/StyleBoxData.h >index 00bce4e2ca76a8681a6f141ef71cf4f69cba7f87..b5316d96a817f6a4d378e6415aff1ac863aea90d 100644 >--- a/Source/WebCore/rendering/style/StyleBoxData.h >+++ b/Source/WebCore/rendering/style/StyleBoxData.h >@@ -56,6 +56,9 @@ public: > > int zIndex() const { return m_zIndex; } > bool hasAutoZIndex() const { return m_hasAutoZIndex; } >+ >+ float aspectRatio() const { return m_aspectRatio; } >+ bool hasAspectRatio() const { return m_hasAspectRatio; } > > EBoxSizing boxSizing() const { return static_cast<EBoxSizing>(m_boxSizing); } > >@@ -77,7 +80,10 @@ private: > Length m_verticalAlign; > > int m_zIndex; >+ float m_aspectRatio; >+ > bool m_hasAutoZIndex : 1; >+ bool m_hasAspectRatio : 1; > unsigned m_boxSizing : 1; // EBoxSizing > }; > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 03cfa048e56e49083e26a53e3e2a255dfe1e31c8..d8dfa6d78008180d2d6e633b6789d8e71c293799 100755 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2011-10-31 Fady Samuel <fsamuel@chromium.org> >+ >+ CSS Aspect Ratio Property Parsing Stage >+ https://bugs.webkit.org/show_bug.cgi?id=70707 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/css/aspect-ratio-parsing-tests-expected.txt: Added. >+ * fast/css/aspect-ratio-parsing-tests.html: Added. >+ > 2011-10-31 Leandro Pereira <leandro@profusion.mobi> > > [EFL] Unreviewed. Update Skipped list. >diff --git a/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt b/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..552c340d5f9e0fb5bc8070052009ee7e1e227c73 >--- /dev/null >+++ b/LayoutTests/fast/css/aspect-ratio-parsing-tests-expected.txt >@@ -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" >+PASS testParsing("aspectRatioTest", "1/1", "-webkit-aspect-ratio") is "1" >+PASS testParsing("aspectRatioTest", "1/4", "-webkit-aspect-ratio") is "0.25" >+PASS testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio") is "0.5" >+PASS testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio") is "0.6" >+PASS testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio") is "4" >+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 >+ >diff --git a/LayoutTests/fast/css/aspect-ratio-parsing-tests.html b/LayoutTests/fast/css/aspect-ratio-parsing-tests.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a30c33b3bc9f7727df236ae2d9946bb109048f11 >--- /dev/null >+++ b/LayoutTests/fast/css/aspect-ratio-parsing-tests.html >@@ -0,0 +1,43 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+ <head> >+ <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> >+ <script src="../../fast/js/resources/js-test-pre.js"></script> >+ </head> >+ <body> >+ <p id="description"></p> >+ <div id="console"></div> >+ <div id="aspectRatioTest"></div> >+ <script> >+ description('CSS Aspect Ratio Parsing Test'); >+ function testParsing(elementId, flexValue, styleAttribute) >+ { >+ var div = document.getElementById(elementId); >+ div.style[styleAttribute] = flexValue; >+ return div.style[styleAttribute]; >+ } >+ >+ shouldBeEqualToString('testParsing("aspectRatioTest", "2/1", "-webkit-aspect-ratio")', '2'); >+ shouldBeEqualToString('testParsing("aspectRatioTest", "1/1", "-webkit-aspect-ratio")', '1'); >+ shouldBeEqualToString('testParsing("aspectRatioTest", "1/4", "-webkit-aspect-ratio")', '0.25'); >+ shouldBeEqualToString('testParsing("aspectRatioTest", "1 / 2", "-webkit-aspect-ratio")', '0.5'); >+ shouldBeEqualToString('testParsing("aspectRatioTest", "1.2 / 2", "-webkit-aspect-ratio")', '0.6'); >+ shouldBeEqualToString('testParsing("aspectRatioTest", "2 / 0.5", "-webkit-aspect-ratio")', '4'); >+ 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="../../fast/js/resources/js-test-post.js"></script> >+ </body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 70707
:
112139
|
112144
|
112148
|
112980
|
113072
|
113241
|
113585
|
113609
|
113610
|
113612
|
113613
|
113654
|
113660
|
113662
|
113664
|
113685