Log Message
Convert CSSParser's m_reusableSelectorVector to OwnPtr and rename to m_selectorVector. https://bugs.webkit.org/show_bug.cgi?id=93574
Patch by Shane Stephens <[email protected]> on 2012-08-09 Reviewed by Ojan Vafai. This is preparatory work for CSS Hierarchies (see wkb.ug/79939). CSS Hierarchies works by pushing selectorVectors onto a stack while nested selectorVectors are parsed. For this reason, the selectorVector in CSSParser can't be re-used between selector parses within a set of nested selectors. This patch wraps the selectorVector in an OwnPtr but does not otherwise modify its use. Similarly, CSSParser::m_parsedProperties is converted from a direct ParsedPropertyVector included as a member of CSSParser to an OwnPtr. Once Hierarchies are introduced, when a selectorVector is stacked a new one will be created and stored in m_selectorVector (see wkb.ug/79939 for context). However, an accompanying unstacking mechanism ensures that selectorVectors will be reused in all circumstances where they currently are. This patch also introduces a CSSSelectorVector typedef to simplify and improve readability of type signatures in and around CSSParser. No new tests as this patch doesn't introduce new functionality. * css/CSSGrammar.y: * css/CSSParser.cpp: (WebCore::CSSParser::CSSParser): (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseColor): (WebCore::CSSParser::parseDeclaration): (WebCore): (WebCore::filterProperties): (WebCore::CSSParser::createStylePropertySet): (WebCore::CSSParser::addProperty): (WebCore::CSSParser::rollbackLastProperties): (WebCore::CSSParser::clearProperties): (WebCore::CSSParser::parse4Values): (WebCore::CSSParser::parseFlowThread): (WebCore::CSSParser::createFloatingSelectorVector): (WebCore::CSSParser::sinkFloatingSelectorVector): (WebCore::CSSParser::createStyleRule): (WebCore::CSSParser::createFontFaceRule): (WebCore::CSSParser::createPageRule): (WebCore::CSSParser::setReusableRegionSelectorVector): (WebCore::CSSParser::startDeclarationsForMarginBox): (WebCore::CSSParser::endDeclarationsForMarginBox): (WebCore::CSSParser::deleteFontFaceOnlyValues): m_reusableSelectorVector renamed to m_selectorVector and wrapped in OwnPtr. m_parsedProperties wrapped in OwnPtr. * css/CSSParser.h: (WebCore::CSSParser::hasProperties): (WebCore::CSSParser::selectorVector): function renamed from reusableSelectorVector (CSSParser): (WebCore::CSSParser::reusableRegionSelectorVector): * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::adoptSelectorVector): * css/CSSParserValues.h: CSSSelectorVector typedef added (WebCore): (CSSParserSelector): * css/CSSSelectorList.cpp: (WebCore::CSSSelectorList::adoptSelectorVector): * css/CSSSelectorList.h: (CSSSelectorList): * css/SVGCSSParser.cpp: (WebCore::CSSParser::parseSVGValue): * css/StyleRule.cpp: (WebCore::StyleRuleRegion::StyleRuleRegion): * css/StyleRule.h: (WebCore::StyleRule::parserAdoptSelectorVector): (WebCore::StyleRulePage::parserAdoptSelectorVector): (WebCore::StyleRuleRegion::create): (StyleRuleRegion):
Modified Paths
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/css/CSSGrammar.y
- trunk/Source/WebCore/css/CSSParser.cpp
- trunk/Source/WebCore/css/CSSParser.h
- trunk/Source/WebCore/css/CSSParserValues.cpp
- trunk/Source/WebCore/css/CSSParserValues.h
- trunk/Source/WebCore/css/CSSSelectorList.cpp
- trunk/Source/WebCore/css/CSSSelectorList.h
- trunk/Source/WebCore/css/SVGCSSParser.cpp
- trunk/Source/WebCore/css/StyleRule.cpp
- trunk/Source/WebCore/css/StyleRule.h
Diff
Modified: trunk/Source/WebCore/ChangeLog (125251 => 125252)
--- trunk/Source/WebCore/ChangeLog 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/ChangeLog 2012-08-10 05:14:13 UTC (rev 125252)
@@ -1,3 +1,77 @@
+2012-08-09 Shane Stephens <[email protected]>
+
+ Convert CSSParser's m_reusableSelectorVector to OwnPtr and rename to m_selectorVector.
+ https://bugs.webkit.org/show_bug.cgi?id=93574
+
+ Reviewed by Ojan Vafai.
+
+ This is preparatory work for CSS Hierarchies (see wkb.ug/79939).
+ CSS Hierarchies works by pushing selectorVectors onto a stack while nested selectorVectors are parsed.
+ For this reason, the selectorVector in CSSParser can't be re-used between selector parses within a set of
+ nested selectors. This patch wraps the selectorVector in an OwnPtr but does not otherwise modify its use.
+
+ Similarly, CSSParser::m_parsedProperties is converted from a direct ParsedPropertyVector included
+ as a member of CSSParser to an OwnPtr.
+
+ Once Hierarchies are introduced, when a selectorVector is stacked a new one will be created
+ and stored in m_selectorVector (see wkb.ug/79939 for context). However, an accompanying unstacking
+ mechanism ensures that selectorVectors will be reused in all circumstances where they currently are.
+
+ This patch also introduces a CSSSelectorVector typedef to simplify and improve readability of
+ type signatures in and around CSSParser.
+
+ No new tests as this patch doesn't introduce new functionality.
+
+ * css/CSSGrammar.y:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::CSSParser):
+ (WebCore::CSSParser::parseValue):
+ (WebCore::CSSParser::parseColor):
+ (WebCore::CSSParser::parseDeclaration):
+ (WebCore):
+ (WebCore::filterProperties):
+ (WebCore::CSSParser::createStylePropertySet):
+ (WebCore::CSSParser::addProperty):
+ (WebCore::CSSParser::rollbackLastProperties):
+ (WebCore::CSSParser::clearProperties):
+ (WebCore::CSSParser::parse4Values):
+ (WebCore::CSSParser::parseFlowThread):
+ (WebCore::CSSParser::createFloatingSelectorVector):
+ (WebCore::CSSParser::sinkFloatingSelectorVector):
+ (WebCore::CSSParser::createStyleRule):
+ (WebCore::CSSParser::createFontFaceRule):
+ (WebCore::CSSParser::createPageRule):
+ (WebCore::CSSParser::setReusableRegionSelectorVector):
+ (WebCore::CSSParser::startDeclarationsForMarginBox):
+ (WebCore::CSSParser::endDeclarationsForMarginBox):
+ (WebCore::CSSParser::deleteFontFaceOnlyValues):
+
+ m_reusableSelectorVector renamed to m_selectorVector and wrapped in OwnPtr.
+ m_parsedProperties wrapped in OwnPtr.
+ * css/CSSParser.h:
+ (WebCore::CSSParser::hasProperties):
+ (WebCore::CSSParser::selectorVector): function renamed from reusableSelectorVector
+ (CSSParser):
+ (WebCore::CSSParser::reusableRegionSelectorVector):
+ * css/CSSParserValues.cpp:
+ (WebCore::CSSParserSelector::adoptSelectorVector):
+ * css/CSSParserValues.h: CSSSelectorVector typedef added
+ (WebCore):
+ (CSSParserSelector):
+ * css/CSSSelectorList.cpp:
+ (WebCore::CSSSelectorList::adoptSelectorVector):
+ * css/CSSSelectorList.h:
+ (CSSSelectorList):
+ * css/SVGCSSParser.cpp:
+ (WebCore::CSSParser::parseSVGValue):
+ * css/StyleRule.cpp:
+ (WebCore::StyleRuleRegion::StyleRuleRegion):
+ * css/StyleRule.h:
+ (WebCore::StyleRule::parserAdoptSelectorVector):
+ (WebCore::StyleRulePage::parserAdoptSelectorVector):
+ (WebCore::StyleRuleRegion::create):
+ (StyleRuleRegion):
+
2012-08-02 Dominic Cooney <[email protected]>
SVGElementInstance should have EventTarget on the prototype chain
Modified: trunk/Source/WebCore/css/CSSGrammar.y (125251 => 125252)
--- trunk/Source/WebCore/css/CSSGrammar.y 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/CSSGrammar.y 2012-08-10 05:14:13 UTC (rev 125252)
@@ -70,7 +70,7 @@
StyleRuleBase* rule;
Vector<RefPtr<StyleRuleBase> >* ruleList;
CSSParserSelector* selector;
- Vector<OwnPtr<CSSParserSelector> >* selectorList;
+ CSSSelectorVector* selectorList;
CSSSelector::MarginBoxType marginBox;
CSSSelector::Relation relation;
MediaQuerySet* mediaList;
@@ -333,9 +333,9 @@
WEBKIT_VALUE_SYM '{' maybe_space expr '}' {
if ($4) {
parser->m_valueList = parser->sinkFloatingValueList($4);
- int oldParsedProperties = parser->m_parsedProperties.size();
+ int oldParsedProperties = parser->m_parsedProperties->size();
if (!parser->parseValue(parser->m_id, parser->m_important))
- parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
+ parser->rollbackLastProperties(parser->m_parsedProperties->size() - oldParsedProperties);
parser->m_valueList = nullptr;
}
}
@@ -912,7 +912,7 @@
selector_list:
selector %prec UNIMPORTANT_TOK {
if ($1) {
- $$ = parser->reusableSelectorVector();
+ $$ = parser->selectorVector();
$$->shrink(0);
$$->append(parser->sinkFloatingSelector($1));
parser->updateLastSelectorLineAndPosition();
@@ -1248,7 +1248,7 @@
$$ = parser->createFloatingSelector();
$$->setMatch(CSSSelector::PseudoClass);
- Vector<OwnPtr<CSSParserSelector> > selectorVector;
+ CSSSelectorVector selectorVector;
selectorVector.append(parser->sinkFloatingSelector($4));
$$->adoptSelectorVector(selectorVector);
@@ -1334,10 +1334,10 @@
bool isPropertyParsed = false;
if ($1 && $4) {
parser->m_valueList = parser->sinkFloatingValueList($4);
- int oldParsedProperties = parser->m_parsedProperties.size();
+ int oldParsedProperties = parser->m_parsedProperties->size();
$$ = parser->parseValue(static_cast<CSSPropertyID>($1), $5);
if (!$$)
- parser->rollbackLastProperties(parser->m_parsedProperties.size() - oldParsedProperties);
+ parser->rollbackLastProperties(parser->m_parsedProperties->size() - oldParsedProperties);
else
isPropertyParsed = true;
parser->m_valueList = nullptr;
Modified: trunk/Source/WebCore/css/CSSParser.cpp (125251 => 125252)
--- trunk/Source/WebCore/css/CSSParser.cpp 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2012-08-10 05:14:13 UTC (rev 125252)
@@ -244,6 +244,7 @@
, m_important(false)
, m_id(CSSPropertyInvalid)
, m_styleSheet(0)
+ , m_parsedProperties(adoptPtr(new ParsedPropertyVector))
, m_selectorListForParseSelector(0)
, m_numParsedPropertiesBeforeMarginBox(INVALID_NUM_PARSED_PROPERTIES)
, m_inParseShorthand(0)
@@ -263,6 +264,7 @@
, m_lastSelectorLineNumber(0)
, m_allowImportRules(true)
, m_allowNamespaceDeclarations(true)
+ , m_selectorVector(adoptPtr(new CSSSelectorVector))
{
#if YYDEBUG > 0
cssyydebug = 1;
@@ -1152,9 +1154,9 @@
bool ok = false;
if (m_hasFontFaceOnlyValues)
deleteFontFaceOnlyValues();
- if (!m_parsedProperties.isEmpty()) {
+ if (!m_parsedProperties->isEmpty()) {
ok = true;
- declaration->addParsedProperties(m_parsedProperties);
+ declaration->addParsedProperties(*m_parsedProperties);
clearProperties();
}
@@ -1175,7 +1177,7 @@
if (!parser.parseColor(string))
return false;
- CSSValue* value = parser.m_parsedProperties.first().value();
+ CSSValue* value = parser.m_parsedProperties->first().value();
if (!value->isPrimitiveValue())
return false;
@@ -1193,7 +1195,7 @@
cssyyparse(this);
m_rule = 0;
- return !m_parsedProperties.isEmpty() && m_parsedProperties.first().id() == CSSPropertyColor;
+ return !m_parsedProperties->isEmpty() && m_parsedProperties->first().id() == CSSPropertyColor;
}
bool CSSParser::parseSystemColor(RGBA32& color, const String& string, Document* document)
@@ -1243,9 +1245,9 @@
bool ok = false;
if (m_hasFontFaceOnlyValues)
deleteFontFaceOnlyValues();
- if (!m_parsedProperties.isEmpty()) {
+ if (!m_parsedProperties->isEmpty()) {
ok = true;
- declaration->addParsedProperties(m_parsedProperties);
+ declaration->addParsedProperties(*m_parsedProperties);
clearProperties();
}
@@ -1282,14 +1284,14 @@
}
#if ENABLE(CSS_VARIABLES)
-static inline void filterProperties(bool important, const CSSParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties, HashSet<AtomicString>& seenVariables)
+static inline void filterProperties(bool important, const CSSParser::ParsedPropertyVector* input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties, HashSet<AtomicString>& seenVariables)
#else
-static inline void filterProperties(bool important, const CSSParser::ParsedPropertyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties)
+static inline void filterProperties(bool important, const CSSParser::ParsedPropertyVector* input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitArray<numCSSProperties>& seenProperties)
#endif
{
// Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found.
- for (int i = input.size() - 1; i >= 0; --i) {
- const CSSProperty& property = input[i];
+ for (int i = input->size() - 1; i >= 0; --i) {
+ const CSSProperty& property = input->at(i);
if (property.isImportant() != important)
continue;
#if ENABLE(CSS_VARIABLES)
@@ -1313,17 +1315,17 @@
PassRefPtr<StylePropertySet> CSSParser::createStylePropertySet()
{
BitArray<numCSSProperties> seenProperties;
- size_t unusedEntries = m_parsedProperties.size();
+ size_t unusedEntries = m_parsedProperties->size();
Vector<CSSProperty, 256> results(unusedEntries);
// Important properties have higher priority, so add them first. Duplicate definitions can then be ignored when found.
#if ENABLE(CSS_VARIABLES)
HashSet<AtomicString> seenVariables;
- filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties, seenVariables);
- filterProperties(false, m_parsedProperties, results, unusedEntries, seenProperties, seenVariables);
+ filterProperties(true, m_parsedProperties.get(), results, unusedEntries, seenProperties, seenVariables);
+ filterProperties(false, m_parsedProperties.get(), results, unusedEntries, seenProperties, seenVariables);
#else
- filterProperties(true, m_parsedProperties, results, unusedEntries, seenProperties);
- filterProperties(false, m_parsedProperties, results, unusedEntries, seenProperties);
+ filterProperties(true, m_parsedProperties.get(), results, unusedEntries, seenProperties);
+ filterProperties(false, m_parsedProperties.get(), results, unusedEntries, seenProperties);
#endif
if (unusedEntries)
results.remove(0, unusedEntries);
@@ -1333,19 +1335,19 @@
void CSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
{
- m_parsedProperties.append(CSSProperty(propId, value, important, m_currentShorthand, m_implicitShorthand || implicit));
+ m_parsedProperties->append(CSSProperty(propId, value, important, m_currentShorthand, m_implicitShorthand || implicit));
}
void CSSParser::rollbackLastProperties(int num)
{
ASSERT(num >= 0);
- ASSERT(m_parsedProperties.size() >= static_cast<unsigned>(num));
- m_parsedProperties.shrink(m_parsedProperties.size() - num);
+ ASSERT(m_parsedProperties->size() >= static_cast<unsigned>(num));
+ m_parsedProperties->shrink(m_parsedProperties->size() - num);
}
void CSSParser::clearProperties()
{
- m_parsedProperties.clear();
+ m_parsedProperties->clear();
m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES;
m_hasFontFaceOnlyValues = false;
}
@@ -1761,7 +1763,7 @@
ShorthandScope scope(this, propId);
if (num != 1 || !parseValue(CSSPropertyOverflowX, important))
return false;
- CSSValue* value = m_parsedProperties.last().value();
+ CSSValue* value = m_parsedProperties->last().value();
addProperty(CSSPropertyOverflowY, value, important);
return true;
}
@@ -1784,7 +1786,7 @@
ShorthandScope scope(this, CSSPropertyBorderSpacing);
if (!parseValue(CSSPropertyWebkitBorderHorizontalSpacing, important))
return false;
- CSSValue* value = m_parsedProperties.last().value();
+ CSSValue* value = m_parsedProperties->last().value();
addProperty(CSSPropertyWebkitBorderVerticalSpacing, value, important);
return true;
}
@@ -2411,7 +2413,7 @@
ShorthandScope scope(this, CSSPropertyWebkitMarginCollapse);
if (!parseValue(webkitMarginCollapseShorthand().properties()[0], important))
return false;
- CSSValue* value = m_parsedProperties.last().value();
+ CSSValue* value = m_parsedProperties->last().value();
addProperty(webkitMarginCollapseShorthand().properties()[1], value, important);
return true;
}
@@ -3244,7 +3246,7 @@
case 1: {
if (!parseValue(properties[0], important))
return false;
- CSSValue *value = m_parsedProperties.last().value();
+ CSSValue* value = m_parsedProperties->last().value();
ImplicitScope implicitScope(this, PropertyImplicit);
addProperty(properties[1], value, important);
addProperty(properties[2], value, important);
@@ -3254,17 +3256,17 @@
case 2: {
if (!parseValue(properties[0], important) || !parseValue(properties[1], important))
return false;
- CSSValue *value = m_parsedProperties[m_parsedProperties.size() - 2].value();
+ CSSValue* value = m_parsedProperties->at(m_parsedProperties->size() - 2).value();
ImplicitScope implicitScope(this, PropertyImplicit);
addProperty(properties[2], value, important);
- value = m_parsedProperties[m_parsedProperties.size() - 2].value();
+ value = m_parsedProperties->at(m_parsedProperties->size() - 2).value();
addProperty(properties[3], value, important);
break;
}
case 3: {
if (!parseValue(properties[0], important) || !parseValue(properties[1], important) || !parseValue(properties[2], important))
return false;
- CSSValue *value = m_parsedProperties[m_parsedProperties.size() - 2].value();
+ CSSValue* value = m_parsedProperties->at(m_parsedProperties->size() - 2).value();
ImplicitScope implicitScope(this, PropertyImplicit);
addProperty(properties[3], value, important);
break;
@@ -7768,7 +7770,7 @@
m_rule = 0;
- return ((m_parsedProperties.size() == 1) && (m_parsedProperties.first().id() == CSSPropertyWebkitFlowInto));
+ return ((m_parsedProperties->size() == 1) && (m_parsedProperties->first().id() == CSSPropertyWebkitFlowInto));
}
// none | <ident>
@@ -7916,8 +7918,8 @@
{
// The text-decoration-line property takes priority over text-decoration, unless the latter has important priority set.
if (propId == CSSPropertyTextDecoration && !important && m_currentShorthand == CSSPropertyInvalid) {
- for (unsigned i = 0; i < m_parsedProperties.size(); ++i) {
- if (m_parsedProperties[i].id() == CSSPropertyWebkitTextDecorationLine)
+ for (unsigned i = 0; i < m_parsedProperties->size(); ++i) {
+ if (m_parsedProperties->at(i).id() == CSSPropertyWebkitTextDecorationLine)
return;
}
}
@@ -9477,14 +9479,14 @@
return adoptPtr(selector);
}
-Vector<OwnPtr<CSSParserSelector> >* CSSParser::createFloatingSelectorVector()
+CSSSelectorVector* CSSParser::createFloatingSelectorVector()
{
- Vector<OwnPtr<CSSParserSelector> >* selectorVector = new Vector<OwnPtr<CSSParserSelector> >;
+ CSSSelectorVector* selectorVector = new CSSSelectorVector;
m_floatingSelectorVectors.add(selectorVector);
return selectorVector;
}
-PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > CSSParser::sinkFloatingSelectorVector(Vector<OwnPtr<CSSParserSelector> >* selectorVector)
+PassOwnPtr<CSSSelectorVector > CSSParser::sinkFloatingSelectorVector(CSSSelectorVector* selectorVector)
{
if (selectorVector) {
ASSERT(m_floatingSelectorVectors.contains(selectorVector));
@@ -9677,7 +9679,7 @@
return rulePtr;
}
-StyleRuleBase* CSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors)
+StyleRuleBase* CSSParser::createStyleRule(CSSSelectorVector* selectors)
{
StyleRule* result = 0;
if (selectors) {
@@ -9699,8 +9701,8 @@
StyleRuleBase* CSSParser::createFontFaceRule()
{
m_allowImportRules = m_allowNamespaceDeclarations = false;
- for (unsigned i = 0; i < m_parsedProperties.size(); ++i) {
- CSSProperty& property = m_parsedProperties[i];
+ for (unsigned i = 0; i < m_parsedProperties->size(); ++i) {
+ CSSProperty& property = m_parsedProperties->at(i);
if (property.id() == CSSPropertyFontVariant && property.value()->isPrimitiveValue())
property.wrapValueInCommaSeparatedList();
else if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) {
@@ -9791,7 +9793,7 @@
StyleRulePage* pageRule = 0;
if (pageSelector) {
RefPtr<StyleRulePage> rule = StyleRulePage::create();
- Vector<OwnPtr<CSSParserSelector> > selectorVector;
+ CSSSelectorVector selectorVector;
selectorVector.append(pageSelector);
rule->parserAdoptSelectorVector(selectorVector);
rule->setProperties(createStylePropertySet());
@@ -9803,7 +9805,7 @@
return pageRule;
}
-void CSSParser::setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSelector> >* selectors)
+void CSSParser::setReusableRegionSelectorVector(CSSSelectorVector* selectors)
{
if (selectors)
m_reusableRegionSelectorVector.swap(*selectors);
@@ -9839,22 +9841,22 @@
void CSSParser::startDeclarationsForMarginBox()
{
- m_numParsedPropertiesBeforeMarginBox = m_parsedProperties.size();
+ m_numParsedPropertiesBeforeMarginBox = m_parsedProperties->size();
}
void CSSParser::endDeclarationsForMarginBox()
{
- rollbackLastProperties(m_parsedProperties.size() - m_numParsedPropertiesBeforeMarginBox);
+ rollbackLastProperties(m_parsedProperties->size() - m_numParsedPropertiesBeforeMarginBox);
m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES;
}
void CSSParser::deleteFontFaceOnlyValues()
{
ASSERT(m_hasFontFaceOnlyValues);
- for (unsigned i = 0; i < m_parsedProperties.size();) {
- CSSProperty& property = m_parsedProperties[i];
+ for (unsigned i = 0; i < m_parsedProperties->size();) {
+ CSSProperty& property = m_parsedProperties->at(i);
if (property.id() == CSSPropertyFontVariant && property.value()->isValueList()) {
- m_parsedProperties.remove(i);
+ m_parsedProperties->remove(i);
continue;
}
++i;
Modified: trunk/Source/WebCore/css/CSSParser.h (125251 => 125252)
--- trunk/Source/WebCore/css/CSSParser.h 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/CSSParser.h 2012-08-10 05:14:13 UTC (rev 125252)
@@ -87,7 +87,7 @@
void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
void rollbackLastProperties(int num);
- bool hasProperties() const { return !m_parsedProperties.isEmpty(); }
+ bool hasProperties() const { return !m_parsedProperties->isEmpty(); }
bool parseValue(CSSPropertyID, bool important);
bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool important);
@@ -252,8 +252,8 @@
CSSParserSelector* createFloatingSelector();
PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*);
- Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector();
- PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(Vector<OwnPtr<CSSParserSelector> >*);
+ CSSSelectorVector* createFloatingSelectorVector();
+ PassOwnPtr<CSSSelectorVector> sinkFloatingSelectorVector(CSSSelectorVector*);
CSSParserValueList* createFloatingValueList();
PassOwnPtr<CSSParserValueList> sinkFloatingValueList(CSSParserValueList*);
@@ -271,10 +271,10 @@
typedef Vector<RefPtr<StyleRuleBase> > RuleList;
StyleRuleBase* createMediaRule(MediaQuerySet*, RuleList*);
RuleList* createRuleList();
- StyleRuleBase* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors);
+ StyleRuleBase* createStyleRule(CSSSelectorVector* selectors);
StyleRuleBase* createFontFaceRule();
StyleRuleBase* createPageRule(PassOwnPtr<CSSParserSelector> pageSelector);
- StyleRuleBase* createRegionRule(Vector<OwnPtr<CSSParserSelector> >* regionSelector, RuleList* rules);
+ StyleRuleBase* createRegionRule(CSSSelectorVector* regionSelector, RuleList* rules);
StyleRuleBase* createMarginAtRule(CSSSelector::MarginBoxType);
void startDeclarationsForMarginBox();
void endDeclarationsForMarginBox();
@@ -297,10 +297,10 @@
void invalidBlockHit();
- Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reusableSelectorVector; }
+ CSSSelectorVector* selectorVector() { return m_selectorVector.get(); }
- void setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSelector> >* selectors);
- Vector<OwnPtr<CSSParserSelector> >* reusableRegionSelectorVector() { return &m_reusableRegionSelectorVector; }
+ void setReusableRegionSelectorVector(CSSSelectorVector* selectors);
+ CSSSelectorVector* reusableRegionSelectorVector() { return &m_reusableRegionSelectorVector; }
void updateLastSelectorLineAndPosition();
void updateLastMediaLine(MediaQuerySet*);
@@ -318,8 +318,9 @@
RefPtr<StyleKeyframe> m_keyframe;
OwnPtr<MediaQuery> m_mediaQuery;
OwnPtr<CSSParserValueList> m_valueList;
+
typedef Vector<CSSProperty, 256> ParsedPropertyVector;
- ParsedPropertyVector m_parsedProperties;
+ OwnPtr<ParsedPropertyVector> m_parsedProperties;
CSSSelectorList* m_selectorListForParseSelector;
unsigned m_numParsedPropertiesBeforeMarginBox;
@@ -441,7 +442,7 @@
Vector<RefPtr<MediaQuerySet> > m_parsedMediaQuerySets;
Vector<OwnPtr<RuleList> > m_parsedRuleLists;
HashSet<CSSParserSelector*> m_floatingSelectors;
- HashSet<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors;
+ HashSet<CSSSelectorVector*> m_floatingSelectorVectors;
HashSet<CSSParserValueList*> m_floatingValueLists;
HashSet<CSSParserFunction*> m_floatingFunctions;
@@ -451,8 +452,8 @@
OwnPtr<Vector<RefPtr<StyleKeyframe> > > m_floatingKeyframeVector;
- Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector;
- Vector<OwnPtr<CSSParserSelector> > m_reusableRegionSelectorVector;
+ OwnPtr<CSSSelectorVector> m_selectorVector;
+ CSSSelectorVector m_reusableRegionSelectorVector;
RefPtr<CSSCalcValue> m_parsedCalculation;
Modified: trunk/Source/WebCore/css/CSSParserValues.cpp (125251 => 125252)
--- trunk/Source/WebCore/css/CSSParserValues.cpp 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/CSSParserValues.cpp 2012-08-10 05:14:13 UTC (rev 125252)
@@ -114,7 +114,7 @@
}
}
-void CSSParserSelector::adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector)
+void CSSParserSelector::adoptSelectorVector(CSSSelectorVector& selectorVector)
{
CSSSelectorList* selectorList = fastNew<CSSSelectorList>();
selectorList->adoptSelectorVector(selectorVector);
Modified: trunk/Source/WebCore/css/CSSParserValues.h (125251 => 125252)
--- trunk/Source/WebCore/css/CSSParserValues.h 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/CSSParserValues.h 2012-08-10 05:14:13 UTC (rev 125252)
@@ -104,6 +104,10 @@
OwnPtr<CSSParserValueList> args;
};
+class CSSParserSelector;
+
+typedef Vector<OwnPtr<CSSParserSelector> > CSSSelectorVector;
+
class CSSParserSelector {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -120,7 +124,7 @@
void setRelation(CSSSelector::Relation value) { m_selector->m_relation = value; }
void setForPage() { m_selector->setForPage(); }
- void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector);
+ void adoptSelectorVector(CSSSelectorVector&);
CSSSelector::PseudoType pseudoType() const { return m_selector->pseudoType(); }
bool isUnknownPseudoElement() const { return m_selector->isUnknownPseudoElement(); }
Modified: trunk/Source/WebCore/css/CSSSelectorList.cpp (125251 => 125252)
--- trunk/Source/WebCore/css/CSSSelectorList.cpp 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/CSSSelectorList.cpp 2012-08-10 05:14:13 UTC (rev 125252)
@@ -58,7 +58,7 @@
list.m_selectorArray = 0;
}
-void CSSSelectorList::adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector)
+void CSSSelectorList::adoptSelectorVector(CSSSelectorVector& selectorVector)
{
deleteSelectors();
const size_t vectorSize = selectorVector.size();
Modified: trunk/Source/WebCore/css/CSSSelectorList.h (125251 => 125252)
--- trunk/Source/WebCore/css/CSSSelectorList.h 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/CSSSelectorList.h 2012-08-10 05:14:13 UTC (rev 125252)
@@ -26,6 +26,7 @@
#ifndef CSSSelectorList_h
#define CSSSelectorList_h
+#include "CSSParserValues.h"
#include "CSSSelector.h"
namespace WebCore {
@@ -42,7 +43,7 @@
~CSSSelectorList();
void adopt(CSSSelectorList& list);
- void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector);
+ void adoptSelectorVector(CSSSelectorVector&);
CSSSelector* first() const { return m_selectorArray ? m_selectorArray : 0; }
static CSSSelector* next(CSSSelector*);
Modified: trunk/Source/WebCore/css/SVGCSSParser.cpp (125251 => 125252)
--- trunk/Source/WebCore/css/SVGCSSParser.cpp 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/SVGCSSParser.cpp 2012-08-10 05:14:13 UTC (rev 125252)
@@ -281,7 +281,7 @@
rollbackLastProperties(1);
return false;
}
- CSSValue* value = m_parsedProperties.last().value();
+ CSSValue* value = m_parsedProperties->last().value();
addProperty(CSSPropertyMarkerMid, value, important);
addProperty(CSSPropertyMarkerEnd, value, important);
m_implicitShorthand = false;
Modified: trunk/Source/WebCore/css/StyleRule.cpp (125251 => 125252)
--- trunk/Source/WebCore/css/StyleRule.cpp 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/StyleRule.cpp 2012-08-10 05:14:13 UTC (rev 125252)
@@ -359,7 +359,7 @@
info.addInstrumentedMember(m_mediaQueries);
}
-StyleRuleRegion::StyleRuleRegion(Vector<OwnPtr<CSSParserSelector> >* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules)
+StyleRuleRegion::StyleRuleRegion(CSSSelectorVector* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules)
: StyleRuleBlock(Region, adoptRules)
{
m_selectorList.adoptSelectorVector(*selectors);
Modified: trunk/Source/WebCore/css/StyleRule.h (125251 => 125252)
--- trunk/Source/WebCore/css/StyleRule.h 2012-08-10 05:12:51 UTC (rev 125251)
+++ trunk/Source/WebCore/css/StyleRule.h 2012-08-10 05:14:13 UTC (rev 125252)
@@ -100,7 +100,7 @@
const StylePropertySet* properties() const { return m_properties.get(); }
StylePropertySet* mutableProperties();
- void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); }
+ void parserAdoptSelectorVector(CSSSelectorVector& selectors) { m_selectorList.adoptSelectorVector(selectors); }
void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.adopt(selectors); }
void setProperties(PassRefPtr<StylePropertySet>);
@@ -149,7 +149,7 @@
const StylePropertySet* properties() const { return m_properties.get(); }
StylePropertySet* mutableProperties();
- void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); }
+ void parserAdoptSelectorVector(CSSSelectorVector& selectors) { m_selectorList.adoptSelectorVector(selectors); }
void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.adopt(selectors); }
void setProperties(PassRefPtr<StylePropertySet>);
@@ -204,7 +204,7 @@
class StyleRuleRegion : public StyleRuleBlock {
public:
- static PassRefPtr<StyleRuleRegion> create(Vector<OwnPtr<CSSParserSelector> >* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules)
+ static PassRefPtr<StyleRuleRegion> create(CSSSelectorVector* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules)
{
return adoptRef(new StyleRuleRegion(selectors, adoptRules));
}
@@ -216,7 +216,7 @@
void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
private:
- StyleRuleRegion(Vector<OwnPtr<CSSParserSelector> >*, Vector<RefPtr<StyleRuleBase> >& adoptRules);
+ StyleRuleRegion(CSSSelectorVector*, Vector<RefPtr<StyleRuleBase> >& adoptRules);
StyleRuleRegion(const StyleRuleRegion&);
CSSSelectorList m_selectorList;
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo/webkit-changes
