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

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: incorporating 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 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 return cssValuePool().createIdentifierValue(CSSValueBold); 1535 return cssValuePool().createIdentifierValue(CSSValueBold);
1536 case FontWeight800: 1536 case FontWeight800:
1537 return cssValuePool().createIdentifierValue(CSSValue800); 1537 return cssValuePool().createIdentifierValue(CSSValue800);
1538 case FontWeight900: 1538 case FontWeight900:
1539 return cssValuePool().createIdentifierValue(CSSValue900); 1539 return cssValuePool().createIdentifierValue(CSSValue900);
1540 } 1540 }
1541 ASSERT_NOT_REACHED(); 1541 ASSERT_NOT_REACHED();
1542 return cssValuePool().createIdentifierValue(CSSValueNormal); 1542 return cssValuePool().createIdentifierValue(CSSValueNormal);
1543 } 1543 }
1544 1544
1545 static PassRefPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction touchAction)
1546 {
1547 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1548 if (touchAction & TouchActionNone) {
1549 ASSERT(!(list->length()));
Rick Byers 2013/12/12 15:30:35 This is trivially true. I think you can simplify
gnana 2013/12/13 11:10:54 Done.
1550 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
1551 }
1552 if (touchAction & TouchActionAuto) {
Rick Byers 2013/12/12 15:30:35 The way you've defined it (which I think is reason
gnana 2013/12/13 11:10:54 Done.
1553 ASSERT(!(list->length()));
1554 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
1555 }
1556 if (touchAction & TouchActionPanX) {
1557 ASSERT(!(list->length() && !(list->hasValue(cssValuePool().createIdentif ierValue(CSSValuePanY).get()))));
1558 list->append(cssValuePool().createIdentifierValue(CSSValuePanX));
1559 }
1560 if (touchAction & TouchActionPanY) {
1561 ASSERT(!(list->length() && !(list->hasValue(cssValuePool().createIdentif ierValue(CSSValuePanX).get()))));
1562 list->append(cssValuePool().createIdentifierValue(CSSValuePanY));
1563 }
1564
1565 if (!list->length())
Rick Byers 2013/12/12 15:30:35 When the above is fixed, you should be able to ass
gnana 2013/12/13 11:10:54 Done.
1566 return cssValuePool().createIdentifierValue(CSSValueAuto);
1567 return list.release();
1568 }
1569
1545 static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle> style, RenderObject* renderer) 1570 static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle> style, RenderObject* renderer)
1546 { 1571 {
1547 // Some properties only depend on layout in certain conditions which 1572 // Some properties only depend on layout in certain conditions which
1548 // are specified in the main switch statement below. So we can avoid 1573 // are specified in the main switch statement below. So we can avoid
1549 // forcing layout in those conditions. The conditions in this switch 1574 // forcing layout in those conditions. The conditions in this switch
1550 // statement must remain in sync with the conditions in the main switch. 1575 // statement must remain in sync with the conditions in the main switch.
1551 // FIXME: Some of these cases could be narrowed down or optimized better. 1576 // FIXME: Some of these cases could be narrowed down or optimized better.
1552 switch (propertyID) { 1577 switch (propertyID) {
1553 case CSSPropertyBottom: 1578 case CSSPropertyBottom:
1554 case CSSPropertyGridDefinitionColumns: 1579 case CSSPropertyGridDefinitionColumns:
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 return cssValuePool().createValue(style->textSecurity()); 2334 return cssValuePool().createValue(style->textSecurity());
2310 case CSSPropertyWebkitTextStrokeColor: 2335 case CSSPropertyWebkitTextStrokeColor:
2311 return currentColorOrValidColor(*style, style->textStrokeColor()); 2336 return currentColorOrValidColor(*style, style->textStrokeColor());
2312 case CSSPropertyWebkitTextStrokeWidth: 2337 case CSSPropertyWebkitTextStrokeWidth:
2313 return zoomAdjustedPixelValue(style->textStrokeWidth(), *style); 2338 return zoomAdjustedPixelValue(style->textStrokeWidth(), *style);
2314 case CSSPropertyTextTransform: 2339 case CSSPropertyTextTransform:
2315 return cssValuePool().createValue(style->textTransform()); 2340 return cssValuePool().createValue(style->textTransform());
2316 case CSSPropertyTop: 2341 case CSSPropertyTop:
2317 return valueForPositionOffset(*style, CSSPropertyTop, renderer, m_no de->document().renderView()); 2342 return valueForPositionOffset(*style, CSSPropertyTop, renderer, m_no de->document().renderView());
2318 case CSSPropertyTouchAction: 2343 case CSSPropertyTouchAction:
2319 return cssValuePool().createValue(style->touchAction()); 2344 return touchActionFlagsToCSSValue(style->touchAction());
2320 case CSSPropertyTouchActionDelay: 2345 case CSSPropertyTouchActionDelay:
2321 return cssValuePool().createValue(style->touchActionDelay()); 2346 return cssValuePool().createValue(style->touchActionDelay());
2322 case CSSPropertyUnicodeBidi: 2347 case CSSPropertyUnicodeBidi:
2323 return cssValuePool().createValue(style->unicodeBidi()); 2348 return cssValuePool().createValue(style->unicodeBidi());
2324 case CSSPropertyVerticalAlign: 2349 case CSSPropertyVerticalAlign:
2325 switch (style->verticalAlign()) { 2350 switch (style->verticalAlign()) {
2326 case BASELINE: 2351 case BASELINE:
2327 return cssValuePool().createIdentifierValue(CSSValueBaseline ); 2352 return cssValuePool().createIdentifierValue(CSSValueBaseline );
2328 case MIDDLE: 2353 case MIDDLE:
2329 return cssValuePool().createIdentifierValue(CSSValueMiddle); 2354 return cssValuePool().createIdentifierValue(CSSValueMiddle);
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3255 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3231 CSSPropertyB ackgroundClip }; 3256 CSSPropertyB ackgroundClip };
3232 3257
3233 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3258 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3234 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)))); 3259 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator))));
3235 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)))); 3260 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator))));
3236 return list.release(); 3261 return list.release();
3237 } 3262 }
3238 3263
3239 } // namespace WebCore 3264 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698