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 |
429 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign( | 465 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign( |
430 StyleResolverState& state, | 466 StyleResolverState& state, |
431 const CSSValue& value) { | 467 const CSSValue& value) { |
432 if (value.isIdentifierValue() && | 468 if (value.isIdentifierValue() && |
433 toCSSIdentifierValue(value).getValueID() != CSSValueWebkitMatchParent) { | 469 toCSSIdentifierValue(value).getValueID() != CSSValueWebkitMatchParent) { |
434 // Special case for th elements - UA stylesheet text-align does not apply if | 470 // Special case for th elements - UA stylesheet text-align does not apply if |
435 // parent's computed value for text-align is not its initial value | 471 // parent's computed value for text-align is not its initial value |
436 // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 | 472 // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 |
437 const CSSIdentifierValue& identValue = toCSSIdentifierValue(value); | 473 const CSSIdentifierValue& identValue = toCSSIdentifierValue(value); |
438 if (identValue.getValueID() == CSSValueInternalCenter && | 474 if (identValue.getValueID() == CSSValueInternalCenter && |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 state.style()->setCaretColor( | 1028 state.style()->setCaretColor( |
993 StyleBuilderConverter::convertStyleAutoColor(state, value)); | 1029 StyleBuilderConverter::convertStyleAutoColor(state, value)); |
994 } | 1030 } |
995 if (state.applyPropertyToVisitedLinkStyle()) { | 1031 if (state.applyPropertyToVisitedLinkStyle()) { |
996 state.style()->setVisitedLinkCaretColor( | 1032 state.style()->setVisitedLinkCaretColor( |
997 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); | 1033 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); |
998 } | 1034 } |
999 } | 1035 } |
1000 | 1036 |
1001 } // namespace blink | 1037 } // namespace blink |
OLD | NEW |