Changeset 207471 in webkit
- Timestamp:
- Oct 18, 2016 10:41:14 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207470 r207471 1 2016-10-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 SVGCSSParser: m_implicitShorthand value is not reset after adding the shorthand property 4 https://bugs.webkit.org/show_bug.cgi?id=116470 5 6 Reviewed by Simon Fraser. 7 8 * fast/css/implicit-property-restore-expected.txt: Added. 9 * fast/css/implicit-property-restore.html: Added. 10 11 * fast/css/remove-shorthand-expected.txt: 12 Rebase-line the test expected results because of fixing the leak of 13 m_implicitShorthand. The bug was happening because "background: ..." property 14 comes immediately before the "list-style: ...." property. 15 1 16 2016-10-18 Ryan Haddad <ryanhaddad@apple.com> 2 17 -
trunk/LayoutTests/fast/css/remove-shorthand-expected.txt
r200357 r207471 49 49 and adds "". 50 50 Removing list-style 51 removes "list-style -type, list-style-position, list-style-image"51 removes "list-style" 52 52 and adds "". 53 53 Removing margin -
trunk/Source/WTF/ChangeLog
r207438 r207471 1 2016-10-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 SVGCSSParser: m_implicitShorthand value is not reset after adding the shorthand property 4 https://bugs.webkit.org/show_bug.cgi?id=116470 5 6 Reviewed by Simon Fraser. 7 8 * wtf/TemporaryChange.h: 9 (WTF::TemporaryChange::TemporaryChange): 10 Add a new constructor to make TemporaryChange work as a restorer. The 11 temporary change will happen after we construct the object. 12 1 13 2016-10-17 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/Source/WTF/wtf/TemporaryChange.h
r111778 r207471 44 44 WTF_MAKE_NONCOPYABLE(TemporaryChange); 45 45 public: 46 TemporaryChange(T& scopedVariable , T newValue)46 TemporaryChange(T& scopedVariable) 47 47 : m_scopedVariable(scopedVariable) 48 48 , m_originalValue(scopedVariable) 49 { 50 } 51 TemporaryChange(T& scopedVariable, T newValue) 52 : TemporaryChange(scopedVariable) 49 53 { 50 54 m_scopedVariable = newValue; … … 55 59 m_scopedVariable = m_originalValue; 56 60 } 57 58 61 59 62 private: -
trunk/Source/WebCore/ChangeLog
r207468 r207471 1 2016-10-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 SVGCSSParser: m_implicitShorthand value is not reset after adding the shorthand property 4 https://bugs.webkit.org/show_bug.cgi?id=116470 5 6 Reviewed by Simon Fraser. 7 8 When we encounter a shorthand css property, we set m_implicitShorthand 9 to true to tell addProperty() later that the individual properties are 10 all set through a short hand one. We need to make sure that setting 11 m_implicitShorthand to true will not be leaked after finishing parsing 12 the short hand property. 13 14 Test: fast/css/implicit-property-restore.html 15 16 * css/parser/CSSParser.cpp: 17 (WebCore::CSSParser::parseValue): 18 (WebCore::CSSParser::parseFillShorthand): 19 (WebCore::CSSParser::parseShorthand): 20 (WebCore::CSSParser::parse4Values): 21 (WebCore::CSSParser::parseBorderRadius): 22 (WTF::ImplicitScope::ImplicitScope): Deleted. 23 (WTF::ImplicitScope::~ImplicitScope): Deleted. 24 Get rid of ImplicitScope and replace its calls by TemporaryChange<bool>. 25 26 * css/parser/SVGCSSParser.cpp: 27 (WebCore::CSSParser::parseSVGValue): 28 Restore m_implicitShorthand value after setting it temporarily to true. 29 1 30 2016-10-18 Chris Dumez <cdumez@apple.com> 2 31 -
trunk/Source/WebCore/css/parser/CSSParser.cpp
r207442 r207471 110 110 #include <wtf/NeverDestroyed.h> 111 111 #include <wtf/StdLibExtras.h> 112 #include <wtf/TemporaryChange.h> 112 113 #include <wtf/dtoa.h> 113 114 #include <wtf/text/StringBuffer.h> … … 138 139 139 140 using namespace WTF; 140 141 namespace {142 143 enum PropertyType {144 PropertyExplicit,145 PropertyImplicit146 };147 148 class ImplicitScope {149 WTF_MAKE_NONCOPYABLE(ImplicitScope);150 public:151 ImplicitScope(WebCore::CSSParser& parser, PropertyType propertyType)152 : m_parser(parser)153 {154 m_parser.m_implicitShorthand = propertyType == PropertyImplicit;155 }156 157 ~ImplicitScope()158 {159 m_parser.m_implicitShorthand = false;160 }161 162 private:163 WebCore::CSSParser& m_parser;164 };165 166 } // namespace167 141 168 142 namespace WebCore { … … 2135 2109 result = true; 2136 2110 } 2137 m_implicitShorthand = false;2138 2111 return result; 2139 2112 } … … 3374 3347 3375 3348 ShorthandScope scope(this, propId); 3349 TemporaryChange<bool> change(m_implicitShorthand); 3376 3350 3377 3351 bool parsedProperty[cMaxFillProperties] = { false }; … … 3769 3743 // Fill in any remaining properties with the initial value. 3770 3744 auto& cssValuePool = CSSValuePool::singleton(); 3771 ImplicitScope implicitScope(*this, PropertyImplicit);3745 TemporaryChange<bool> change(m_implicitShorthand, true); 3772 3746 const StylePropertyShorthand* propertiesForInitialization = shorthand.propertiesForInitialization(); 3773 3747 for (unsigned i = 0; i < shorthand.length(); ++i) { … … 3806 3780 return false; 3807 3781 CSSValue* value = m_parsedProperties.last().value(); 3808 ImplicitScope implicitScope(*this, PropertyImplicit);3782 TemporaryChange<bool> change(m_implicitShorthand, true); 3809 3783 addProperty(properties[1], value, important); 3810 3784 addProperty(properties[2], value, important); … … 3816 3790 return false; 3817 3791 CSSValue* value = m_parsedProperties[m_parsedProperties.size() - 2].value(); 3818 ImplicitScope implicitScope(*this, PropertyImplicit);3792 TemporaryChange<bool> change(m_implicitShorthand, true); 3819 3793 addProperty(properties[2], value, important); 3820 3794 value = m_parsedProperties[m_parsedProperties.size() - 2].value(); … … 3826 3800 return false; 3827 3801 CSSValue* value = m_parsedProperties[m_parsedProperties.size() - 2].value(); 3828 ImplicitScope implicitScope(*this, PropertyImplicit);3802 TemporaryChange<bool> change(m_implicitShorthand, true); 3829 3803 addProperty(properties[3], value, important); 3830 3804 break; … … 8511 8485 completeBorderRadii(radii[1]); 8512 8486 8513 ImplicitScope implicitScope(*this, PropertyImplicit);8487 TemporaryChange<bool> change(m_implicitShorthand, true); 8514 8488 addProperty(CSSPropertyBorderTopLeftRadius, createPrimitiveValuePair(WTFMove(radii[0][0]), WTFMove(radii[1][0])), important); 8515 8489 addProperty(CSSPropertyBorderTopRightRadius, createPrimitiveValuePair(WTFMove(radii[0][1]), WTFMove(radii[1][1])), important); -
trunk/Source/WebCore/css/parser/SVGCSSParser.cpp
r207361 r207471 31 31 #include "RenderTheme.h" 32 32 #include "SVGPaint.h" 33 34 #include <wtf/TemporaryChange.h> 33 35 34 36 namespace WebCore { … … 212 214 { 213 215 ShorthandScope scope(this, propId); 214 m_implicitShorthand = true;216 TemporaryChange<bool> change(m_implicitShorthand, true); 215 217 if (!parseValue(CSSPropertyMarkerStart, important)) 216 218 return false; … … 222 224 addProperty(CSSPropertyMarkerMid, value, important); 223 225 addProperty(CSSPropertyMarkerEnd, value, important); 224 m_implicitShorthand = false;225 226 return true; 226 227 }
Note: See TracChangeset
for help on using the changeset viewer.