OLD | NEW |
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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 8 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
9 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 9 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
10 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // <page-size> | 419 // <page-size> |
420 pageSizeType = PAGE_SIZE_RESOLVED; | 420 pageSizeType = PAGE_SIZE_RESOLVED; |
421 size = getPageSizeFromName(ident); | 421 size = getPageSizeFromName(ident); |
422 } | 422 } |
423 } | 423 } |
424 } | 424 } |
425 state.style()->setPageSizeType(pageSizeType); | 425 state.style()->setPageSizeType(pageSizeType); |
426 state.style()->setPageSize(size); | 426 state.style()->setPageSize(size); |
427 } | 427 } |
428 | 428 |
429 void StyleBuilderFunctions::applyInitialCSSPropertySnapHeight( | |
430 StyleResolverState& state) { | |
431 state.style()->setSnapHeightUnit(0); | |
432 state.style()->setSnapHeightPosition(0); | |
433 } | |
434 | |
435 void StyleBuilderFunctions::applyInheritCSSPropertySnapHeight( | |
436 StyleResolverState& state) { | |
437 state.style()->setSnapHeightUnit(state.parentStyle()->snapHeightUnit()); | |
438 state.style()->setSnapHeightPosition( | |
439 state.parentStyle()->snapHeightPosition()); | |
440 } | |
441 | |
442 void StyleBuilderFunctions::applyValueCSSPropertySnapHeight( | |
443 StyleResolverState& state, | |
444 const CSSValue& value) { | |
445 const CSSValueList& list = toCSSValueList(value); | |
446 const CSSPrimitiveValue& first = toCSSPrimitiveValue(list.item(0)); | |
447 DCHECK(first.isLength()); | |
448 int unit = first.computeLength<int>(state.cssToLengthConversionData()); | |
449 DCHECK_GE(unit, 0); | |
450 state.style()->setSnapHeightUnit(clampTo<uint8_t>(unit)); | |
451 | |
452 if (list.length() == 1) { | |
453 state.style()->setSnapHeightPosition(0); | |
454 return; | |
455 } | |
456 | |
457 DCHECK_EQ(list.length(), 2U); | |
458 const CSSPrimitiveValue& second = toCSSPrimitiveValue(list.item(1)); | |
459 DCHECK(second.isNumber()); | |
460 int position = second.getIntValue(); | |
461 DCHECK(position > 0 && position <= 100); | |
462 state.style()->setSnapHeightPosition(position); | |
463 } | |
464 | |
465 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign( | 429 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign( |
466 StyleResolverState& state, | 430 StyleResolverState& state, |
467 const CSSValue& value) { | 431 const CSSValue& value) { |
468 if (value.isIdentifierValue() && | 432 if (value.isIdentifierValue() && |
469 toCSSIdentifierValue(value).getValueID() != CSSValueWebkitMatchParent) { | 433 toCSSIdentifierValue(value).getValueID() != CSSValueWebkitMatchParent) { |
470 // Special case for th elements - UA stylesheet text-align does not apply if | 434 // Special case for th elements - UA stylesheet text-align does not apply if |
471 // parent's computed value for text-align is not its initial value | 435 // parent's computed value for text-align is not its initial value |
472 // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 | 436 // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 |
473 const CSSIdentifierValue& identValue = toCSSIdentifierValue(value); | 437 const CSSIdentifierValue& identValue = toCSSIdentifierValue(value); |
474 if (identValue.getValueID() == CSSValueInternalCenter && | 438 if (identValue.getValueID() == CSSValueInternalCenter && |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 state.style()->setCaretColor( | 992 state.style()->setCaretColor( |
1029 StyleBuilderConverter::convertStyleAutoColor(state, value)); | 993 StyleBuilderConverter::convertStyleAutoColor(state, value)); |
1030 } | 994 } |
1031 if (state.applyPropertyToVisitedLinkStyle()) { | 995 if (state.applyPropertyToVisitedLinkStyle()) { |
1032 state.style()->setVisitedLinkCaretColor( | 996 state.style()->setVisitedLinkCaretColor( |
1033 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); | 997 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); |
1034 } | 998 } |
1035 } | 999 } |
1036 | 1000 |
1037 } // namespace blink | 1001 } // namespace blink |
OLD | NEW |