Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| index b05888320d1cd3c8d6466e194e666bb5468e660a..cdcb250dcaa0eb9b34c9573e0f09d57f35dcf30d 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -835,6 +835,46 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeClip(CSSParserTokenRange& range, |
| return CSSQuadValue::create(top.release(), right.release(), bottom.release(), left.release(), CSSQuadValue::SerializeAsRect); |
| } |
| +static bool consumePan(CSSParserTokenRange& range, RefPtrWillBeRawPtr<CSSValue>& panX, RefPtrWillBeRawPtr<CSSValue>& panY) |
| +{ |
| + CSSValueID id = range.peek().id(); |
| + if (id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft) { |
|
Timothy Loh
2015/10/14 23:45:45
Should we check if panX is null here (similar for
rwlbuis
2015/10/14 23:54:54
Yes, I think that is invalid. Below panX check sho
rwlbuis
2015/10/14 23:58:06
Ah, you mean add the check to the outer if(s) inst
Timothy Loh
2015/10/14 23:59:00
I actually didn't see it in the below if statement
|
| + if ((id != CSSValuePanX && !RuntimeEnabledFeatures::cssTouchActionPanDirectionsEnabled()) || panX) |
| + return false; |
| + panX = consumeIdent(range); |
| + } else if (id == CSSValuePanY || id == CSSValuePanDown || id == CSSValuePanUp) { |
| + if ((id != CSSValuePanY && !RuntimeEnabledFeatures::cssTouchActionPanDirectionsEnabled()) || panY) |
| + return false; |
| + panY = consumeIdent(range); |
| + } else { |
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| +static PassRefPtrWillBeRawPtr<CSSValue> consumeTouchAction(CSSParserTokenRange& range) |
| +{ |
| + RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| + CSSValueID id = range.peek().id(); |
| + if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueManipulation) { |
| + list->append(consumeIdent(range)); |
| + return list.release(); |
| + } |
| + |
| + RefPtrWillBeRawPtr<CSSValue> panX = nullptr; |
| + RefPtrWillBeRawPtr<CSSValue> panY = nullptr; |
| + if (!consumePan(range, panX, panY)) |
| + return nullptr; |
| + if (!range.atEnd() && !consumePan(range, panX, panY)) |
| + return nullptr; |
| + |
| + if (panX) |
| + list->append(panX.release()); |
| + if (panY) |
| + list->append(panY.release()); |
| + return list.release(); |
| +} |
| + |
| PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID propId) |
| { |
| m_range.consumeWhitespace(); |
| @@ -896,6 +936,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty |
| return consumeWidthOrHeight(m_range, m_context); |
| case CSSPropertyClip: |
| return consumeClip(m_range, m_context.mode()); |
| + case CSSPropertyTouchAction: |
| + return consumeTouchAction(m_range); |
| default: |
| return nullptr; |
| } |