Title: [136525] trunk/Source/WebCore
- Revision
- 136525
- Author
- [email protected]
- Date
- 2012-12-04 10:24:45 -0800 (Tue, 04 Dec 2012)
Log Message
Add an helper function in CSSParser to check for '/' character.
https://bugs.webkit.org/show_bug.cgi?id=104009
Reviewed by Ryosuke Niwa.
I'm about to add the same pattern in a following patch. Let's do an
helper function first. We also did that for the comma. The slash
character is pretty used in shorthands definitions.
No new tests : just a refactor, existing tests should cover.
* css/CSSParser.cpp:
(WebCore::isForwardSlashOperator):
(WebCore):
(WebCore::CSSParser::parseFillShorthand):
(WebCore::CSSParser::parseFont):
(WebCore::CSSParser::parseBorderImage):
(WebCore::CSSParser::parseAspectRatio):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (136524 => 136525)
--- trunk/Source/WebCore/ChangeLog 2012-12-04 18:22:55 UTC (rev 136524)
+++ trunk/Source/WebCore/ChangeLog 2012-12-04 18:24:45 UTC (rev 136525)
@@ -1,3 +1,24 @@
+2012-12-04 Alexis Menard <[email protected]>
+
+ Add an helper function in CSSParser to check for '/' character.
+ https://bugs.webkit.org/show_bug.cgi?id=104009
+
+ Reviewed by Ryosuke Niwa.
+
+ I'm about to add the same pattern in a following patch. Let's do an
+ helper function first. We also did that for the comma. The slash
+ character is pretty used in shorthands definitions.
+
+ No new tests : just a refactor, existing tests should cover.
+
+ * css/CSSParser.cpp:
+ (WebCore::isForwardSlashOperator):
+ (WebCore):
+ (WebCore::CSSParser::parseFillShorthand):
+ (WebCore::CSSParser::parseFont):
+ (WebCore::CSSParser::parseBorderImage):
+ (WebCore::CSSParser::parseAspectRatio):
+
2012-12-04 Ken Kania <[email protected]>
Inspector: Introduce Input.dispatchKeyEvent and DOM.focus for typing simulation.
Modified: trunk/Source/WebCore/css/CSSParser.cpp (136524 => 136525)
--- trunk/Source/WebCore/css/CSSParser.cpp 2012-12-04 18:22:55 UTC (rev 136524)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2012-12-04 18:24:45 UTC (rev 136525)
@@ -1652,6 +1652,11 @@
return value && value->unit == CSSParserValue::Operator && value->iValue == ',';
}
+static inline bool isForwardSlashOperator(CSSParserValue* value)
+{
+ return value && value->unit == CSSParserValue::Operator && value->iValue == '/';
+}
+
bool CSSParser::validWidth(CSSParserValue* value)
{
int id = value->id;
@@ -3001,7 +3006,7 @@
}
bool sizeCSSPropertyExpected = false;
- if ((val->unit == CSSParserValue::Operator && val->iValue == '/') && foundPositionCSSProperty) {
+ if (isForwardSlashOperator(val) && foundPositionCSSProperty) {
sizeCSSPropertyExpected = true;
m_valueList->next();
}
@@ -5080,7 +5085,7 @@
if (!value)
return false;
- if (value->unit == CSSParserValue::Operator && value->iValue == '/') {
+ if (isForwardSlashOperator(value)) {
// The line-height property.
value = m_valueList->next();
if (!value)
@@ -6371,7 +6376,7 @@
while (CSSParserValue* val = m_valueList->current()) {
context.setCanAdvance(false);
- if (!context.canAdvance() && context.allowSlash() && val->unit == CSSParserValue::Operator && val->iValue == '/')
+ if (!context.canAdvance() && context.allowSlash() && isForwardSlashOperator(val))
context.commitSlash();
if (!context.canAdvance() && context.allowImage()) {
@@ -6787,7 +6792,7 @@
CSSParserValue* op = m_valueList->valueAt(1);
CSSParserValue* rvalue = m_valueList->valueAt(2);
- if (op->unit != CSSParserValue::Operator || op->iValue != '/')
+ if (!isForwardSlashOperator(op))
return false;
if (!validUnit(lvalue, FNumber | FNonNeg) || !validUnit(rvalue, FNumber | FNonNeg))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes