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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 1696373003: Add CSS parser support for the snap-height property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // <page-size> 367 // <page-size>
368 pageSizeType = PAGE_SIZE_RESOLVED; 368 pageSizeType = PAGE_SIZE_RESOLVED;
369 size = getPageSizeFromName(primitiveValue); 369 size = getPageSizeFromName(primitiveValue);
370 } 370 }
371 } 371 }
372 } 372 }
373 state.style()->setPageSizeType(pageSizeType); 373 state.style()->setPageSizeType(pageSizeType);
374 state.style()->setPageSize(size); 374 state.style()->setPageSize(size);
375 } 375 }
376 376
377 void StyleBuilderFunctions::applyInitialCSSPropertySnapHeight(StyleResolverState & state)
378 {
379 state.style()->setSnapHeightUnit(0);
380 state.style()->setSnapHeightPosition(0);
381 }
382
383 void StyleBuilderFunctions::applyInheritCSSPropertySnapHeight(StyleResolverState & state)
384 {
385 state.style()->setSnapHeightUnit(state.parentStyle()->snapHeightUnit());
386 state.style()->setSnapHeightPosition(state.parentStyle()->snapHeightPosition ());
387 }
388
389 void StyleBuilderFunctions::applyValueCSSPropertySnapHeight(StyleResolverState& state, CSSValue* value)
390 {
391 CSSValueList* list = toCSSValueList(value);
392 CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0));
393 ASSERT(first->isLength());
394 int unit = first->computeLength<int>(state.cssToLengthConversionData());
395 ASSERT(unit >= 0);
396 state.style()->setSnapHeightUnit(clampTo<uint8_t>(unit));
397
398 if (list->length() == 1) {
399 state.style()->setSnapHeightPosition(0);
400 return;
401 }
402
403 ASSERT(list->length() == 2);
404 CSSPrimitiveValue* second = toCSSPrimitiveValue(list->item(1));
405 ASSERT(second->isNumber());
406 int position = second->getIntValue();
407 ASSERT(position > 0 && position <= 100);
408 state.style()->setSnapHeightPosition(position);
409 }
410
377 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& s tate, CSSValue* value) 411 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& s tate, CSSValue* value)
378 { 412 {
379 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 413 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
380 if (primitiveValue->isValueID() && primitiveValue->getValueID() != CSSValueW ebkitMatchParent) 414 if (primitiveValue->isValueID() && primitiveValue->getValueID() != CSSValueW ebkitMatchParent)
381 state.style()->setTextAlign(primitiveValue->convertTo<ETextAlign>()); 415 state.style()->setTextAlign(primitiveValue->convertTo<ETextAlign>());
382 else if (state.parentStyle()->textAlign() == TASTART) 416 else if (state.parentStyle()->textAlign() == TASTART)
383 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection( ) ? LEFT : RIGHT); 417 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection( ) ? LEFT : RIGHT);
384 else if (state.parentStyle()->textAlign() == TAEND) 418 else if (state.parentStyle()->textAlign() == TAEND)
385 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection( ) ? RIGHT : LEFT); 419 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection( ) ? RIGHT : LEFT);
386 else 420 else
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 return; 836 return;
803 case CSSValueSuper: 837 case CSSValueSuper:
804 svgStyle.setBaselineShift(BS_SUPER); 838 svgStyle.setBaselineShift(BS_SUPER);
805 return; 839 return;
806 default: 840 default:
807 ASSERT_NOT_REACHED(); 841 ASSERT_NOT_REACHED();
808 } 842 }
809 } 843 }
810 844
811 } // namespace blink 845 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | third_party/WebKit/Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698