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

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

Issue 87973002: add pan-x and pan-y support to CSS touch-action parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated review comments Created 7 years 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) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 return cssValuePool().createIdentifierValue(CSSValueBold); 1540 return cssValuePool().createIdentifierValue(CSSValueBold);
1541 case FontWeight800: 1541 case FontWeight800:
1542 return cssValuePool().createIdentifierValue(CSSValue800); 1542 return cssValuePool().createIdentifierValue(CSSValue800);
1543 case FontWeight900: 1543 case FontWeight900:
1544 return cssValuePool().createIdentifierValue(CSSValue900); 1544 return cssValuePool().createIdentifierValue(CSSValue900);
1545 } 1545 }
1546 ASSERT_NOT_REACHED(); 1546 ASSERT_NOT_REACHED();
1547 return cssValuePool().createIdentifierValue(CSSValueNormal); 1547 return cssValuePool().createIdentifierValue(CSSValueNormal);
1548 } 1548 }
1549 1549
1550 static PassRefPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction touchAction)
1551 {
1552 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1553 if (touchAction == TouchActionAuto) {
1554 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
1555 }
1556 if (touchAction & TouchActionNone) {
1557 ASSERT(touchAction == TouchActionNone);
1558 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
1559 }
1560 if (touchAction & TouchActionPanX) {
1561 list->append(cssValuePool().createIdentifierValue(CSSValuePanX));
1562 }
1563 if (touchAction & TouchActionPanY) {
1564 list->append(cssValuePool().createIdentifierValue(CSSValuePanY));
1565 }
1566
1567 if (!list->length()) {
1568 ASSERT(false);
1569 return cssValuePool().createIdentifierValue(CSSValueAuto);
Rick Byers 2013/12/13 13:34:23 nit: just remove this whole if block and just ASSE
gnana 2013/12/13 17:06:23 Done.
1570 }
1571 return list.release();
1572 }
1573
1550 static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle> style, RenderObject* renderer) 1574 static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle> style, RenderObject* renderer)
1551 { 1575 {
1552 // Some properties only depend on layout in certain conditions which 1576 // Some properties only depend on layout in certain conditions which
1553 // are specified in the main switch statement below. So we can avoid 1577 // are specified in the main switch statement below. So we can avoid
1554 // forcing layout in those conditions. The conditions in this switch 1578 // forcing layout in those conditions. The conditions in this switch
1555 // statement must remain in sync with the conditions in the main switch. 1579 // statement must remain in sync with the conditions in the main switch.
1556 // FIXME: Some of these cases could be narrowed down or optimized better. 1580 // FIXME: Some of these cases could be narrowed down or optimized better.
1557 switch (propertyID) { 1581 switch (propertyID) {
1558 case CSSPropertyBottom: 1582 case CSSPropertyBottom:
1559 case CSSPropertyGridDefinitionColumns: 1583 case CSSPropertyGridDefinitionColumns:
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 return cssValuePool().createValue(style->textSecurity()); 2338 return cssValuePool().createValue(style->textSecurity());
2315 case CSSPropertyWebkitTextStrokeColor: 2339 case CSSPropertyWebkitTextStrokeColor:
2316 return currentColorOrValidColor(*style, style->textStrokeColor()); 2340 return currentColorOrValidColor(*style, style->textStrokeColor());
2317 case CSSPropertyWebkitTextStrokeWidth: 2341 case CSSPropertyWebkitTextStrokeWidth:
2318 return zoomAdjustedPixelValue(style->textStrokeWidth(), *style); 2342 return zoomAdjustedPixelValue(style->textStrokeWidth(), *style);
2319 case CSSPropertyTextTransform: 2343 case CSSPropertyTextTransform:
2320 return cssValuePool().createValue(style->textTransform()); 2344 return cssValuePool().createValue(style->textTransform());
2321 case CSSPropertyTop: 2345 case CSSPropertyTop:
2322 return valueForPositionOffset(*style, CSSPropertyTop, renderer, m_no de->document().renderView()); 2346 return valueForPositionOffset(*style, CSSPropertyTop, renderer, m_no de->document().renderView());
2323 case CSSPropertyTouchAction: 2347 case CSSPropertyTouchAction:
2324 return cssValuePool().createValue(style->touchAction()); 2348 return touchActionFlagsToCSSValue(style->touchAction());
2325 case CSSPropertyTouchActionDelay: 2349 case CSSPropertyTouchActionDelay:
2326 return cssValuePool().createValue(style->touchActionDelay()); 2350 return cssValuePool().createValue(style->touchActionDelay());
2327 case CSSPropertyUnicodeBidi: 2351 case CSSPropertyUnicodeBidi:
2328 return cssValuePool().createValue(style->unicodeBidi()); 2352 return cssValuePool().createValue(style->unicodeBidi());
2329 case CSSPropertyVerticalAlign: 2353 case CSSPropertyVerticalAlign:
2330 switch (style->verticalAlign()) { 2354 switch (style->verticalAlign()) {
2331 case BASELINE: 2355 case BASELINE:
2332 return cssValuePool().createIdentifierValue(CSSValueBaseline ); 2356 return cssValuePool().createIdentifierValue(CSSValueBaseline );
2333 case MIDDLE: 2357 case MIDDLE:
2334 return cssValuePool().createIdentifierValue(CSSValueMiddle); 2358 return cssValuePool().createIdentifierValue(CSSValueMiddle);
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
3235 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3259 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3236 CSSPropertyB ackgroundClip }; 3260 CSSPropertyB ackgroundClip };
3237 3261
3238 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3262 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3239 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)))); 3263 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator))));
3240 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)))); 3264 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator))));
3241 return list.release(); 3265 return list.release();
3242 } 3266 }
3243 3267
3244 } // namespace WebCore 3268 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698