| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 { | 145 { |
| 146 Color color = state.parentStyle()->color(); | 146 Color color = state.parentStyle()->color(); |
| 147 if (state.applyPropertyToRegularStyle()) | 147 if (state.applyPropertyToRegularStyle()) |
| 148 state.style()->setColor(color); | 148 state.style()->setColor(color); |
| 149 if (state.applyPropertyToVisitedLinkStyle()) | 149 if (state.applyPropertyToVisitedLinkStyle()) |
| 150 state.style()->setVisitedLinkColor(color); | 150 state.style()->setVisitedLinkColor(color); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void StyleBuilderFunctions::applyValueCSSPropertyColor(StyleResolverState& state
, const CSSValue& value) | 153 void StyleBuilderFunctions::applyValueCSSPropertyColor(StyleResolverState& state
, const CSSValue& value) |
| 154 { | 154 { |
| 155 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 155 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 156 // As per the spec, 'color: currentColor' is treated as 'color: inherit' | 156 // As per the spec, 'color: currentColor' is treated as 'color: inherit' |
| 157 if (primitiveValue.getValueID() == CSSValueCurrentcolor) { | 157 if (primitiveValue.getValueID() == CSSValueCurrentcolor) { |
| 158 applyInheritCSSPropertyColor(state); | 158 applyInheritCSSPropertyColor(state); |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 | 161 |
| 162 if (state.applyPropertyToRegularStyle()) | 162 if (state.applyPropertyToRegularStyle()) |
| 163 state.style()->setColor(StyleBuilderConverter::convertColor(state, value
)); | 163 state.style()->setColor(StyleBuilderConverter::convertColor(state, value
)); |
| 164 if (state.applyPropertyToVisitedLinkStyle()) | 164 if (state.applyPropertyToVisitedLinkStyle()) |
| 165 state.style()->setVisitedLinkColor(StyleBuilderConverter::convertColor(s
tate, value, true)); | 165 state.style()->setVisitedLinkColor(StyleBuilderConverter::convertColor(s
tate, value, true)); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 264 } |
| 265 | 265 |
| 266 void StyleBuilderFunctions::applyInheritCSSPropertyOutlineStyle(StyleResolverSta
te& state) | 266 void StyleBuilderFunctions::applyInheritCSSPropertyOutlineStyle(StyleResolverSta
te& state) |
| 267 { | 267 { |
| 268 state.style()->setOutlineStyleIsAuto(state.parentStyle()->outlineStyleIsAuto
()); | 268 state.style()->setOutlineStyleIsAuto(state.parentStyle()->outlineStyleIsAuto
()); |
| 269 state.style()->setOutlineStyle(state.parentStyle()->outlineStyle()); | 269 state.style()->setOutlineStyle(state.parentStyle()->outlineStyle()); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState
& state, const CSSValue& value) | 272 void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState
& state, const CSSValue& value) |
| 273 { | 273 { |
| 274 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 274 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 275 state.style()->setOutlineStyleIsAuto(primitiveValue); | 275 state.style()->setOutlineStyleIsAuto(primitiveValue); |
| 276 state.style()->setOutlineStyle(primitiveValue); | 276 state.style()->setOutlineStyle(primitiveValue); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolverState& stat
e, const CSSValue& value) | 279 void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolverState& stat
e, const CSSValue& value) |
| 280 { | 280 { |
| 281 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 281 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 282 | 282 |
| 283 EResize r = RESIZE_NONE; | 283 EResize r = RESIZE_NONE; |
| 284 if (primitiveValue.getValueID() == CSSValueAuto) { | 284 if (primitiveValue.getValueID() == CSSValueAuto) { |
| 285 if (Settings* settings = state.document().settings()) | 285 if (Settings* settings = state.document().settings()) |
| 286 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE; | 286 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE; |
| 287 } else { | 287 } else { |
| 288 r = primitiveValue; | 288 r = primitiveValue; |
| 289 } | 289 } |
| 290 state.style()->setResize(r); | 290 state.style()->setResize(r); |
| 291 } | 291 } |
| 292 | 292 |
| 293 static float mmToPx(float mm) { return mm * cssPixelsPerMillimeter; } | 293 static float mmToPx(float mm) { return mm * cssPixelsPerMillimeter; } |
| 294 static float inchToPx(float inch) { return inch * cssPixelsPerInch; } | 294 static float inchToPx(float inch) { return inch * cssPixelsPerInch; } |
| 295 static FloatSize getPageSizeFromName(CSSPrimitiveValue& pageSizeName) | 295 static FloatSize getPageSizeFromName(CSSPrimitiveValue pageSizeName) |
| 296 { | 296 { |
| 297 switch (pageSizeName.getValueID()) { | 297 switch (pageSizeName.getValueID()) { |
| 298 case CSSValueA5: | 298 case CSSValueA5: |
| 299 return FloatSize(mmToPx(148), mmToPx(210)); | 299 return FloatSize(mmToPx(148), mmToPx(210)); |
| 300 case CSSValueA4: | 300 case CSSValueA4: |
| 301 return FloatSize(mmToPx(210), mmToPx(297)); | 301 return FloatSize(mmToPx(210), mmToPx(297)); |
| 302 case CSSValueA3: | 302 case CSSValueA3: |
| 303 return FloatSize(mmToPx(297), mmToPx(420)); | 303 return FloatSize(mmToPx(297), mmToPx(420)); |
| 304 case CSSValueB5: | 304 case CSSValueB5: |
| 305 return FloatSize(mmToPx(176), mmToPx(250)); | 305 return FloatSize(mmToPx(176), mmToPx(250)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolverState&) { } | 320 void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolverState&) { } |
| 321 void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolverState&) { } | 321 void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolverState&) { } |
| 322 void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state,
const CSSValue& value) | 322 void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state,
const CSSValue& value) |
| 323 { | 323 { |
| 324 state.style()->resetPageSizeType(); | 324 state.style()->resetPageSizeType(); |
| 325 FloatSize size; | 325 FloatSize size; |
| 326 PageSizeType pageSizeType = PAGE_SIZE_AUTO; | 326 PageSizeType pageSizeType = PAGE_SIZE_AUTO; |
| 327 CSSValueList& list = toCSSValueList(value); | 327 const CSSValueList& list = toCSSValueList(value); |
| 328 if (list.length() == 2) { | 328 if (list.length() == 2) { |
| 329 // <length>{2} | <page-size> <orientation> | 329 // <length>{2} | <page-size> <orientation> |
| 330 CSSPrimitiveValue& first = toCSSPrimitiveValue(list.item(0)); | 330 const CSSPrimitiveValue& first = toCSSPrimitiveValue(list.item(0)); |
| 331 CSSPrimitiveValue& second = toCSSPrimitiveValue(list.item(1)); | 331 const CSSPrimitiveValue& second = toCSSPrimitiveValue(list.item(1)); |
| 332 if (first.isLength()) { | 332 if (first.isLength()) { |
| 333 // <length>{2} | 333 // <length>{2} |
| 334 size = FloatSize(first.computeLength<float>(state.cssToLengthConvers
ionData().copyWithAdjustedZoom(1.0)), | 334 size = FloatSize(first.computeLength<float>(state.cssToLengthConvers
ionData().copyWithAdjustedZoom(1.0)), |
| 335 second.computeLength<float>(state.cssToLengthConversionData().co
pyWithAdjustedZoom(1.0))); | 335 second.computeLength<float>(state.cssToLengthConversionData().co
pyWithAdjustedZoom(1.0))); |
| 336 } else { | 336 } else { |
| 337 // <page-size> <orientation> | 337 // <page-size> <orientation> |
| 338 size = getPageSizeFromName(first); | 338 size = getPageSizeFromName(first); |
| 339 | 339 |
| 340 ASSERT(second.getValueID() == CSSValueLandscape || second.getValueID
() == CSSValuePortrait); | 340 ASSERT(second.getValueID() == CSSValueLandscape || second.getValueID
() == CSSValuePortrait); |
| 341 if (second.getValueID() == CSSValueLandscape) | 341 if (second.getValueID() == CSSValueLandscape) |
| 342 size = size.transposedSize(); | 342 size = size.transposedSize(); |
| 343 } | 343 } |
| 344 pageSizeType = PAGE_SIZE_RESOLVED; | 344 pageSizeType = PAGE_SIZE_RESOLVED; |
| 345 } else { | 345 } else { |
| 346 ASSERT(list.length() == 1); | 346 ASSERT(list.length() == 1); |
| 347 // <length> | auto | <page-size> | [ portrait | landscape] | 347 // <length> | auto | <page-size> | [ portrait | landscape] |
| 348 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item(0)); | 348 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item(
0)); |
| 349 if (primitiveValue.isLength()) { | 349 if (primitiveValue.isLength()) { |
| 350 // <length> | 350 // <length> |
| 351 pageSizeType = PAGE_SIZE_RESOLVED; | 351 pageSizeType = PAGE_SIZE_RESOLVED; |
| 352 float width = primitiveValue.computeLength<float>(state.cssToLengthC
onversionData().copyWithAdjustedZoom(1.0)); | 352 float width = primitiveValue.computeLength<float>(state.cssToLengthC
onversionData().copyWithAdjustedZoom(1.0)); |
| 353 size = FloatSize(width, width); | 353 size = FloatSize(width, width); |
| 354 } else { | 354 } else { |
| 355 switch (primitiveValue.getValueID()) { | 355 switch (primitiveValue.getValueID()) { |
| 356 case CSSValueAuto: | 356 case CSSValueAuto: |
| 357 pageSizeType = PAGE_SIZE_AUTO; | 357 pageSizeType = PAGE_SIZE_AUTO; |
| 358 break; | 358 break; |
| 359 case CSSValuePortrait: | 359 case CSSValuePortrait: |
| 360 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; | 360 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; |
| 361 break; | 361 break; |
| 362 case CSSValueLandscape: | 362 case CSSValueLandscape: |
| 363 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; | 363 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; |
| 364 break; | 364 break; |
| 365 default: | 365 default: |
| 366 // <page-size> | 366 // <page-size> |
| 367 pageSizeType = PAGE_SIZE_RESOLVED; | 367 pageSizeType = PAGE_SIZE_RESOLVED; |
| 368 size = getPageSizeFromName(primitiveValue); | 368 size = getPageSizeFromName(primitiveValue); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 state.style()->setPageSizeType(pageSizeType); | 372 state.style()->setPageSizeType(pageSizeType); |
| 373 state.style()->setPageSize(size); | 373 state.style()->setPageSize(size); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& s
tate, const CSSValue& value) | 376 void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& s
tate, const CSSValue& value) |
| 377 { | 377 { |
| 378 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 378 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 379 if (primitiveValue.isValueID() && primitiveValue.getValueID() != CSSValueWeb
kitMatchParent) | 379 if (primitiveValue.isValueID() && primitiveValue.getValueID() != CSSValueWeb
kitMatchParent) |
| 380 state.style()->setTextAlign(primitiveValue); | 380 state.style()->setTextAlign(primitiveValue); |
| 381 else if (state.parentStyle()->textAlign() == TASTART) | 381 else if (state.parentStyle()->textAlign() == TASTART) |
| 382 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? LEFT : RIGHT); | 382 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? LEFT : RIGHT); |
| 383 else if (state.parentStyle()->textAlign() == TAEND) | 383 else if (state.parentStyle()->textAlign() == TAEND) |
| 384 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? RIGHT : LEFT); | 384 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? RIGHT : LEFT); |
| 385 else | 385 else |
| 386 state.style()->setTextAlign(state.parentStyle()->textAlign()); | 386 state.style()->setTextAlign(state.parentStyle()->textAlign()); |
| 387 } | 387 } |
| 388 | 388 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 400 state.style()->setTextIndentType(ComputedStyle::initialTextIndentType()); | 400 state.style()->setTextIndentType(ComputedStyle::initialTextIndentType()); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
state, const CSSValue& value) | 403 void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
state, const CSSValue& value) |
| 404 { | 404 { |
| 405 Length lengthOrPercentageValue; | 405 Length lengthOrPercentageValue; |
| 406 TextIndentLine textIndentLineValue = ComputedStyle::initialTextIndentLine(); | 406 TextIndentLine textIndentLineValue = ComputedStyle::initialTextIndentLine(); |
| 407 TextIndentType textIndentTypeValue = ComputedStyle::initialTextIndentType(); | 407 TextIndentType textIndentTypeValue = ComputedStyle::initialTextIndentType(); |
| 408 | 408 |
| 409 for (auto& listValue : toCSSValueList(value)) { | 409 for (auto& listValue : toCSSValueList(value)) { |
| 410 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(listValue); | 410 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(listValue)
; |
| 411 if (!primitiveValue.getValueID()) | 411 if (!primitiveValue.getValueID()) |
| 412 lengthOrPercentageValue = primitiveValue.convertToLength(state.cssTo
LengthConversionData()); | 412 lengthOrPercentageValue = primitiveValue.convertToLength(state.cssTo
LengthConversionData()); |
| 413 else if (primitiveValue.getValueID() == CSSValueEachLine) | 413 else if (primitiveValue.getValueID() == CSSValueEachLine) |
| 414 textIndentLineValue = TextIndentEachLine; | 414 textIndentLineValue = TextIndentEachLine; |
| 415 else if (primitiveValue.getValueID() == CSSValueHanging) | 415 else if (primitiveValue.getValueID() == CSSValueHanging) |
| 416 textIndentTypeValue = TextIndentHanging; | 416 textIndentTypeValue = TextIndentHanging; |
| 417 else | 417 else |
| 418 ASSERT_NOT_REACHED(); | 418 ASSERT_NOT_REACHED(); |
| 419 } | 419 } |
| 420 | 420 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 { | 472 { |
| 473 float rotation = 0; | 473 float rotation = 0; |
| 474 MotionRotationType rotationType = MotionRotationFixed; | 474 MotionRotationType rotationType = MotionRotationFixed; |
| 475 | 475 |
| 476 ASSERT(value.isValueList()); | 476 ASSERT(value.isValueList()); |
| 477 CSSValueList& list = toCSSValueList(value); | 477 CSSValueList& list = toCSSValueList(value); |
| 478 int len = list.length(); | 478 int len = list.length(); |
| 479 for (int i = 0; i < len; i++) { | 479 for (int i = 0; i < len; i++) { |
| 480 const CSSValue& item = list.item(i); | 480 const CSSValue& item = list.item(i); |
| 481 ASSERT(item.isPrimitiveValue()); | 481 ASSERT(item.isPrimitiveValue()); |
| 482 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(item); | 482 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(item); |
| 483 if (primitiveValue.getValueID() == CSSValueAuto) { | 483 if (primitiveValue.getValueID() == CSSValueAuto) { |
| 484 rotationType = MotionRotationAuto; | 484 rotationType = MotionRotationAuto; |
| 485 } else if (primitiveValue.getValueID() == CSSValueReverse) { | 485 } else if (primitiveValue.getValueID() == CSSValueReverse) { |
| 486 rotationType = MotionRotationAuto; | 486 rotationType = MotionRotationAuto; |
| 487 rotation += 180; | 487 rotation += 180; |
| 488 } else { | 488 } else { |
| 489 rotation += primitiveValue.computeDegrees(); | 489 rotation += primitiveValue.computeDegrees(); |
| 490 } | 490 } |
| 491 } | 491 } |
| 492 | 492 |
| 493 state.style()->setMotionRotation(rotation); | 493 state.style()->setMotionRotation(rotation); |
| 494 state.style()->setMotionRotationType(rotationType); | 494 state.style()->setMotionRotationType(rotationType); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt
ate& state) | 497 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt
ate& state) |
| 498 { | 498 { |
| 499 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign(); | 499 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign(); |
| 500 state.style()->setVerticalAlign(verticalAlign); | 500 state.style()->setVerticalAlign(verticalAlign); |
| 501 if (verticalAlign == LENGTH) | 501 if (verticalAlign == LENGTH) |
| 502 state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlign
Length()); | 502 state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlign
Length()); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat
e& state, const CSSValue& value) | 505 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat
e& state, const CSSValue& value) |
| 506 { | 506 { |
| 507 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 507 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 508 | 508 |
| 509 if (primitiveValue.getValueID()) | 509 if (primitiveValue.getValueID()) |
| 510 state.style()->setVerticalAlign(primitiveValue); | 510 state.style()->setVerticalAlign(primitiveValue); |
| 511 else | 511 else |
| 512 state.style()->setVerticalAlignLength(primitiveValue.convertToLength(sta
te.cssToLengthConversionData())); | 512 state.style()->setVerticalAlignLength(primitiveValue.convertToLength(sta
te.cssToLengthConversionData())); |
| 513 } | 513 } |
| 514 | 514 |
| 515 static void resetEffectiveZoom(StyleResolverState& state) | 515 static void resetEffectiveZoom(StyleResolverState& state) |
| 516 { | 516 { |
| 517 // Reset the zoom in effect. This allows the setZoom method to accurately co
mpute a new zoom in effect. | 517 // Reset the zoom in effect. This allows the setZoom method to accurately co
mpute a new zoom in effect. |
| 518 state.setEffectiveZoom(state.parentStyle() ? state.parentStyle()->effectiveZ
oom() : ComputedStyle::initialZoom()); | 518 state.setEffectiveZoom(state.parentStyle() ? state.parentStyle()->effectiveZ
oom() : ComputedStyle::initialZoom()); |
| 519 } | 519 } |
| 520 | 520 |
| 521 void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolverState& stat
e) | 521 void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolverState& stat
e) |
| 522 { | 522 { |
| 523 resetEffectiveZoom(state); | 523 resetEffectiveZoom(state); |
| 524 state.setZoom(ComputedStyle::initialZoom()); | 524 state.setZoom(ComputedStyle::initialZoom()); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolverState& stat
e) | 527 void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolverState& stat
e) |
| 528 { | 528 { |
| 529 resetEffectiveZoom(state); | 529 resetEffectiveZoom(state); |
| 530 state.setZoom(state.parentStyle()->zoom()); | 530 state.setZoom(state.parentStyle()->zoom()); |
| 531 } | 531 } |
| 532 | 532 |
| 533 void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state,
const CSSValue& value) | 533 void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state,
const CSSValue& value) |
| 534 { | 534 { |
| 535 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); | 535 ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); |
| 536 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 536 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 537 | 537 |
| 538 if (primitiveValue.getValueID() == CSSValueNormal) { | 538 if (primitiveValue.getValueID() == CSSValueNormal) { |
| 539 resetEffectiveZoom(state); | 539 resetEffectiveZoom(state); |
| 540 state.setZoom(ComputedStyle::initialZoom()); | 540 state.setZoom(ComputedStyle::initialZoom()); |
| 541 } else if (primitiveValue.getValueID() == CSSValueReset) { | 541 } else if (primitiveValue.getValueID() == CSSValueReset) { |
| 542 state.setEffectiveZoom(ComputedStyle::initialZoom()); | 542 state.setEffectiveZoom(ComputedStyle::initialZoom()); |
| 543 state.setZoom(ComputedStyle::initialZoom()); | 543 state.setZoom(ComputedStyle::initialZoom()); |
| 544 } else if (primitiveValue.getValueID() == CSSValueDocument) { | 544 } else if (primitiveValue.getValueID() == CSSValueDocument) { |
| 545 float docZoom = state.rootElementStyle() ? state.rootElementStyle()->zoo
m() : ComputedStyle::initialZoom(); | 545 float docZoom = state.rootElementStyle() ? state.rootElementStyle()->zoo
m() : ComputedStyle::initialZoom(); |
| 546 state.setEffectiveZoom(docZoom); | 546 state.setEffectiveZoom(docZoom); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 559 void StyleBuilderFunctions::applyValueCSSPropertyWebkitBorderImage(StyleResolver
State& state, const CSSValue& value) | 559 void StyleBuilderFunctions::applyValueCSSPropertyWebkitBorderImage(StyleResolver
State& state, const CSSValue& value) |
| 560 { | 560 { |
| 561 NinePieceImage image; | 561 NinePieceImage image; |
| 562 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBorderImage, value,
image); | 562 CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBorderImage, value,
image); |
| 563 state.style()->setBorderImage(image); | 563 state.style()->setBorderImage(image); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverSta
te& state, const CSSValue& value) | 566 void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverSta
te& state, const CSSValue& value) |
| 567 { | 567 { |
| 568 if (value.isPrimitiveValue()) { | 568 if (value.isPrimitiveValue()) { |
| 569 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 569 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 570 if (primitiveValue.getValueID() == CSSValueNone) { | 570 if (primitiveValue.getValueID() == CSSValueNone) { |
| 571 state.style()->setClipPath(nullptr); | 571 state.style()->setClipPath(nullptr); |
| 572 } else if (primitiveValue.isShape()) { | 572 } else if (primitiveValue.isShape()) { |
| 573 state.style()->setClipPath(ShapeClipPathOperation::create(basicShape
ForValue(state, primitiveValue.getShapeValue()))); | 573 state.style()->setClipPath(ShapeClipPathOperation::create(basicShape
ForValue(state, primitiveValue.getShapeValue()))); |
| 574 } else if (primitiveValue.primitiveType() == CSSPrimitiveValue::CSS_URI)
{ | 574 } else if (primitiveValue.primitiveType() == CSSPrimitiveValue::CSS_URI)
{ |
| 575 String cssURLValue = primitiveValue.getStringValue(); | 575 String cssURLValue = primitiveValue.getStringValue(); |
| 576 KURL url = state.document().completeURL(cssURLValue); | 576 KURL url = state.document().completeURL(cssURLValue); |
| 577 // FIXME: It doesn't work with forward or external SVG references (s
ee https://bugs.webkit.org/show_bug.cgi?id=90405) | 577 // FIXME: It doesn't work with forward or external SVG references (s
ee https://bugs.webkit.org/show_bug.cgi?id=90405) |
| 578 state.style()->setClipPath(ReferenceClipPathOperation::create(cssURL
Value, AtomicString(url.fragmentIdentifier()))); | 578 state.style()->setClipPath(ReferenceClipPathOperation::create(cssURL
Value, AtomicString(url.fragmentIdentifier()))); |
| 579 } | 579 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 600 state.style()->setTextEmphasisMark(state.parentStyle()->textEmphasisMark()); | 600 state.style()->setTextEmphasisMark(state.parentStyle()->textEmphasisMark()); |
| 601 state.style()->setTextEmphasisCustomMark(state.parentStyle()->textEmphasisCu
stomMark()); | 601 state.style()->setTextEmphasisCustomMark(state.parentStyle()->textEmphasisCu
stomMark()); |
| 602 } | 602 } |
| 603 | 603 |
| 604 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe
solverState& state, const CSSValue& value) | 604 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe
solverState& state, const CSSValue& value) |
| 605 { | 605 { |
| 606 if (value.isValueList()) { | 606 if (value.isValueList()) { |
| 607 CSSValueList& list = toCSSValueList(value); | 607 CSSValueList& list = toCSSValueList(value); |
| 608 ASSERT(list.length() == 2); | 608 ASSERT(list.length() == 2); |
| 609 for (unsigned i = 0; i < 2; ++i) { | 609 for (unsigned i = 0; i < 2; ++i) { |
| 610 CSSPrimitiveValue& value = toCSSPrimitiveValue(list.item(i)); | 610 const CSSPrimitiveValue& value = toCSSPrimitiveValue(list.item(i)); |
| 611 if (value.getValueID() == CSSValueFilled || value.getValueID() == CS
SValueOpen) | 611 if (value.getValueID() == CSSValueFilled || value.getValueID() == CS
SValueOpen) |
| 612 state.style()->setTextEmphasisFill(value); | 612 state.style()->setTextEmphasisFill(value); |
| 613 else | 613 else |
| 614 state.style()->setTextEmphasisMark(value); | 614 state.style()->setTextEmphasisMark(value); |
| 615 } | 615 } |
| 616 state.style()->setTextEmphasisCustomMark(nullAtom); | 616 state.style()->setTextEmphasisCustomMark(nullAtom); |
| 617 return; | 617 return; |
| 618 } | 618 } |
| 619 | 619 |
| 620 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 620 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 621 | 621 |
| 622 if (primitiveValue.isString()) { | 622 if (primitiveValue.isString()) { |
| 623 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); | 623 state.style()->setTextEmphasisFill(TextEmphasisFillFilled); |
| 624 state.style()->setTextEmphasisMark(TextEmphasisMarkCustom); | 624 state.style()->setTextEmphasisMark(TextEmphasisMarkCustom); |
| 625 state.style()->setTextEmphasisCustomMark(AtomicString(primitiveValue.get
StringValue())); | 625 state.style()->setTextEmphasisCustomMark(AtomicString(primitiveValue.get
StringValue())); |
| 626 return; | 626 return; |
| 627 } | 627 } |
| 628 | 628 |
| 629 state.style()->setTextEmphasisCustomMark(nullAtom); | 629 state.style()->setTextEmphasisCustomMark(nullAtom); |
| 630 | 630 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 654 } | 654 } |
| 655 | 655 |
| 656 void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState&
state, const CSSValue& value) | 656 void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState&
state, const CSSValue& value) |
| 657 { | 657 { |
| 658 ASSERT(value.isValueList()); | 658 ASSERT(value.isValueList()); |
| 659 bool willChangeContents = false; | 659 bool willChangeContents = false; |
| 660 bool willChangeScrollPosition = false; | 660 bool willChangeScrollPosition = false; |
| 661 Vector<CSSPropertyID> willChangeProperties; | 661 Vector<CSSPropertyID> willChangeProperties; |
| 662 | 662 |
| 663 for (auto& willChangeValue : toCSSValueList(value)) { | 663 for (auto& willChangeValue : toCSSValueList(value)) { |
| 664 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(willChangeValue)
; | 664 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(willChange
Value); |
| 665 if (CSSPropertyID propertyID = primitiveValue.getPropertyID()) | 665 if (CSSPropertyID propertyID = primitiveValue.getPropertyID()) |
| 666 willChangeProperties.append(propertyID); | 666 willChangeProperties.append(propertyID); |
| 667 else if (primitiveValue.getValueID() == CSSValueContents) | 667 else if (primitiveValue.getValueID() == CSSValueContents) |
| 668 willChangeContents = true; | 668 willChangeContents = true; |
| 669 else if (primitiveValue.getValueID() == CSSValueScrollPosition) | 669 else if (primitiveValue.getValueID() == CSSValueScrollPosition) |
| 670 willChangeScrollPosition = true; | 670 willChangeScrollPosition = true; |
| 671 else | 671 else |
| 672 ASSERT_NOT_REACHED(); | 672 ASSERT_NOT_REACHED(); |
| 673 } | 673 } |
| 674 state.style()->setWillChangeContents(willChangeContents); | 674 state.style()->setWillChangeContents(willChangeContents); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 704 | 704 |
| 705 if (item.isImageValue()) { | 705 if (item.isImageValue()) { |
| 706 state.style()->setContent(state.elementStyleResources().cachedOrPend
ingFromValue(state.document(), CSSPropertyContent, toCSSImageValue(item)), didSe
t); | 706 state.style()->setContent(state.elementStyleResources().cachedOrPend
ingFromValue(state.document(), CSSPropertyContent, toCSSImageValue(item)), didSe
t); |
| 707 didSet = true; | 707 didSet = true; |
| 708 continue; | 708 continue; |
| 709 } | 709 } |
| 710 | 710 |
| 711 if (!item.isPrimitiveValue()) | 711 if (!item.isPrimitiveValue()) |
| 712 continue; | 712 continue; |
| 713 | 713 |
| 714 CSSPrimitiveValue& contentValue = toCSSPrimitiveValue(item); | 714 const CSSPrimitiveValue& contentValue = toCSSPrimitiveValue(item); |
| 715 | 715 |
| 716 if (contentValue.isString()) { | 716 if (contentValue.isString()) { |
| 717 state.style()->setContent(contentValue.getStringValue().impl(), didS
et); | 717 state.style()->setContent(contentValue.getStringValue().impl(), didS
et); |
| 718 didSet = true; | 718 didSet = true; |
| 719 } else if (contentValue.isAttr()) { | 719 } else if (contentValue.isAttr()) { |
| 720 // FIXME: Can a namespace be specified for an attr(foo)? | 720 // FIXME: Can a namespace be specified for an attr(foo)? |
| 721 if (state.style()->styleType() == NOPSEUDO) | 721 if (state.style()->styleType() == NOPSEUDO) |
| 722 state.style()->setUnique(); | 722 state.style()->setUnique(); |
| 723 else | 723 else |
| 724 state.parentStyle()->setUnique(); | 724 state.parentStyle()->setUnique(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); | 804 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); |
| 805 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); | 805 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); |
| 806 svgStyle.setBaselineShift(baselineShift); | 806 svgStyle.setBaselineShift(baselineShift); |
| 807 if (baselineShift == BS_LENGTH) | 807 if (baselineShift == BS_LENGTH) |
| 808 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); | 808 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); |
| 809 } | 809 } |
| 810 | 810 |
| 811 void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat
e& state, const CSSValue& value) | 811 void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverStat
e& state, const CSSValue& value) |
| 812 { | 812 { |
| 813 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); | 813 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); |
| 814 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); | 814 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); |
| 815 if (!primitiveValue.isValueID()) { | 815 if (!primitiveValue.isValueID()) { |
| 816 svgStyle.setBaselineShift(BS_LENGTH); | 816 svgStyle.setBaselineShift(BS_LENGTH); |
| 817 svgStyle.setBaselineShiftValue(StyleBuilderConverter::convertLength(stat
e, value)); | 817 svgStyle.setBaselineShiftValue(StyleBuilderConverter::convertLength(stat
e, value)); |
| 818 return; | 818 return; |
| 819 } | 819 } |
| 820 switch (primitiveValue.getValueID()) { | 820 switch (primitiveValue.getValueID()) { |
| 821 case CSSValueBaseline: | 821 case CSSValueBaseline: |
| 822 svgStyle.setBaselineShift(BS_LENGTH); | 822 svgStyle.setBaselineShift(BS_LENGTH); |
| 823 svgStyle.setBaselineShiftValue(Length(Fixed)); | 823 svgStyle.setBaselineShiftValue(Length(Fixed)); |
| 824 return; | 824 return; |
| 825 case CSSValueSub: | 825 case CSSValueSub: |
| 826 svgStyle.setBaselineShift(BS_SUB); | 826 svgStyle.setBaselineShift(BS_SUB); |
| 827 return; | 827 return; |
| 828 case CSSValueSuper: | 828 case CSSValueSuper: |
| 829 svgStyle.setBaselineShift(BS_SUPER); | 829 svgStyle.setBaselineShift(BS_SUPER); |
| 830 return; | 830 return; |
| 831 default: | 831 default: |
| 832 ASSERT_NOT_REACHED(); | 832 ASSERT_NOT_REACHED(); |
| 833 } | 833 } |
| 834 } | 834 } |
| 835 | 835 |
| 836 } // namespace blink | 836 } // namespace blink |
| OLD | NEW |