| 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.
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 | 191 |
| 192 void StyleBuilderFunctions::applyValueCSSPropertyLineHeight(StyleResolverState&
state, CSSValue* value) | 192 void StyleBuilderFunctions::applyValueCSSPropertyLineHeight(StyleResolverState&
state, CSSValue* value) |
| 193 { | 193 { |
| 194 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 194 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 195 Length lineHeight; | 195 Length lineHeight; |
| 196 | 196 |
| 197 if (primitiveValue->getValueID() == CSSValueNormal) { | 197 if (primitiveValue->getValueID() == CSSValueNormal) { |
| 198 lineHeight = RenderStyle::initialLineHeight(); | 198 lineHeight = RenderStyle::initialLineHeight(); |
| 199 } else if (primitiveValue->isLength()) { | 199 } else if (primitiveValue->isLength()) { |
| 200 float multiplier = state.style()->effectiveZoom(); | 200 lineHeight = primitiveValue->computeLength<Length>(state.cssToLengthConv
ersionData()); |
| 201 if (LocalFrame* frame = state.document().frame()) | |
| 202 multiplier *= frame->textZoomFactor(); | |
| 203 lineHeight = primitiveValue->computeLength<Length>(state.cssToLengthConv
ersionData().copyWithAdjustedZoom(multiplier)); | |
| 204 } else if (primitiveValue->isPercentage()) { | 201 } else if (primitiveValue->isPercentage()) { |
| 205 lineHeight = Length((state.style()->computedFontSize() * primitiveValue-
>getIntValue()) / 100.0, Fixed); | 202 lineHeight = Length((state.style()->computedFontSize() * primitiveValue-
>getIntValue()) / 100.0, Fixed); |
| 206 } else if (primitiveValue->isNumber()) { | 203 } else if (primitiveValue->isNumber()) { |
| 207 lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent); | 204 lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent); |
| 208 } else if (primitiveValue->isCalculated()) { | 205 } else if (primitiveValue->isCalculated()) { |
| 209 double multiplier = state.style()->effectiveZoom(); | 206 Length length = Length(primitiveValue->cssCalcValue()->toCalcValue(state
.cssToLengthConversionData())); |
| 210 if (LocalFrame* frame = state.document().frame()) | 207 lineHeight = Length(valueForLength(length, state.style()->fontSize()), F
ixed); |
| 211 multiplier *= frame->textZoomFactor(); | |
| 212 Length zoomedLength = Length(primitiveValue->cssCalcValue()->toCalcValue
(state.cssToLengthConversionData().copyWithAdjustedZoom(multiplier))); | |
| 213 lineHeight = Length(valueForLength(zoomedLength, state.style()->fontSize
()), Fixed); | |
| 214 } else { | 208 } else { |
| 215 return; | 209 return; |
| 216 } | 210 } |
| 217 state.style()->setLineHeight(lineHeight); | 211 state.style()->setLineHeight(lineHeight); |
| 218 } | 212 } |
| 219 | 213 |
| 220 void StyleBuilderFunctions::applyValueCSSPropertyListStyleImage(StyleResolverSta
te& state, CSSValue* value) | 214 void StyleBuilderFunctions::applyValueCSSPropertyListStyleImage(StyleResolverSta
te& state, CSSValue* value) |
| 221 { | 215 { |
| 222 state.style()->setListStyleImage(state.styleImage(CSSPropertyListStyleImage,
value)); | 216 state.style()->setListStyleImage(state.styleImage(CSSPropertyListStyleImage,
value)); |
| 223 } | 217 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 case 2: { | 324 case 2: { |
| 331 // <length>{2} | <page-size> <orientation> | 325 // <length>{2} | <page-size> <orientation> |
| 332 if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPri
mitiveValue()) | 326 if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPri
mitiveValue()) |
| 333 return; | 327 return; |
| 334 CSSPrimitiveValue* first = toCSSPrimitiveValue(inspector.first()); | 328 CSSPrimitiveValue* first = toCSSPrimitiveValue(inspector.first()); |
| 335 CSSPrimitiveValue* second = toCSSPrimitiveValue(inspector.second()); | 329 CSSPrimitiveValue* second = toCSSPrimitiveValue(inspector.second()); |
| 336 if (first->isLength()) { | 330 if (first->isLength()) { |
| 337 // <length>{2} | 331 // <length>{2} |
| 338 if (!second->isLength()) | 332 if (!second->isLength()) |
| 339 return; | 333 return; |
| 340 width = first->computeLength<Length>(state.cssToLengthConversionData
().copyWithAdjustedZoom(1.0)); | 334 width = first->computeLength<Length>(state.cssToLengthConversionData
()); |
| 341 height = second->computeLength<Length>(state.cssToLengthConversionDa
ta().copyWithAdjustedZoom(1.0)); | 335 height = second->computeLength<Length>(state.cssToLengthConversionDa
ta()); |
| 342 } else { | 336 } else { |
| 343 // <page-size> <orientation> | 337 // <page-size> <orientation> |
| 344 // The value order is guaranteed. See BisonCSSParser::parseSizeParam
eter. | 338 // The value order is guaranteed. See BisonCSSParser::parseSizeParam
eter. |
| 345 if (!getPageSizeFromName(first, second, width, height)) | 339 if (!getPageSizeFromName(first, second, width, height)) |
| 346 return; | 340 return; |
| 347 } | 341 } |
| 348 pageSizeType = PAGE_SIZE_RESOLVED; | 342 pageSizeType = PAGE_SIZE_RESOLVED; |
| 349 break; | 343 break; |
| 350 } | 344 } |
| 351 case 1: { | 345 case 1: { |
| 352 // <length> | auto | <page-size> | [ portrait | landscape] | 346 // <length> | auto | <page-size> | [ portrait | landscape] |
| 353 if (!inspector.first()->isPrimitiveValue()) | 347 if (!inspector.first()->isPrimitiveValue()) |
| 354 return; | 348 return; |
| 355 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.first(
)); | 349 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.first(
)); |
| 356 if (primitiveValue->isLength()) { | 350 if (primitiveValue->isLength()) { |
| 357 // <length> | 351 // <length> |
| 358 pageSizeType = PAGE_SIZE_RESOLVED; | 352 pageSizeType = PAGE_SIZE_RESOLVED; |
| 359 width = height = primitiveValue->computeLength<Length>(state.cssToLe
ngthConversionData().copyWithAdjustedZoom(1.0)); | 353 width = height = primitiveValue->computeLength<Length>(state.cssToLe
ngthConversionData()); |
| 360 } else { | 354 } else { |
| 361 switch (primitiveValue->getValueID()) { | 355 switch (primitiveValue->getValueID()) { |
| 362 case 0: | 356 case 0: |
| 363 return; | 357 return; |
| 364 case CSSValueAuto: | 358 case CSSValueAuto: |
| 365 pageSizeType = PAGE_SIZE_AUTO; | 359 pageSizeType = PAGE_SIZE_AUTO; |
| 366 break; | 360 break; |
| 367 case CSSValuePortrait: | 361 case CSSValuePortrait: |
| 368 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; | 362 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; |
| 369 break; | 363 break; |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 769 |
| 776 void StyleBuilderFunctions::applyValueCSSPropertyFont(StyleResolverState& state,
CSSValue* value) | 770 void StyleBuilderFunctions::applyValueCSSPropertyFont(StyleResolverState& state,
CSSValue* value) |
| 777 { | 771 { |
| 778 // Only System Font identifiers should come through this method | 772 // Only System Font identifiers should come through this method |
| 779 // all other values should have been handled when the shorthand | 773 // all other values should have been handled when the shorthand |
| 780 // was expanded by the parser. | 774 // was expanded by the parser. |
| 781 // FIXME: System Font identifiers should not hijack this | 775 // FIXME: System Font identifiers should not hijack this |
| 782 // short-hand CSSProperty like this (crbug.com/353932) | 776 // short-hand CSSProperty like this (crbug.com/353932) |
| 783 state.style()->setLineHeight(RenderStyle::initialLineHeight()); | 777 state.style()->setLineHeight(RenderStyle::initialLineHeight()); |
| 784 state.setLineHeightValue(0); | 778 state.setLineHeightValue(0); |
| 785 state.fontBuilder().fromSystemFont(toCSSPrimitiveValue(value)->getValueID(),
state.style()->effectiveZoom()); | 779 state.fontBuilder().fromSystemFont(toCSSPrimitiveValue(value)->getValueID())
; |
| 786 } | 780 } |
| 787 | 781 |
| 788 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, CSSValue* value) | 782 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, CSSValue* value) |
| 789 { | 783 { |
| 790 if (!value->isPrimitiveValue()) | 784 if (!value->isPrimitiveValue()) |
| 791 return; | 785 return; |
| 792 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 786 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 793 if (primitiveValue->getValueID() == CSSValueAuto) | 787 if (primitiveValue->getValueID() == CSSValueAuto) |
| 794 state.style()->setLocale(nullAtom); | 788 state.style()->setLocale(nullAtom); |
| 795 else | 789 else |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 state.style()->setPerspective(perspectiveValue); | 832 state.style()->setPerspective(perspectiveValue); |
| 839 } | 833 } |
| 840 | 834 |
| 841 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, CSSValue* value) | 835 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, CSSValue* value) |
| 842 { | 836 { |
| 843 if (value->isPrimitiveValue()) | 837 if (value->isPrimitiveValue()) |
| 844 state.setTextOrientation(*toCSSPrimitiveValue(value)); | 838 state.setTextOrientation(*toCSSPrimitiveValue(value)); |
| 845 } | 839 } |
| 846 | 840 |
| 847 } // namespace blink | 841 } // namespace blink |
| OLD | NEW |