Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: Source/core/css/CSSParser.cpp

Issue 15748002: Initial support for experimental touch-action CSS feature (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update for generated StyleBuilder just relanded in r150951 Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 202 }
203 203
204 CSSParserContext::CSSParserContext(CSSParserMode mode, const KURL& baseURL) 204 CSSParserContext::CSSParserContext(CSSParserMode mode, const KURL& baseURL)
205 : baseURL(baseURL) 205 : baseURL(baseURL)
206 , mode(mode) 206 , mode(mode)
207 , isHTMLDocument(false) 207 , isHTMLDocument(false)
208 , isCSSCustomFilterEnabled(false) 208 , isCSSCustomFilterEnabled(false)
209 , isCSSStickyPositionEnabled(false) 209 , isCSSStickyPositionEnabled(false)
210 , isCSSGridLayoutEnabled(false) 210 , isCSSGridLayoutEnabled(false)
211 , isCSSVariablesEnabled(false) 211 , isCSSVariablesEnabled(false)
212 , isCSSTouchActionEnabled(false)
212 , needsSiteSpecificQuirks(false) 213 , needsSiteSpecificQuirks(false)
213 { 214 {
214 } 215 }
215 216
216 CSSParserContext::CSSParserContext(Document* document, const KURL& baseURL, cons t String& charset) 217 CSSParserContext::CSSParserContext(Document* document, const KURL& baseURL, cons t String& charset)
217 : baseURL(baseURL.isNull() ? document->baseURL() : baseURL) 218 : baseURL(baseURL.isNull() ? document->baseURL() : baseURL)
218 , charset(charset) 219 , charset(charset)
219 , mode(document->inQuirksMode() ? CSSQuirksMode : CSSStrictMode) 220 , mode(document->inQuirksMode() ? CSSQuirksMode : CSSStrictMode)
220 , isHTMLDocument(document->isHTMLDocument()) 221 , isHTMLDocument(document->isHTMLDocument())
221 , isCSSCustomFilterEnabled(document->settings() ? document->settings()->isCS SCustomFilterEnabled() : false) 222 , isCSSCustomFilterEnabled(document->settings() ? document->settings()->isCS SCustomFilterEnabled() : false)
222 , isCSSStickyPositionEnabled(document->cssStickyPositionEnabled()) 223 , isCSSStickyPositionEnabled(document->cssStickyPositionEnabled())
223 , isCSSGridLayoutEnabled(document->cssGridLayoutEnabled()) 224 , isCSSGridLayoutEnabled(document->cssGridLayoutEnabled())
224 , isCSSVariablesEnabled(document->settings() ? document->settings()->cssVari ablesEnabled() : false) 225 , isCSSVariablesEnabled(document->settings() ? document->settings()->cssVari ablesEnabled() : false)
226 , isCSSTouchActionEnabled(RuntimeEnabledFeatures::cssTouchActionEnabled())
225 , needsSiteSpecificQuirks(document->settings() ? document->settings()->needs SiteSpecificQuirks() : false) 227 , needsSiteSpecificQuirks(document->settings() ? document->settings()->needs SiteSpecificQuirks() : false)
226 { 228 {
227 } 229 }
228 230
229 bool operator==(const CSSParserContext& a, const CSSParserContext& b) 231 bool operator==(const CSSParserContext& a, const CSSParserContext& b)
230 { 232 {
231 return a.baseURL == b.baseURL 233 return a.baseURL == b.baseURL
232 && a.charset == b.charset 234 && a.charset == b.charset
233 && a.mode == b.mode 235 && a.mode == b.mode
234 && a.isHTMLDocument == b.isHTMLDocument 236 && a.isHTMLDocument == b.isHTMLDocument
235 && a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled 237 && a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled
236 && a.isCSSStickyPositionEnabled == b.isCSSStickyPositionEnabled 238 && a.isCSSStickyPositionEnabled == b.isCSSStickyPositionEnabled
237 && a.isCSSGridLayoutEnabled == b.isCSSGridLayoutEnabled 239 && a.isCSSGridLayoutEnabled == b.isCSSGridLayoutEnabled
238 && a.isCSSVariablesEnabled == b.isCSSVariablesEnabled 240 && a.isCSSVariablesEnabled == b.isCSSVariablesEnabled
241 && a.isCSSTouchActionEnabled == b.isCSSTouchActionEnabled
239 && a.needsSiteSpecificQuirks == b.needsSiteSpecificQuirks; 242 && a.needsSiteSpecificQuirks == b.needsSiteSpecificQuirks;
240 } 243 }
241 244
242 CSSParser::CSSParser(const CSSParserContext& context, UseCounter* counter) 245 CSSParser::CSSParser(const CSSParserContext& context, UseCounter* counter)
243 : m_context(context) 246 : m_context(context)
244 , m_important(false) 247 , m_important(false)
245 , m_id(CSSPropertyInvalid) 248 , m_id(CSSPropertyInvalid)
246 , m_styleSheet(0) 249 , m_styleSheet(0)
247 , m_supportsCondition(false) 250 , m_supportsCondition(false)
248 , m_selectorListForParseSelector(0) 251 , m_selectorListForParseSelector(0)
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 return true; 704 return true;
702 break; 705 break;
703 case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision 706 case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision
704 if (valueID == CSSValueAuto || valueID == CSSValueOptimizespeed || value ID == CSSValueOptimizelegibility || valueID == CSSValueGeometricprecision) 707 if (valueID == CSSValueAuto || valueID == CSSValueOptimizespeed || value ID == CSSValueOptimizelegibility || valueID == CSSValueGeometricprecision)
705 return true; 708 return true;
706 break; 709 break;
707 case CSSPropertyTextTransform: // capitalize | uppercase | lowercase | none | inherit 710 case CSSPropertyTextTransform: // capitalize | uppercase | lowercase | none | inherit
708 if ((valueID >= CSSValueCapitalize && valueID <= CSSValueLowercase) || v alueID == CSSValueNone) 711 if ((valueID >= CSSValueCapitalize && valueID <= CSSValueLowercase) || v alueID == CSSValueNone)
709 return true; 712 return true;
710 break; 713 break;
714 case CSSPropertyTouchAction: // auto | none
715 if (parserContext.isCSSTouchActionEnabled && (valueID == CSSValueAuto || valueID == CSSValueNone))
716 return true;
717 break;
711 case CSSPropertyVisibility: // visible | hidden | collapse | inherit 718 case CSSPropertyVisibility: // visible | hidden | collapse | inherit
712 if (valueID == CSSValueVisible || valueID == CSSValueHidden || valueID = = CSSValueCollapse) 719 if (valueID == CSSValueVisible || valueID == CSSValueHidden || valueID = = CSSValueCollapse)
713 return true; 720 return true;
714 break; 721 break;
715 case CSSPropertyWebkitAppearance: 722 case CSSPropertyWebkitAppearance:
716 if ((valueID >= CSSValueCheckbox && valueID <= CSSValueTextarea) || valu eID == CSSValueNone) 723 if ((valueID >= CSSValueCheckbox && valueID <= CSSValueTextarea) || valu eID == CSSValueNone)
717 return true; 724 return true;
718 break; 725 break;
719 case CSSPropertyWebkitBackfaceVisibility: 726 case CSSPropertyWebkitBackfaceVisibility:
720 if (valueID == CSSValueVisible || valueID == CSSValueHidden) 727 if (valueID == CSSValueVisible || valueID == CSSValueHidden)
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 case CSSPropertyTableLayout: 970 case CSSPropertyTableLayout:
964 case CSSPropertyTextLineThroughMode: 971 case CSSPropertyTextLineThroughMode:
965 case CSSPropertyTextLineThroughStyle: 972 case CSSPropertyTextLineThroughStyle:
966 case CSSPropertyTextOverflow: 973 case CSSPropertyTextOverflow:
967 case CSSPropertyTextOverlineMode: 974 case CSSPropertyTextOverlineMode:
968 case CSSPropertyTextOverlineStyle: 975 case CSSPropertyTextOverlineStyle:
969 case CSSPropertyTextRendering: 976 case CSSPropertyTextRendering:
970 case CSSPropertyTextTransform: 977 case CSSPropertyTextTransform:
971 case CSSPropertyTextUnderlineMode: 978 case CSSPropertyTextUnderlineMode:
972 case CSSPropertyTextUnderlineStyle: 979 case CSSPropertyTextUnderlineStyle:
980 case CSSPropertyTouchAction:
973 case CSSPropertyVisibility: 981 case CSSPropertyVisibility:
974 case CSSPropertyWebkitAppearance: 982 case CSSPropertyWebkitAppearance:
975 case CSSPropertyWebkitBackfaceVisibility: 983 case CSSPropertyWebkitBackfaceVisibility:
976 case CSSPropertyWebkitBorderAfterStyle: 984 case CSSPropertyWebkitBorderAfterStyle:
977 case CSSPropertyWebkitBorderBeforeStyle: 985 case CSSPropertyWebkitBorderBeforeStyle:
978 case CSSPropertyWebkitBorderEndStyle: 986 case CSSPropertyWebkitBorderEndStyle:
979 case CSSPropertyWebkitBorderFit: 987 case CSSPropertyWebkitBorderFit:
980 case CSSPropertyWebkitBorderStartStyle: 988 case CSSPropertyWebkitBorderStartStyle:
981 case CSSPropertyWebkitBoxAlign: 989 case CSSPropertyWebkitBoxAlign:
982 case CSSPropertyWebkitBoxDecorationBreak: 990 case CSSPropertyWebkitBoxDecorationBreak:
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 case CSSPropertyTableLayout: 2770 case CSSPropertyTableLayout:
2763 case CSSPropertyTextLineThroughMode: 2771 case CSSPropertyTextLineThroughMode:
2764 case CSSPropertyTextLineThroughStyle: 2772 case CSSPropertyTextLineThroughStyle:
2765 case CSSPropertyTextOverflow: 2773 case CSSPropertyTextOverflow:
2766 case CSSPropertyTextOverlineMode: 2774 case CSSPropertyTextOverlineMode:
2767 case CSSPropertyTextOverlineStyle: 2775 case CSSPropertyTextOverlineStyle:
2768 case CSSPropertyTextRendering: 2776 case CSSPropertyTextRendering:
2769 case CSSPropertyTextTransform: 2777 case CSSPropertyTextTransform:
2770 case CSSPropertyTextUnderlineMode: 2778 case CSSPropertyTextUnderlineMode:
2771 case CSSPropertyTextUnderlineStyle: 2779 case CSSPropertyTextUnderlineStyle:
2780 case CSSPropertyTouchAction:
2772 case CSSPropertyVariable: 2781 case CSSPropertyVariable:
2773 case CSSPropertyVisibility: 2782 case CSSPropertyVisibility:
2774 case CSSPropertyWebkitAppearance: 2783 case CSSPropertyWebkitAppearance:
2775 case CSSPropertyWebkitBackfaceVisibility: 2784 case CSSPropertyWebkitBackfaceVisibility:
2776 case CSSPropertyWebkitBorderAfterStyle: 2785 case CSSPropertyWebkitBorderAfterStyle:
2777 case CSSPropertyWebkitBorderBeforeStyle: 2786 case CSSPropertyWebkitBorderBeforeStyle:
2778 case CSSPropertyWebkitBorderEndStyle: 2787 case CSSPropertyWebkitBorderEndStyle:
2779 case CSSPropertyWebkitBorderFit: 2788 case CSSPropertyWebkitBorderFit:
2780 case CSSPropertyWebkitBorderStartStyle: 2789 case CSSPropertyWebkitBorderStartStyle:
2781 case CSSPropertyWebkitBoxAlign: 2790 case CSSPropertyWebkitBoxAlign:
(...skipping 8929 matching lines...) Expand 10 before | Expand all | Expand 10 after
11711 result.lineNumber = lineNumber; 11720 result.lineNumber = lineNumber;
11712 result.content = content; 11721 result.content = content;
11713 size_t newLength = content.length(); 11722 size_t newLength = content.length();
11714 while (newLength > 0 && isHTMLSpace(result.content[newLength - 1])) 11723 while (newLength > 0 && isHTMLSpace(result.content[newLength - 1]))
11715 --newLength; 11724 --newLength;
11716 result.content.setLength(newLength); 11725 result.content.setLength(newLength);
11717 return result; 11726 return result;
11718 } 11727 }
11719 11728
11720 } 11729 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698