| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 439 |
| 440 // Create the border outset. | 440 // Create the border outset. |
| 441 RefPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), style); | 441 RefPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), style); |
| 442 | 442 |
| 443 // Create the repeat rules. | 443 // Create the repeat rules. |
| 444 RefPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); | 444 RefPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); |
| 445 | 445 |
| 446 return createBorderImageValue(imageValue.release(), imageSlices.release(), b
orderSlices.release(), outset.release(), repeat.release()); | 446 return createBorderImageValue(imageValue.release(), imageSlices.release(), b
orderSlices.release(), outset.release(), repeat.release()); |
| 447 } | 447 } |
| 448 | 448 |
| 449 // FIXME(sky): Rename and remove RenderStyle argument now that we don't have zoo
m. | 449 inline static PassRefPtr<CSSPrimitiveValue> pixelValue(double value, const Rende
rStyle&) |
| 450 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value,
const RenderStyle&) | |
| 451 { | 450 { |
| 452 return cssValuePool().createValue(value, CSSPrimitiveValue::CSS_PX); | 451 return cssValuePool().createValue(value, CSSPrimitiveValue::CSS_PX); |
| 453 } | 452 } |
| 454 | 453 |
| 455 // FIXME(sky): Rename and remove RenderStyle argument now that we don't have zoo
m. | 454 inline static PassRefPtr<CSSPrimitiveValue> numberValue(double value, const Rend
erStyle&) |
| 456 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value
, const RenderStyle&) | |
| 457 { | 455 { |
| 458 return cssValuePool().createValue(value, CSSPrimitiveValue::CSS_NUMBER); | 456 return cssValuePool().createValue(value, CSSPrimitiveValue::CSS_NUMBER); |
| 459 } | 457 } |
| 460 | 458 |
| 461 // FIXME(sky): Rename now that we don't have zoom. | 459 static PassRefPtr<CSSPrimitiveValue> pixelValueForLength(const Length& length, c
onst RenderStyle& style) |
| 462 static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength(const Lengt
h& length, const RenderStyle& style) | |
| 463 { | 460 { |
| 464 if (length.isFixed()) | 461 if (length.isFixed()) |
| 465 return zoomAdjustedPixelValue(length.value(), style); | 462 return pixelValue(length.value(), style); |
| 466 return cssValuePool().createValue(length, style); | 463 return cssValuePool().createValue(length, style); |
| 467 } | 464 } |
| 468 | 465 |
| 469 static PassRefPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propert
yID, const FillLayer& layer, const RenderStyle& style) | 466 static PassRefPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propert
yID, const FillLayer& layer, const RenderStyle& style) |
| 470 { | 467 { |
| 471 RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated(); | 468 RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated(); |
| 472 if (layer.isBackgroundXOriginSet()) { | 469 if (layer.isBackgroundXOriginSet()) { |
| 473 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition ||
propertyID == CSSPropertyWebkitMaskPosition); | 470 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition ||
propertyID == CSSPropertyWebkitMaskPosition); |
| 474 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin(
))); | 471 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin(
))); |
| 475 } | 472 } |
| 476 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl
e)); | 473 positionList->append(pixelValueForLength(layer.xPosition(), style)); |
| 477 if (layer.isBackgroundYOriginSet()) { | 474 if (layer.isBackgroundYOriginSet()) { |
| 478 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP
ropertyWebkitMaskPosition); | 475 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP
ropertyWebkitMaskPosition); |
| 479 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin(
))); | 476 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin(
))); |
| 480 } | 477 } |
| 481 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl
e)); | 478 positionList->append(pixelValueForLength(layer.yPosition(), style)); |
| 482 return positionList.release(); | 479 return positionList.release(); |
| 483 } | 480 } |
| 484 | 481 |
| 485 static PassRefPtr<CSSValue> valueForPositionOffset(RenderStyle& style, CSSProper
tyID propertyID, const RenderObject* renderer) | 482 static PassRefPtr<CSSValue> valueForPositionOffset(RenderStyle& style, CSSProper
tyID propertyID, const RenderObject* renderer) |
| 486 { | 483 { |
| 487 Length l; | 484 Length l; |
| 488 switch (propertyID) { | 485 switch (propertyID) { |
| 489 case CSSPropertyLeft: | 486 case CSSPropertyLeft: |
| 490 l = style.left(); | 487 l = style.left(); |
| 491 break; | 488 break; |
| 492 case CSSPropertyRight: | 489 case CSSPropertyRight: |
| 493 l = style.right(); | 490 l = style.right(); |
| 494 break; | 491 break; |
| 495 case CSSPropertyTop: | 492 case CSSPropertyTop: |
| 496 l = style.top(); | 493 l = style.top(); |
| 497 break; | 494 break; |
| 498 case CSSPropertyBottom: | 495 case CSSPropertyBottom: |
| 499 l = style.bottom(); | 496 l = style.bottom(); |
| 500 break; | 497 break; |
| 501 default: | 498 default: |
| 502 return nullptr; | 499 return nullptr; |
| 503 } | 500 } |
| 504 | 501 |
| 505 if (l.isPercent() && renderer && renderer->isBox()) { | 502 if (l.isPercent() && renderer && renderer->isBox()) { |
| 506 LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || prope
rtyID == CSSPropertyRight) ? | 503 LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || prope
rtyID == CSSPropertyRight) ? |
| 507 toRenderBox(renderer)->containingBlockLogicalWidthForContent() : | 504 toRenderBox(renderer)->containingBlockLogicalWidthForContent() : |
| 508 toRenderBox(renderer)->containingBlockLogicalHeightForContent(Exclud
eMarginBorderPadding); | 505 toRenderBox(renderer)->containingBlockLogicalHeightForContent(Exclud
eMarginBorderPadding); |
| 509 return zoomAdjustedPixelValue(valueForLength(l, containingBlockSize), st
yle); | 506 return pixelValue(valueForLength(l, containingBlockSize), style); |
| 510 } | 507 } |
| 511 if (l.isAuto()) { | 508 if (l.isAuto()) { |
| 512 // FIXME: It's not enough to simply return "auto" values for one offset
if the other side is defined. | 509 // FIXME: It's not enough to simply return "auto" values for one offset
if the other side is defined. |
| 513 // In other words if left is auto and right is not auto, then left's com
puted value is negative right(). | 510 // In other words if left is auto and right is not auto, then left's com
puted value is negative right(). |
| 514 // So we should get the opposite length unit and see if it is auto. | 511 // So we should get the opposite length unit and see if it is auto. |
| 515 return cssValuePool().createIdentifierValue(CSSValueAuto); | 512 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 516 } | 513 } |
| 517 | 514 |
| 518 return zoomAdjustedPixelValueForLength(l, style); | 515 return pixelValueForLength(l, style); |
| 519 } | 516 } |
| 520 | 517 |
| 521 PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidCo
lor(const RenderStyle& style, const StyleColor& color) const | 518 PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidCo
lor(const RenderStyle& style, const StyleColor& color) const |
| 522 { | 519 { |
| 523 // This function does NOT look at visited information, so that computed styl
e doesn't expose that. | 520 // This function does NOT look at visited information, so that computed styl
e doesn't expose that. |
| 524 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); | 521 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); |
| 525 } | 522 } |
| 526 | 523 |
| 527 static PassRefPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSize radius, c
onst RenderStyle& style) | 524 static PassRefPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSize radius, c
onst RenderStyle& style) |
| 528 { | 525 { |
| 529 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 526 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 530 if (radius.width().type() == Percent) | 527 if (radius.width().type() == Percent) |
| 531 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::CSS_PERCENTAGE)); | 528 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::CSS_PERCENTAGE)); |
| 532 else | 529 else |
| 533 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); | 530 list->append(pixelValueForLength(radius.width(), style)); |
| 534 if (radius.height().type() == Percent) | 531 if (radius.height().type() == Percent) |
| 535 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::CSS_PERCENTAGE)); | 532 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::CSS_PERCENTAGE)); |
| 536 else | 533 else |
| 537 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); | 534 list->append(pixelValueForLength(radius.height(), style)); |
| 538 return list.release(); | 535 return list.release(); |
| 539 } | 536 } |
| 540 | 537 |
| 541 static PassRefPtr<CSSValue> valueForBorderRadiusCorner(LengthSize radius, const
RenderStyle& style) | 538 static PassRefPtr<CSSValue> valueForBorderRadiusCorner(LengthSize radius, const
RenderStyle& style) |
| 542 { | 539 { |
| 543 RefPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style); | 540 RefPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style); |
| 544 if (list->item(0)->equals(*list->item(1))) | 541 if (list->item(0)->equals(*list->item(1))) |
| 545 return list->item(0); | 542 return list->item(0); |
| 546 return list.release(); | 543 return list.release(); |
| 547 } | 544 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 static PassRefPtr<CSSTransformValue> valueForMatrixTransform(const Transformatio
nMatrix& transform, const RenderStyle& style) | 598 static PassRefPtr<CSSTransformValue> valueForMatrixTransform(const Transformatio
nMatrix& transform, const RenderStyle& style) |
| 602 { | 599 { |
| 603 RefPtr<CSSTransformValue> transformValue = nullptr; | 600 RefPtr<CSSTransformValue> transformValue = nullptr; |
| 604 if (transform.isAffine()) { | 601 if (transform.isAffine()) { |
| 605 transformValue = CSSTransformValue::create(CSSTransformValue::MatrixTran
sformOperation); | 602 transformValue = CSSTransformValue::create(CSSTransformValue::MatrixTran
sformOperation); |
| 606 | 603 |
| 607 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim
itiveValue::CSS_NUMBER)); | 604 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim
itiveValue::CSS_NUMBER)); |
| 608 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim
itiveValue::CSS_NUMBER)); | 605 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim
itiveValue::CSS_NUMBER)); |
| 609 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim
itiveValue::CSS_NUMBER)); | 606 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim
itiveValue::CSS_NUMBER)); |
| 610 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim
itiveValue::CSS_NUMBER)); | 607 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim
itiveValue::CSS_NUMBER)); |
| 611 transformValue->append(zoomAdjustedNumberValue(transform.e(), style)); | 608 transformValue->append(numberValue(transform.e(), style)); |
| 612 transformValue->append(zoomAdjustedNumberValue(transform.f(), style)); | 609 transformValue->append(numberValue(transform.f(), style)); |
| 613 } else { | 610 } else { |
| 614 transformValue = CSSTransformValue::create(CSSTransformValue::Matrix3DTr
ansformOperation); | 611 transformValue = CSSTransformValue::create(CSSTransformValue::Matrix3DTr
ansformOperation); |
| 615 | 612 |
| 616 transformValue->append(cssValuePool().createValue(transform.m11(), CSSPr
imitiveValue::CSS_NUMBER)); | 613 transformValue->append(cssValuePool().createValue(transform.m11(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 617 transformValue->append(cssValuePool().createValue(transform.m12(), CSSPr
imitiveValue::CSS_NUMBER)); | 614 transformValue->append(cssValuePool().createValue(transform.m12(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 618 transformValue->append(cssValuePool().createValue(transform.m13(), CSSPr
imitiveValue::CSS_NUMBER)); | 615 transformValue->append(cssValuePool().createValue(transform.m13(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 619 transformValue->append(cssValuePool().createValue(transform.m14(), CSSPr
imitiveValue::CSS_NUMBER)); | 616 transformValue->append(cssValuePool().createValue(transform.m14(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 620 | 617 |
| 621 transformValue->append(cssValuePool().createValue(transform.m21(), CSSPr
imitiveValue::CSS_NUMBER)); | 618 transformValue->append(cssValuePool().createValue(transform.m21(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 622 transformValue->append(cssValuePool().createValue(transform.m22(), CSSPr
imitiveValue::CSS_NUMBER)); | 619 transformValue->append(cssValuePool().createValue(transform.m22(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 623 transformValue->append(cssValuePool().createValue(transform.m23(), CSSPr
imitiveValue::CSS_NUMBER)); | 620 transformValue->append(cssValuePool().createValue(transform.m23(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 624 transformValue->append(cssValuePool().createValue(transform.m24(), CSSPr
imitiveValue::CSS_NUMBER)); | 621 transformValue->append(cssValuePool().createValue(transform.m24(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 625 | 622 |
| 626 transformValue->append(cssValuePool().createValue(transform.m31(), CSSPr
imitiveValue::CSS_NUMBER)); | 623 transformValue->append(cssValuePool().createValue(transform.m31(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 627 transformValue->append(cssValuePool().createValue(transform.m32(), CSSPr
imitiveValue::CSS_NUMBER)); | 624 transformValue->append(cssValuePool().createValue(transform.m32(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 628 transformValue->append(cssValuePool().createValue(transform.m33(), CSSPr
imitiveValue::CSS_NUMBER)); | 625 transformValue->append(cssValuePool().createValue(transform.m33(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 629 transformValue->append(cssValuePool().createValue(transform.m34(), CSSPr
imitiveValue::CSS_NUMBER)); | 626 transformValue->append(cssValuePool().createValue(transform.m34(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 630 | 627 |
| 631 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); | 628 transformValue->append(numberValue(transform.m41(), style)); |
| 632 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); | 629 transformValue->append(numberValue(transform.m42(), style)); |
| 633 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); | 630 transformValue->append(numberValue(transform.m43(), style)); |
| 634 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::CSS_NUMBER)); | 631 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::CSS_NUMBER)); |
| 635 } | 632 } |
| 636 | 633 |
| 637 return transformValue.release(); | 634 return transformValue.release(); |
| 638 } | 635 } |
| 639 | 636 |
| 640 static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend
erStyle& style) | 637 static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend
erStyle& style) |
| 641 { | 638 { |
| 642 if (!renderer || !renderer->hasTransform() || !style.hasTransform()) | 639 if (!renderer || !renderer->hasTransform() || !style.hasTransform()) |
| 643 return cssValuePool().createIdentifierValue(CSSValueNone); | 640 return cssValuePool().createIdentifierValue(CSSValueNone); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 case FilterOperation::BRIGHTNESS: | 697 case FilterOperation::BRIGHTNESS: |
| 701 filterValue = CSSFilterValue::create(CSSFilterValue::BrightnessFilte
rOperation); | 698 filterValue = CSSFilterValue::create(CSSFilterValue::BrightnessFilte
rOperation); |
| 702 filterValue->append(cssValuePool().createValue(toBasicComponentTrans
ferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER)); | 699 filterValue->append(cssValuePool().createValue(toBasicComponentTrans
ferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER)); |
| 703 break; | 700 break; |
| 704 case FilterOperation::CONTRAST: | 701 case FilterOperation::CONTRAST: |
| 705 filterValue = CSSFilterValue::create(CSSFilterValue::ContrastFilterO
peration); | 702 filterValue = CSSFilterValue::create(CSSFilterValue::ContrastFilterO
peration); |
| 706 filterValue->append(cssValuePool().createValue(toBasicComponentTrans
ferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER)); | 703 filterValue->append(cssValuePool().createValue(toBasicComponentTrans
ferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER)); |
| 707 break; | 704 break; |
| 708 case FilterOperation::BLUR: | 705 case FilterOperation::BLUR: |
| 709 filterValue = CSSFilterValue::create(CSSFilterValue::BlurFilterOpera
tion); | 706 filterValue = CSSFilterValue::create(CSSFilterValue::BlurFilterOpera
tion); |
| 710 filterValue->append(zoomAdjustedPixelValue(toBlurFilterOperation(fil
terOperation)->stdDeviation().value(), style)); | 707 filterValue->append(pixelValue(toBlurFilterOperation(filterOperation
)->stdDeviation().value(), style)); |
| 711 break; | 708 break; |
| 712 case FilterOperation::DROP_SHADOW: { | 709 case FilterOperation::DROP_SHADOW: { |
| 713 DropShadowFilterOperation* dropShadowOperation = toDropShadowFilterO
peration(filterOperation); | 710 DropShadowFilterOperation* dropShadowOperation = toDropShadowFilterO
peration(filterOperation); |
| 714 filterValue = CSSFilterValue::create(CSSFilterValue::DropShadowFilte
rOperation); | 711 filterValue = CSSFilterValue::create(CSSFilterValue::DropShadowFilte
rOperation); |
| 715 // We want our computed style to look like that of a text shadow (ha
s neither spread nor inset style). | 712 // We want our computed style to look like that of a text shadow (ha
s neither spread nor inset style). |
| 716 ShadowData shadow(dropShadowOperation->location(), dropShadowOperati
on->stdDeviation(), 0, Normal, dropShadowOperation->color()); | 713 ShadowData shadow(dropShadowOperation->location(), dropShadowOperati
on->stdDeviation(), 0, Normal, dropShadowOperation->color()); |
| 717 filterValue->append(valueForShadowData(shadow, style, false)); | 714 filterValue->append(valueForShadowData(shadow, style, false)); |
| 718 break; | 715 break; |
| 719 } | 716 } |
| 720 default: | 717 default: |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 m_node->document().updateLayoutIgnorePendingStylesheets(); | 977 m_node->document().updateLayoutIgnorePendingStylesheets(); |
| 981 | 978 |
| 982 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); | 979 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); |
| 983 if (!style) | 980 if (!style) |
| 984 return nullptr; | 981 return nullptr; |
| 985 | 982 |
| 986 if (int keywordSize = style->fontDescription().keywordSize()) | 983 if (int keywordSize = style->fontDescription().keywordSize()) |
| 987 return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyw
ord(keywordSize)); | 984 return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyw
ord(keywordSize)); |
| 988 | 985 |
| 989 | 986 |
| 990 return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(),
*style); | 987 return pixelValue(style->fontDescription().computedPixelSize(), *style); |
| 991 } | 988 } |
| 992 | 989 |
| 993 FixedPitchFontType CSSComputedStyleDeclaration::fixedPitchFontType() const | 990 FixedPitchFontType CSSComputedStyleDeclaration::fixedPitchFontType() const |
| 994 { | 991 { |
| 995 if (!m_node) | 992 if (!m_node) |
| 996 return NonFixedPitchFont; | 993 return NonFixedPitchFont; |
| 997 | 994 |
| 998 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); | 995 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); |
| 999 if (!style) | 996 if (!style) |
| 1000 return NonFixedPitchFont; | 997 return NonFixedPitchFont; |
| 1001 | 998 |
| 1002 return style->fontDescription().fixedPitchFontType(); | 999 return style->fontDescription().fixedPitchFontType(); |
| 1003 } | 1000 } |
| 1004 | 1001 |
| 1005 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowData(const Shado
wData& shadow, const RenderStyle& style, bool useSpread) const | 1002 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowData(const Shado
wData& shadow, const RenderStyle& style, bool useSpread) const |
| 1006 { | 1003 { |
| 1007 RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style); | 1004 RefPtr<CSSPrimitiveValue> x = pixelValue(shadow.x(), style); |
| 1008 RefPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style); | 1005 RefPtr<CSSPrimitiveValue> y = pixelValue(shadow.y(), style); |
| 1009 RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.blur(), style
); | 1006 RefPtr<CSSPrimitiveValue> blur = pixelValue(shadow.blur(), style); |
| 1010 RefPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixelValue(shadow
.spread(), style) : PassRefPtr<CSSPrimitiveValue>(nullptr); | 1007 RefPtr<CSSPrimitiveValue> spread = useSpread ? pixelValue(shadow.spread(), s
tyle) : PassRefPtr<CSSPrimitiveValue>(nullptr); |
| 1011 RefPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPt
r<CSSPrimitiveValue>(nullptr) : cssValuePool().createIdentifierValue(CSSValueIns
et); | 1008 RefPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPt
r<CSSPrimitiveValue>(nullptr) : cssValuePool().createIdentifierValue(CSSValueIns
et); |
| 1012 RefPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style, shadow.col
or()); | 1009 RefPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style, shadow.col
or()); |
| 1013 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre
ad.release(), shadowStyle.release(), color.release()); | 1010 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre
ad.release(), shadowStyle.release(), color.release()); |
| 1014 } | 1011 } |
| 1015 | 1012 |
| 1016 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowList(const Shado
wList* shadowList, const RenderStyle& style, bool useSpread) const | 1013 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadowList(const Shado
wList* shadowList, const RenderStyle& style, bool useSpread) const |
| 1017 { | 1014 { |
| 1018 if (!shadowList) | 1015 if (!shadowList) |
| 1019 return cssValuePool().createIdentifierValue(CSSValueNone); | 1016 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1020 | 1017 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 | 1114 |
| 1118 static PassRefPtr<CSSValue> valueForFillSize(const FillSize& fillSize, const Ren
derStyle& style) | 1115 static PassRefPtr<CSSValue> valueForFillSize(const FillSize& fillSize, const Ren
derStyle& style) |
| 1119 { | 1116 { |
| 1120 if (fillSize.type == Contain) | 1117 if (fillSize.type == Contain) |
| 1121 return cssValuePool().createIdentifierValue(CSSValueContain); | 1118 return cssValuePool().createIdentifierValue(CSSValueContain); |
| 1122 | 1119 |
| 1123 if (fillSize.type == Cover) | 1120 if (fillSize.type == Cover) |
| 1124 return cssValuePool().createIdentifierValue(CSSValueCover); | 1121 return cssValuePool().createIdentifierValue(CSSValueCover); |
| 1125 | 1122 |
| 1126 if (fillSize.size.height().isAuto()) | 1123 if (fillSize.size.height().isAuto()) |
| 1127 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); | 1124 return pixelValueForLength(fillSize.size.width(), style); |
| 1128 | 1125 |
| 1129 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1126 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1130 list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style)); | 1127 list->append(pixelValueForLength(fillSize.size.width(), style)); |
| 1131 list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style))
; | 1128 list->append(pixelValueForLength(fillSize.size.height(), style)); |
| 1132 return list.release(); | 1129 return list.release(); |
| 1133 } | 1130 } |
| 1134 | 1131 |
| 1135 static void logUnimplementedPropertyID(CSSPropertyID propertyID) | 1132 static void logUnimplementedPropertyID(CSSPropertyID propertyID) |
| 1136 { | 1133 { |
| 1137 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ()); | 1134 DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, propertyIDSet, ()); |
| 1138 if (!propertyIDSet.add(propertyID).isNewEntry) | 1135 if (!propertyIDSet.add(propertyID).isNewEntry) |
| 1139 return; | 1136 return; |
| 1140 | 1137 |
| 1141 WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", ge
tPropertyName(propertyID)); | 1138 WTF_LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", ge
tPropertyName(propertyID)); |
| 1142 } | 1139 } |
| 1143 | 1140 |
| 1144 static PassRefPtr<CSSValueList> valueForFontFamily(RenderStyle& style) | 1141 static PassRefPtr<CSSValueList> valueForFontFamily(RenderStyle& style) |
| 1145 { | 1142 { |
| 1146 const FontFamily& firstFamily = style.fontDescription().family(); | 1143 const FontFamily& firstFamily = style.fontDescription().family(); |
| 1147 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1144 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1148 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) | 1145 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) |
| 1149 list->append(valueForFamily(family->family())); | 1146 list->append(valueForFamily(family->family())); |
| 1150 return list.release(); | 1147 return list.release(); |
| 1151 } | 1148 } |
| 1152 | 1149 |
| 1153 static PassRefPtr<CSSPrimitiveValue> valueForLineHeight(RenderStyle& style) | 1150 static PassRefPtr<CSSPrimitiveValue> valueForLineHeight(RenderStyle& style) |
| 1154 { | 1151 { |
| 1155 Length length = style.lineHeight(); | 1152 Length length = style.lineHeight(); |
| 1156 if (length.isNegative()) | 1153 if (length.isNegative()) |
| 1157 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1154 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 1158 | 1155 |
| 1159 return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescript
ion().specifiedSize()), style); | 1156 return pixelValue(floatValueForLength(length, style.fontDescription().specif
iedSize()), style); |
| 1160 } | 1157 } |
| 1161 | 1158 |
| 1162 static PassRefPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle& style) | 1159 static PassRefPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle& style) |
| 1163 { | 1160 { |
| 1164 return zoomAdjustedPixelValue(style.fontDescription().computedPixelSize(), s
tyle); | 1161 return pixelValue(style.fontDescription().computedPixelSize(), style); |
| 1165 } | 1162 } |
| 1166 | 1163 |
| 1167 static PassRefPtr<CSSPrimitiveValue> valueForFontStretch(RenderStyle& style) | 1164 static PassRefPtr<CSSPrimitiveValue> valueForFontStretch(RenderStyle& style) |
| 1168 { | 1165 { |
| 1169 return cssValuePool().createValue(style.fontDescription().stretch()); | 1166 return cssValuePool().createValue(style.fontDescription().stretch()); |
| 1170 } | 1167 } |
| 1171 | 1168 |
| 1172 static PassRefPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle& style) | 1169 static PassRefPtr<CSSPrimitiveValue> valueForFontStyle(RenderStyle& style) |
| 1173 { | 1170 { |
| 1174 return cssValuePool().createValue(style.fontDescription().style()); | 1171 return cssValuePool().createValue(style.fontDescription().style()); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosi
tion ? &style->maskLayers() : &style->backgroundLayers(); | 1387 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosi
tion ? &style->maskLayers() : &style->backgroundLayers(); |
| 1391 for (; currLayer; currLayer = currLayer->next()) | 1388 for (; currLayer; currLayer = currLayer->next()) |
| 1392 list->append(createPositionListForLayer(propertyID, *currLayer,
*style)); | 1389 list->append(createPositionListForLayer(propertyID, *currLayer,
*style)); |
| 1393 return list.release(); | 1390 return list.release(); |
| 1394 } | 1391 } |
| 1395 case CSSPropertyBackgroundPositionX: | 1392 case CSSPropertyBackgroundPositionX: |
| 1396 case CSSPropertyWebkitMaskPositionX: { | 1393 case CSSPropertyWebkitMaskPositionX: { |
| 1397 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1394 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1398 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosi
tionX ? &style->maskLayers() : &style->backgroundLayers(); | 1395 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosi
tionX ? &style->maskLayers() : &style->backgroundLayers(); |
| 1399 for (; currLayer; currLayer = currLayer->next()) | 1396 for (; currLayer; currLayer = currLayer->next()) |
| 1400 list->append(zoomAdjustedPixelValueForLength(currLayer->xPositio
n(), *style)); | 1397 list->append(pixelValueForLength(currLayer->xPosition(), *style)
); |
| 1401 return list.release(); | 1398 return list.release(); |
| 1402 } | 1399 } |
| 1403 case CSSPropertyBackgroundPositionY: | 1400 case CSSPropertyBackgroundPositionY: |
| 1404 case CSSPropertyWebkitMaskPositionY: { | 1401 case CSSPropertyWebkitMaskPositionY: { |
| 1405 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1402 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1406 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosi
tionY ? &style->maskLayers() : &style->backgroundLayers(); | 1403 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosi
tionY ? &style->maskLayers() : &style->backgroundLayers(); |
| 1407 for (; currLayer; currLayer = currLayer->next()) | 1404 for (; currLayer; currLayer = currLayer->next()) |
| 1408 list->append(zoomAdjustedPixelValueForLength(currLayer->yPositio
n(), *style)); | 1405 list->append(pixelValueForLength(currLayer->yPosition(), *style)
); |
| 1409 return list.release(); | 1406 return list.release(); |
| 1410 } | 1407 } |
| 1411 case CSSPropertyBorderCollapse: | 1408 case CSSPropertyBorderCollapse: |
| 1412 if (style->borderCollapse()) | 1409 if (style->borderCollapse()) |
| 1413 return cssValuePool().createIdentifierValue(CSSValueCollapse); | 1410 return cssValuePool().createIdentifierValue(CSSValueCollapse); |
| 1414 return cssValuePool().createIdentifierValue(CSSValueSeparate); | 1411 return cssValuePool().createIdentifierValue(CSSValueSeparate); |
| 1415 case CSSPropertyBorderSpacing: { | 1412 case CSSPropertyBorderSpacing: { |
| 1416 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1413 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1417 list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing()
, *style)); | 1414 list->append(pixelValue(style->horizontalBorderSpacing(), *style)); |
| 1418 list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(),
*style)); | 1415 list->append(pixelValue(style->verticalBorderSpacing(), *style)); |
| 1419 return list.release(); | 1416 return list.release(); |
| 1420 } | 1417 } |
| 1421 case CSSPropertyWebkitBorderHorizontalSpacing: | 1418 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 1422 return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), *sty
le); | 1419 return pixelValue(style->horizontalBorderSpacing(), *style); |
| 1423 case CSSPropertyWebkitBorderVerticalSpacing: | 1420 case CSSPropertyWebkitBorderVerticalSpacing: |
| 1424 return zoomAdjustedPixelValue(style->verticalBorderSpacing(), *style
); | 1421 return pixelValue(style->verticalBorderSpacing(), *style); |
| 1425 case CSSPropertyBorderImageSource: | 1422 case CSSPropertyBorderImageSource: |
| 1426 if (style->borderImageSource()) | 1423 if (style->borderImageSource()) |
| 1427 return style->borderImageSource()->cssValue(); | 1424 return style->borderImageSource()->cssValue(); |
| 1428 return cssValuePool().createIdentifierValue(CSSValueNone); | 1425 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1429 case CSSPropertyBorderTopColor: | 1426 case CSSPropertyBorderTopColor: |
| 1430 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidCo
lor(*style, style->borderTopColor()); | 1427 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidCo
lor(*style, style->borderTopColor()); |
| 1431 case CSSPropertyBorderRightColor: | 1428 case CSSPropertyBorderRightColor: |
| 1432 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyBorderRightColor).rgb()) : currentColorOrValid
Color(*style, style->borderRightColor()); | 1429 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyBorderRightColor).rgb()) : currentColorOrValid
Color(*style, style->borderRightColor()); |
| 1433 case CSSPropertyBorderBottomColor: | 1430 case CSSPropertyBorderBottomColor: |
| 1434 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyBorderBottomColor).rgb()) : currentColorOrVali
dColor(*style, style->borderBottomColor()); | 1431 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyBorderBottomColor).rgb()) : currentColorOrVali
dColor(*style, style->borderBottomColor()); |
| 1435 case CSSPropertyBorderLeftColor: | 1432 case CSSPropertyBorderLeftColor: |
| 1436 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidC
olor(*style, style->borderLeftColor()); | 1433 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidC
olor(*style, style->borderLeftColor()); |
| 1437 case CSSPropertyBorderTopStyle: | 1434 case CSSPropertyBorderTopStyle: |
| 1438 return cssValuePool().createValue(style->borderTopStyle()); | 1435 return cssValuePool().createValue(style->borderTopStyle()); |
| 1439 case CSSPropertyBorderRightStyle: | 1436 case CSSPropertyBorderRightStyle: |
| 1440 return cssValuePool().createValue(style->borderRightStyle()); | 1437 return cssValuePool().createValue(style->borderRightStyle()); |
| 1441 case CSSPropertyBorderBottomStyle: | 1438 case CSSPropertyBorderBottomStyle: |
| 1442 return cssValuePool().createValue(style->borderBottomStyle()); | 1439 return cssValuePool().createValue(style->borderBottomStyle()); |
| 1443 case CSSPropertyBorderLeftStyle: | 1440 case CSSPropertyBorderLeftStyle: |
| 1444 return cssValuePool().createValue(style->borderLeftStyle()); | 1441 return cssValuePool().createValue(style->borderLeftStyle()); |
| 1445 case CSSPropertyBorderTopWidth: | 1442 case CSSPropertyBorderTopWidth: |
| 1446 return zoomAdjustedPixelValue(style->borderTopWidth(), *style); | 1443 return pixelValue(style->borderTopWidth(), *style); |
| 1447 case CSSPropertyBorderRightWidth: | 1444 case CSSPropertyBorderRightWidth: |
| 1448 return zoomAdjustedPixelValue(style->borderRightWidth(), *style); | 1445 return pixelValue(style->borderRightWidth(), *style); |
| 1449 case CSSPropertyBorderBottomWidth: | 1446 case CSSPropertyBorderBottomWidth: |
| 1450 return zoomAdjustedPixelValue(style->borderBottomWidth(), *style); | 1447 return pixelValue(style->borderBottomWidth(), *style); |
| 1451 case CSSPropertyBorderLeftWidth: | 1448 case CSSPropertyBorderLeftWidth: |
| 1452 return zoomAdjustedPixelValue(style->borderLeftWidth(), *style); | 1449 return pixelValue(style->borderLeftWidth(), *style); |
| 1453 case CSSPropertyBottom: | 1450 case CSSPropertyBottom: |
| 1454 return valueForPositionOffset(*style, CSSPropertyBottom, renderer); | 1451 return valueForPositionOffset(*style, CSSPropertyBottom, renderer); |
| 1455 case CSSPropertyWebkitBoxDecorationBreak: | 1452 case CSSPropertyWebkitBoxDecorationBreak: |
| 1456 if (style->boxDecorationBreak() == DSLICE) | 1453 if (style->boxDecorationBreak() == DSLICE) |
| 1457 return cssValuePool().createIdentifierValue(CSSValueSlice); | 1454 return cssValuePool().createIdentifierValue(CSSValueSlice); |
| 1458 return cssValuePool().createIdentifierValue(CSSValueClone); | 1455 return cssValuePool().createIdentifierValue(CSSValueClone); |
| 1459 case CSSPropertyBoxShadow: | 1456 case CSSPropertyBoxShadow: |
| 1460 case CSSPropertyWebkitBoxShadow: | 1457 case CSSPropertyWebkitBoxShadow: |
| 1461 return valueForShadowList(style->boxShadow(), *style, true); | 1458 return valueForShadowList(style->boxShadow(), *style, true); |
| 1462 case CSSPropertyCaptionSide: | 1459 case CSSPropertyCaptionSide: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1491 return cssValuePool().createValue(style->emptyCells()); | 1488 return cssValuePool().createValue(style->emptyCells()); |
| 1492 case CSSPropertyAlignContent: | 1489 case CSSPropertyAlignContent: |
| 1493 return cssValuePool().createValue(style->alignContent()); | 1490 return cssValuePool().createValue(style->alignContent()); |
| 1494 case CSSPropertyAlignItems: | 1491 case CSSPropertyAlignItems: |
| 1495 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->alignItems(), m_node.get()), style->alignItemsOverflowAlignment(), NonL
egacyPosition); | 1492 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->alignItems(), m_node.get()), style->alignItemsOverflowAlignment(), NonL
egacyPosition); |
| 1496 case CSSPropertyAlignSelf: | 1493 case CSSPropertyAlignSelf: |
| 1497 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->alignSelf(), m_node->parentNode()), style->alignSelfOverflowAlignment()
, NonLegacyPosition); | 1494 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->alignSelf(), m_node->parentNode()), style->alignSelfOverflowAlignment()
, NonLegacyPosition); |
| 1498 case CSSPropertyFlex: | 1495 case CSSPropertyFlex: |
| 1499 return valuesForShorthandProperty(flexShorthand()); | 1496 return valuesForShorthandProperty(flexShorthand()); |
| 1500 case CSSPropertyFlexBasis: | 1497 case CSSPropertyFlexBasis: |
| 1501 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style); | 1498 return pixelValueForLength(style->flexBasis(), *style); |
| 1502 case CSSPropertyFlexDirection: | 1499 case CSSPropertyFlexDirection: |
| 1503 return cssValuePool().createValue(style->flexDirection()); | 1500 return cssValuePool().createValue(style->flexDirection()); |
| 1504 case CSSPropertyFlexFlow: | 1501 case CSSPropertyFlexFlow: |
| 1505 return valuesForShorthandProperty(flexFlowShorthand()); | 1502 return valuesForShorthandProperty(flexFlowShorthand()); |
| 1506 case CSSPropertyFlexGrow: | 1503 case CSSPropertyFlexGrow: |
| 1507 return cssValuePool().createValue(style->flexGrow()); | 1504 return cssValuePool().createValue(style->flexGrow()); |
| 1508 case CSSPropertyFlexShrink: | 1505 case CSSPropertyFlexShrink: |
| 1509 return cssValuePool().createValue(style->flexShrink()); | 1506 return cssValuePool().createValue(style->flexShrink()); |
| 1510 case CSSPropertyFlexWrap: | 1507 case CSSPropertyFlexWrap: |
| 1511 return cssValuePool().createValue(style->flexWrap()); | 1508 return cssValuePool().createValue(style->flexWrap()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 } | 1551 } |
| 1555 return list.release(); | 1552 return list.release(); |
| 1556 } | 1553 } |
| 1557 | 1554 |
| 1558 case CSSPropertyHeight: | 1555 case CSSPropertyHeight: |
| 1559 if (renderer) { | 1556 if (renderer) { |
| 1560 // According to http://www.w3.org/TR/CSS2/visudet.html#the-heigh
t-property, | 1557 // According to http://www.w3.org/TR/CSS2/visudet.html#the-heigh
t-property, |
| 1561 // the "height" property does not apply for non-replaced inline
elements. | 1558 // the "height" property does not apply for non-replaced inline
elements. |
| 1562 if (!renderer->isReplaced() && renderer->isInline()) | 1559 if (!renderer->isReplaced() && renderer->isInline()) |
| 1563 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1560 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1564 return zoomAdjustedPixelValue(sizingBox(renderer).height(), *sty
le); | 1561 return pixelValue(sizingBox(renderer).height(), *style); |
| 1565 } | 1562 } |
| 1566 return zoomAdjustedPixelValueForLength(style->height(), *style); | 1563 return pixelValueForLength(style->height(), *style); |
| 1567 case CSSPropertyWebkitHighlight: | 1564 case CSSPropertyWebkitHighlight: |
| 1568 if (style->highlight() == nullAtom) | 1565 if (style->highlight() == nullAtom) |
| 1569 return cssValuePool().createIdentifierValue(CSSValueNone); | 1566 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1570 return cssValuePool().createValue(style->highlight(), CSSPrimitiveVa
lue::CSS_STRING); | 1567 return cssValuePool().createValue(style->highlight(), CSSPrimitiveVa
lue::CSS_STRING); |
| 1571 case CSSPropertyWebkitHyphenateCharacter: | 1568 case CSSPropertyWebkitHyphenateCharacter: |
| 1572 if (style->hyphenationString().isNull()) | 1569 if (style->hyphenationString().isNull()) |
| 1573 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1570 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1574 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); | 1571 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); |
| 1575 case CSSPropertyImageRendering: | 1572 case CSSPropertyImageRendering: |
| 1576 return CSSPrimitiveValue::create(style->imageRendering()); | 1573 return CSSPrimitiveValue::create(style->imageRendering()); |
| 1577 case CSSPropertyIsolation: | 1574 case CSSPropertyIsolation: |
| 1578 return cssValuePool().createValue(style->isolation()); | 1575 return cssValuePool().createValue(style->isolation()); |
| 1579 case CSSPropertyLeft: | 1576 case CSSPropertyLeft: |
| 1580 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); | 1577 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); |
| 1581 case CSSPropertyLetterSpacing: | 1578 case CSSPropertyLetterSpacing: |
| 1582 if (!style->letterSpacing()) | 1579 if (!style->letterSpacing()) |
| 1583 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1580 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 1584 return zoomAdjustedPixelValue(style->letterSpacing(), *style); | 1581 return pixelValue(style->letterSpacing(), *style); |
| 1585 case CSSPropertyWebkitLineClamp: | 1582 case CSSPropertyWebkitLineClamp: |
| 1586 if (style->lineClamp().isNone()) | 1583 if (style->lineClamp().isNone()) |
| 1587 return cssValuePool().createIdentifierValue(CSSValueNone); | 1584 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1588 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); | 1585 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); |
| 1589 case CSSPropertyLineHeight: | 1586 case CSSPropertyLineHeight: |
| 1590 return valueForLineHeight(*style); | 1587 return valueForLineHeight(*style); |
| 1591 case CSSPropertyListStyleImage: | 1588 case CSSPropertyListStyleImage: |
| 1592 if (style->listStyleImage()) | 1589 if (style->listStyleImage()) |
| 1593 return style->listStyleImage()->cssValue(); | 1590 return style->listStyleImage()->cssValue(); |
| 1594 return cssValuePool().createIdentifierValue(CSSValueNone); | 1591 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1595 case CSSPropertyListStylePosition: | 1592 case CSSPropertyListStylePosition: |
| 1596 return cssValuePool().createValue(style->listStylePosition()); | 1593 return cssValuePool().createValue(style->listStylePosition()); |
| 1597 case CSSPropertyListStyleType: | 1594 case CSSPropertyListStyleType: |
| 1598 return cssValuePool().createValue(style->listStyleType()); | 1595 return cssValuePool().createValue(style->listStyleType()); |
| 1599 case CSSPropertyWebkitLocale: | 1596 case CSSPropertyWebkitLocale: |
| 1600 if (style->locale().isNull()) | 1597 if (style->locale().isNull()) |
| 1601 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1598 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1602 return cssValuePool().createValue(style->locale(), CSSPrimitiveValue
::CSS_STRING); | 1599 return cssValuePool().createValue(style->locale(), CSSPrimitiveValue
::CSS_STRING); |
| 1603 case CSSPropertyMarginTop: { | 1600 case CSSPropertyMarginTop: { |
| 1604 Length marginTop = style->marginTop(); | 1601 Length marginTop = style->marginTop(); |
| 1605 if (marginTop.isFixed() || !renderer || !renderer->isBox()) | 1602 if (marginTop.isFixed() || !renderer || !renderer->isBox()) |
| 1606 return zoomAdjustedPixelValueForLength(marginTop, *style); | 1603 return pixelValueForLength(marginTop, *style); |
| 1607 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginTop(), *s
tyle); | 1604 return pixelValue(toRenderBox(renderer)->marginTop(), *style); |
| 1608 } | 1605 } |
| 1609 case CSSPropertyMarginRight: { | 1606 case CSSPropertyMarginRight: { |
| 1610 Length marginRight = style->marginRight(); | 1607 Length marginRight = style->marginRight(); |
| 1611 if (marginRight.isFixed() || !renderer || !renderer->isBox()) | 1608 if (marginRight.isFixed() || !renderer || !renderer->isBox()) |
| 1612 return zoomAdjustedPixelValueForLength(marginRight, *style); | 1609 return pixelValueForLength(marginRight, *style); |
| 1613 float value; | 1610 float value; |
| 1614 if (marginRight.isPercent()) { | 1611 if (marginRight.isPercent()) { |
| 1615 // RenderBox gives a marginRight() that is the distance between
the right-edge of the child box | 1612 // RenderBox gives a marginRight() that is the distance between
the right-edge of the child box |
| 1616 // and the right-edge of the containing box, when display == BLO
CK. Let's calculate the absolute | 1613 // and the right-edge of the containing box, when display == BLO
CK. Let's calculate the absolute |
| 1617 // value of the specified margin-right % instead of relying on R
enderBox's marginRight() value. | 1614 // value of the specified margin-right % instead of relying on R
enderBox's marginRight() value. |
| 1618 value = minimumValueForLength(marginRight, toRenderBox(renderer)
->containingBlockLogicalWidthForContent()).toFloat(); | 1615 value = minimumValueForLength(marginRight, toRenderBox(renderer)
->containingBlockLogicalWidthForContent()).toFloat(); |
| 1619 } else { | 1616 } else { |
| 1620 value = toRenderBox(renderer)->marginRight().toFloat(); | 1617 value = toRenderBox(renderer)->marginRight().toFloat(); |
| 1621 } | 1618 } |
| 1622 return zoomAdjustedPixelValue(value, *style); | 1619 return pixelValue(value, *style); |
| 1623 } | 1620 } |
| 1624 case CSSPropertyMarginBottom: { | 1621 case CSSPropertyMarginBottom: { |
| 1625 Length marginBottom = style->marginBottom(); | 1622 Length marginBottom = style->marginBottom(); |
| 1626 if (marginBottom.isFixed() || !renderer || !renderer->isBox()) | 1623 if (marginBottom.isFixed() || !renderer || !renderer->isBox()) |
| 1627 return zoomAdjustedPixelValueForLength(marginBottom, *style); | 1624 return pixelValueForLength(marginBottom, *style); |
| 1628 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(),
*style); | 1625 return pixelValue(toRenderBox(renderer)->marginBottom(), *style); |
| 1629 } | 1626 } |
| 1630 case CSSPropertyMarginLeft: { | 1627 case CSSPropertyMarginLeft: { |
| 1631 Length marginLeft = style->marginLeft(); | 1628 Length marginLeft = style->marginLeft(); |
| 1632 if (marginLeft.isFixed() || !renderer || !renderer->isBox()) | 1629 if (marginLeft.isFixed() || !renderer || !renderer->isBox()) |
| 1633 return zoomAdjustedPixelValueForLength(marginLeft, *style); | 1630 return pixelValueForLength(marginLeft, *style); |
| 1634 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginLeft(), *
style); | 1631 return pixelValue(toRenderBox(renderer)->marginLeft(), *style); |
| 1635 } | 1632 } |
| 1636 case CSSPropertyWebkitUserModify: | 1633 case CSSPropertyWebkitUserModify: |
| 1637 return cssValuePool().createValue(style->userModify()); | 1634 return cssValuePool().createValue(style->userModify()); |
| 1638 case CSSPropertyMaxHeight: { | 1635 case CSSPropertyMaxHeight: { |
| 1639 const Length& maxHeight = style->maxHeight(); | 1636 const Length& maxHeight = style->maxHeight(); |
| 1640 if (maxHeight.isMaxSizeNone()) | 1637 if (maxHeight.isMaxSizeNone()) |
| 1641 return cssValuePool().createIdentifierValue(CSSValueNone); | 1638 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1642 return zoomAdjustedPixelValueForLength(maxHeight, *style); | 1639 return pixelValueForLength(maxHeight, *style); |
| 1643 } | 1640 } |
| 1644 case CSSPropertyMaxWidth: { | 1641 case CSSPropertyMaxWidth: { |
| 1645 const Length& maxWidth = style->maxWidth(); | 1642 const Length& maxWidth = style->maxWidth(); |
| 1646 if (maxWidth.isMaxSizeNone()) | 1643 if (maxWidth.isMaxSizeNone()) |
| 1647 return cssValuePool().createIdentifierValue(CSSValueNone); | 1644 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1648 return zoomAdjustedPixelValueForLength(maxWidth, *style); | 1645 return pixelValueForLength(maxWidth, *style); |
| 1649 } | 1646 } |
| 1650 case CSSPropertyMinHeight: | 1647 case CSSPropertyMinHeight: |
| 1651 // FIXME: For flex-items, min-height:auto should compute to min-cont
ent. | 1648 // FIXME: For flex-items, min-height:auto should compute to min-cont
ent. |
| 1652 if (style->minHeight().isAuto()) | 1649 if (style->minHeight().isAuto()) |
| 1653 return zoomAdjustedPixelValue(0, *style); | 1650 return pixelValue(0, *style); |
| 1654 return zoomAdjustedPixelValueForLength(style->minHeight(), *style); | 1651 return pixelValueForLength(style->minHeight(), *style); |
| 1655 case CSSPropertyMinWidth: | 1652 case CSSPropertyMinWidth: |
| 1656 // FIXME: For flex-items, min-width:auto should compute to min-conte
nt. | 1653 // FIXME: For flex-items, min-width:auto should compute to min-conte
nt. |
| 1657 if (style->minWidth().isAuto()) | 1654 if (style->minWidth().isAuto()) |
| 1658 return zoomAdjustedPixelValue(0, *style); | 1655 return pixelValue(0, *style); |
| 1659 return zoomAdjustedPixelValueForLength(style->minWidth(), *style); | 1656 return pixelValueForLength(style->minWidth(), *style); |
| 1660 case CSSPropertyObjectFit: | 1657 case CSSPropertyObjectFit: |
| 1661 return cssValuePool().createValue(style->objectFit()); | 1658 return cssValuePool().createValue(style->objectFit()); |
| 1662 case CSSPropertyObjectPosition: | 1659 case CSSPropertyObjectPosition: |
| 1663 return cssValuePool().createValue( | 1660 return cssValuePool().createValue( |
| 1664 Pair::create( | 1661 Pair::create( |
| 1665 zoomAdjustedPixelValueForLength(style->objectPosition().x(),
*style), | 1662 pixelValueForLength(style->objectPosition().x(), *style), |
| 1666 zoomAdjustedPixelValueForLength(style->objectPosition().y(),
*style), | 1663 pixelValueForLength(style->objectPosition().y(), *style), |
| 1667 Pair::KeepIdenticalValues)); | 1664 Pair::KeepIdenticalValues)); |
| 1668 case CSSPropertyOpacity: | 1665 case CSSPropertyOpacity: |
| 1669 return cssValuePool().createValue(style->opacity(), CSSPrimitiveValu
e::CSS_NUMBER); | 1666 return cssValuePool().createValue(style->opacity(), CSSPrimitiveValu
e::CSS_NUMBER); |
| 1670 case CSSPropertyOrphans: | 1667 case CSSPropertyOrphans: |
| 1671 if (style->hasAutoOrphans()) | 1668 if (style->hasAutoOrphans()) |
| 1672 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1669 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1673 return cssValuePool().createValue(style->orphans(), CSSPrimitiveValu
e::CSS_NUMBER); | 1670 return cssValuePool().createValue(style->orphans(), CSSPrimitiveValu
e::CSS_NUMBER); |
| 1674 case CSSPropertyOutlineColor: | 1671 case CSSPropertyOutlineColor: |
| 1675 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColo
r(*style, style->outlineColor()); | 1672 return m_allowVisitedStyle ? cssValuePool().createColorValue(style->
colorIncludingFallback(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColo
r(*style, style->outlineColor()); |
| 1676 case CSSPropertyOutlineOffset: | 1673 case CSSPropertyOutlineOffset: |
| 1677 return zoomAdjustedPixelValue(style->outlineOffset(), *style); | 1674 return pixelValue(style->outlineOffset(), *style); |
| 1678 case CSSPropertyOutlineStyle: | 1675 case CSSPropertyOutlineStyle: |
| 1679 if (style->outlineStyleIsAuto()) | 1676 if (style->outlineStyleIsAuto()) |
| 1680 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1677 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1681 return cssValuePool().createValue(style->outlineStyle()); | 1678 return cssValuePool().createValue(style->outlineStyle()); |
| 1682 case CSSPropertyOutlineWidth: | 1679 case CSSPropertyOutlineWidth: |
| 1683 return zoomAdjustedPixelValue(style->outlineWidth(), *style); | 1680 return pixelValue(style->outlineWidth(), *style); |
| 1684 case CSSPropertyOverflow: | 1681 case CSSPropertyOverflow: |
| 1685 return cssValuePool().createValue(max(style->overflowX(), style->ove
rflowY())); | 1682 return cssValuePool().createValue(max(style->overflowX(), style->ove
rflowY())); |
| 1686 case CSSPropertyOverflowWrap: | 1683 case CSSPropertyOverflowWrap: |
| 1687 return cssValuePool().createValue(style->overflowWrap()); | 1684 return cssValuePool().createValue(style->overflowWrap()); |
| 1688 case CSSPropertyOverflowX: | 1685 case CSSPropertyOverflowX: |
| 1689 return cssValuePool().createValue(style->overflowX()); | 1686 return cssValuePool().createValue(style->overflowX()); |
| 1690 case CSSPropertyOverflowY: | 1687 case CSSPropertyOverflowY: |
| 1691 return cssValuePool().createValue(style->overflowY()); | 1688 return cssValuePool().createValue(style->overflowY()); |
| 1692 case CSSPropertyPaddingTop: { | 1689 case CSSPropertyPaddingTop: { |
| 1693 Length paddingTop = style->paddingTop(); | 1690 Length paddingTop = style->paddingTop(); |
| 1694 if (paddingTop.isFixed() || !renderer || !renderer->isBox()) | 1691 if (paddingTop.isFixed() || !renderer || !renderer->isBox()) |
| 1695 return zoomAdjustedPixelValueForLength(paddingTop, *style); | 1692 return pixelValueForLength(paddingTop, *style); |
| 1696 return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPadd
ingTop(), *style); | 1693 return pixelValue(toRenderBox(renderer)->computedCSSPaddingTop(), *s
tyle); |
| 1697 } | 1694 } |
| 1698 case CSSPropertyPaddingRight: { | 1695 case CSSPropertyPaddingRight: { |
| 1699 Length paddingRight = style->paddingRight(); | 1696 Length paddingRight = style->paddingRight(); |
| 1700 if (paddingRight.isFixed() || !renderer || !renderer->isBox()) | 1697 if (paddingRight.isFixed() || !renderer || !renderer->isBox()) |
| 1701 return zoomAdjustedPixelValueForLength(paddingRight, *style); | 1698 return pixelValueForLength(paddingRight, *style); |
| 1702 return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPadd
ingRight(), *style); | 1699 return pixelValue(toRenderBox(renderer)->computedCSSPaddingRight(),
*style); |
| 1703 } | 1700 } |
| 1704 case CSSPropertyPaddingBottom: { | 1701 case CSSPropertyPaddingBottom: { |
| 1705 Length paddingBottom = style->paddingBottom(); | 1702 Length paddingBottom = style->paddingBottom(); |
| 1706 if (paddingBottom.isFixed() || !renderer || !renderer->isBox()) | 1703 if (paddingBottom.isFixed() || !renderer || !renderer->isBox()) |
| 1707 return zoomAdjustedPixelValueForLength(paddingBottom, *style); | 1704 return pixelValueForLength(paddingBottom, *style); |
| 1708 return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPadd
ingBottom(), *style); | 1705 return pixelValue(toRenderBox(renderer)->computedCSSPaddingBottom(),
*style); |
| 1709 } | 1706 } |
| 1710 case CSSPropertyPaddingLeft: { | 1707 case CSSPropertyPaddingLeft: { |
| 1711 Length paddingLeft = style->paddingLeft(); | 1708 Length paddingLeft = style->paddingLeft(); |
| 1712 if (paddingLeft.isFixed() || !renderer || !renderer->isBox()) | 1709 if (paddingLeft.isFixed() || !renderer || !renderer->isBox()) |
| 1713 return zoomAdjustedPixelValueForLength(paddingLeft, *style); | 1710 return pixelValueForLength(paddingLeft, *style); |
| 1714 return zoomAdjustedPixelValue(toRenderBox(renderer)->computedCSSPadd
ingLeft(), *style); | 1711 return pixelValue(toRenderBox(renderer)->computedCSSPaddingLeft(), *
style); |
| 1715 } | 1712 } |
| 1716 case CSSPropertyPageBreakAfter: | 1713 case CSSPropertyPageBreakAfter: |
| 1717 return cssValuePool().createValue(style->pageBreakAfter()); | 1714 return cssValuePool().createValue(style->pageBreakAfter()); |
| 1718 case CSSPropertyPageBreakBefore: | 1715 case CSSPropertyPageBreakBefore: |
| 1719 return cssValuePool().createValue(style->pageBreakBefore()); | 1716 return cssValuePool().createValue(style->pageBreakBefore()); |
| 1720 case CSSPropertyPageBreakInside: { | 1717 case CSSPropertyPageBreakInside: { |
| 1721 EPageBreak pageBreak = style->pageBreakInside(); | 1718 EPageBreak pageBreak = style->pageBreakInside(); |
| 1722 ASSERT(pageBreak != PBALWAYS); | 1719 ASSERT(pageBreak != PBALWAYS); |
| 1723 if (pageBreak == PBALWAYS) | 1720 if (pageBreak == PBALWAYS) |
| 1724 return nullptr; | 1721 return nullptr; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 list->append(cssValuePool().createValue(style->textEmphasisFill(
))); | 1773 list->append(cssValuePool().createValue(style->textEmphasisFill(
))); |
| 1777 list->append(cssValuePool().createValue(style->textEmphasisMark(
))); | 1774 list->append(cssValuePool().createValue(style->textEmphasisMark(
))); |
| 1778 return list.release(); | 1775 return list.release(); |
| 1779 } | 1776 } |
| 1780 } | 1777 } |
| 1781 case CSSPropertyTextIndent: { | 1778 case CSSPropertyTextIndent: { |
| 1782 // If RuntimeEnabledFeatures::css3TextEnabled() returns false or tex
t-indent has only one value(<length> | <percentage>), | 1779 // If RuntimeEnabledFeatures::css3TextEnabled() returns false or tex
t-indent has only one value(<length> | <percentage>), |
| 1783 // getPropertyCSSValue() returns CSSValue. | 1780 // getPropertyCSSValue() returns CSSValue. |
| 1784 // If RuntimeEnabledFeatures::css3TextEnabled() returns true and tex
t-indent has each-line or hanging, | 1781 // If RuntimeEnabledFeatures::css3TextEnabled() returns true and tex
t-indent has each-line or hanging, |
| 1785 // getPropertyCSSValue() returns CSSValueList. | 1782 // getPropertyCSSValue() returns CSSValueList. |
| 1786 RefPtr<CSSValue> textIndent = zoomAdjustedPixelValueForLength(style-
>textIndent(), *style); | 1783 RefPtr<CSSValue> textIndent = pixelValueForLength(style->textIndent(
), *style); |
| 1787 if (RuntimeEnabledFeatures::css3TextEnabled() && (style->textIndentL
ine() == TextIndentEachLine || style->textIndentType() == TextIndentHanging)) { | 1784 if (RuntimeEnabledFeatures::css3TextEnabled() && (style->textIndentL
ine() == TextIndentEachLine || style->textIndentType() == TextIndentHanging)) { |
| 1788 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1785 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
| 1789 list->append(textIndent.release()); | 1786 list->append(textIndent.release()); |
| 1790 if (style->textIndentLine() == TextIndentEachLine) | 1787 if (style->textIndentLine() == TextIndentEachLine) |
| 1791 list->append(cssValuePool().createIdentifierValue(CSSValueEa
chLine)); | 1788 list->append(cssValuePool().createIdentifierValue(CSSValueEa
chLine)); |
| 1792 if (style->textIndentType() == TextIndentHanging) | 1789 if (style->textIndentType() == TextIndentHanging) |
| 1793 list->append(cssValuePool().createIdentifierValue(CSSValueHa
nging)); | 1790 list->append(cssValuePool().createIdentifierValue(CSSValueHa
nging)); |
| 1794 return list.release(); | 1791 return list.release(); |
| 1795 } | 1792 } |
| 1796 return textIndent.release(); | 1793 return textIndent.release(); |
| 1797 } | 1794 } |
| 1798 case CSSPropertyTextShadow: | 1795 case CSSPropertyTextShadow: |
| 1799 return valueForShadowList(style->textShadow(), *style, false); | 1796 return valueForShadowList(style->textShadow(), *style, false); |
| 1800 case CSSPropertyTextRendering: | 1797 case CSSPropertyTextRendering: |
| 1801 return cssValuePool().createValue(style->fontDescription().textRende
ring()); | 1798 return cssValuePool().createValue(style->fontDescription().textRende
ring()); |
| 1802 case CSSPropertyTextOverflow: | 1799 case CSSPropertyTextOverflow: |
| 1803 if (style->textOverflow()) | 1800 if (style->textOverflow()) |
| 1804 return cssValuePool().createIdentifierValue(CSSValueEllipsis); | 1801 return cssValuePool().createIdentifierValue(CSSValueEllipsis); |
| 1805 return cssValuePool().createIdentifierValue(CSSValueClip); | 1802 return cssValuePool().createIdentifierValue(CSSValueClip); |
| 1806 case CSSPropertyWebkitTextStrokeColor: | 1803 case CSSPropertyWebkitTextStrokeColor: |
| 1807 return currentColorOrValidColor(*style, style->textStrokeColor()); | 1804 return currentColorOrValidColor(*style, style->textStrokeColor()); |
| 1808 case CSSPropertyWebkitTextStrokeWidth: | 1805 case CSSPropertyWebkitTextStrokeWidth: |
| 1809 return zoomAdjustedPixelValue(style->textStrokeWidth(), *style); | 1806 return pixelValue(style->textStrokeWidth(), *style); |
| 1810 case CSSPropertyTop: | 1807 case CSSPropertyTop: |
| 1811 return valueForPositionOffset(*style, CSSPropertyTop, renderer); | 1808 return valueForPositionOffset(*style, CSSPropertyTop, renderer); |
| 1812 case CSSPropertyTouchAction: | 1809 case CSSPropertyTouchAction: |
| 1813 return touchActionFlagsToCSSValue(style->touchAction()); | 1810 return touchActionFlagsToCSSValue(style->touchAction()); |
| 1814 case CSSPropertyTouchActionDelay: | 1811 case CSSPropertyTouchActionDelay: |
| 1815 return cssValuePool().createValue(style->touchActionDelay()); | 1812 return cssValuePool().createValue(style->touchActionDelay()); |
| 1816 case CSSPropertyUnicodeBidi: | 1813 case CSSPropertyUnicodeBidi: |
| 1817 return cssValuePool().createValue(style->unicodeBidi()); | 1814 return cssValuePool().createValue(style->unicodeBidi()); |
| 1818 case CSSPropertyVerticalAlign: | 1815 case CSSPropertyVerticalAlign: |
| 1819 switch (style->verticalAlign()) { | 1816 switch (style->verticalAlign()) { |
| 1820 case BASELINE: | 1817 case BASELINE: |
| 1821 return cssValuePool().createIdentifierValue(CSSValueBaseline
); | 1818 return cssValuePool().createIdentifierValue(CSSValueBaseline
); |
| 1822 case MIDDLE: | 1819 case MIDDLE: |
| 1823 return cssValuePool().createIdentifierValue(CSSValueMiddle); | 1820 return cssValuePool().createIdentifierValue(CSSValueMiddle); |
| 1824 case SUB: | 1821 case SUB: |
| 1825 return cssValuePool().createIdentifierValue(CSSValueSub); | 1822 return cssValuePool().createIdentifierValue(CSSValueSub); |
| 1826 case SUPER: | 1823 case SUPER: |
| 1827 return cssValuePool().createIdentifierValue(CSSValueSuper); | 1824 return cssValuePool().createIdentifierValue(CSSValueSuper); |
| 1828 case TEXT_TOP: | 1825 case TEXT_TOP: |
| 1829 return cssValuePool().createIdentifierValue(CSSValueTextTop)
; | 1826 return cssValuePool().createIdentifierValue(CSSValueTextTop)
; |
| 1830 case TEXT_BOTTOM: | 1827 case TEXT_BOTTOM: |
| 1831 return cssValuePool().createIdentifierValue(CSSValueTextBott
om); | 1828 return cssValuePool().createIdentifierValue(CSSValueTextBott
om); |
| 1832 case TOP: | 1829 case TOP: |
| 1833 return cssValuePool().createIdentifierValue(CSSValueTop); | 1830 return cssValuePool().createIdentifierValue(CSSValueTop); |
| 1834 case BOTTOM: | 1831 case BOTTOM: |
| 1835 return cssValuePool().createIdentifierValue(CSSValueBottom); | 1832 return cssValuePool().createIdentifierValue(CSSValueBottom); |
| 1836 case BASELINE_MIDDLE: | 1833 case BASELINE_MIDDLE: |
| 1837 return cssValuePool().createIdentifierValue(CSSValueWebkitBa
selineMiddle); | 1834 return cssValuePool().createIdentifierValue(CSSValueWebkitBa
selineMiddle); |
| 1838 case LENGTH: | 1835 case LENGTH: |
| 1839 return zoomAdjustedPixelValueForLength(style->verticalAlignL
ength(), *style); | 1836 return pixelValueForLength(style->verticalAlignLength(), *st
yle); |
| 1840 } | 1837 } |
| 1841 ASSERT_NOT_REACHED(); | 1838 ASSERT_NOT_REACHED(); |
| 1842 return nullptr; | 1839 return nullptr; |
| 1843 case CSSPropertyWhiteSpace: | 1840 case CSSPropertyWhiteSpace: |
| 1844 return cssValuePool().createValue(style->whiteSpace()); | 1841 return cssValuePool().createValue(style->whiteSpace()); |
| 1845 case CSSPropertyWidows: | 1842 case CSSPropertyWidows: |
| 1846 if (style->hasAutoWidows()) | 1843 if (style->hasAutoWidows()) |
| 1847 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1844 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1848 return cssValuePool().createValue(style->widows(), CSSPrimitiveValue
::CSS_NUMBER); | 1845 return cssValuePool().createValue(style->widows(), CSSPrimitiveValue
::CSS_NUMBER); |
| 1849 case CSSPropertyWidth: | 1846 case CSSPropertyWidth: |
| 1850 if (renderer) { | 1847 if (renderer) { |
| 1851 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width
-property, | 1848 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width
-property, |
| 1852 // the "width" property does not apply for non-replaced inline e
lements. | 1849 // the "width" property does not apply for non-replaced inline e
lements. |
| 1853 if (!renderer->isReplaced() && renderer->isInline()) | 1850 if (!renderer->isReplaced() && renderer->isInline()) |
| 1854 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1851 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1855 return zoomAdjustedPixelValue(sizingBox(renderer).width(), *styl
e); | 1852 return pixelValue(sizingBox(renderer).width(), *style); |
| 1856 } | 1853 } |
| 1857 return zoomAdjustedPixelValueForLength(style->width(), *style); | 1854 return pixelValueForLength(style->width(), *style); |
| 1858 case CSSPropertyWillChange: | 1855 case CSSPropertyWillChange: |
| 1859 return valueForWillChange(style->willChangeProperties(), style->will
ChangeContents(), style->willChangeScrollPosition()); | 1856 return valueForWillChange(style->willChangeProperties(), style->will
ChangeContents(), style->willChangeScrollPosition()); |
| 1860 case CSSPropertyWordBreak: | 1857 case CSSPropertyWordBreak: |
| 1861 return cssValuePool().createValue(style->wordBreak()); | 1858 return cssValuePool().createValue(style->wordBreak()); |
| 1862 case CSSPropertyWordSpacing: | 1859 case CSSPropertyWordSpacing: |
| 1863 return zoomAdjustedPixelValue(style->wordSpacing(), *style); | 1860 return pixelValue(style->wordSpacing(), *style); |
| 1864 case CSSPropertyWordWrap: | 1861 case CSSPropertyWordWrap: |
| 1865 return cssValuePool().createValue(style->overflowWrap()); | 1862 return cssValuePool().createValue(style->overflowWrap()); |
| 1866 case CSSPropertyWebkitLineBreak: | 1863 case CSSPropertyWebkitLineBreak: |
| 1867 return cssValuePool().createValue(style->lineBreak()); | 1864 return cssValuePool().createValue(style->lineBreak()); |
| 1868 case CSSPropertyFontKerning: | 1865 case CSSPropertyFontKerning: |
| 1869 return cssValuePool().createValue(style->fontDescription().kerning()
); | 1866 return cssValuePool().createValue(style->fontDescription().kerning()
); |
| 1870 case CSSPropertyWebkitFontSmoothing: | 1867 case CSSPropertyWebkitFontSmoothing: |
| 1871 return cssValuePool().createValue(style->fontDescription().fontSmoot
hing()); | 1868 return cssValuePool().createValue(style->fontDescription().fontSmoot
hing()); |
| 1872 case CSSPropertyFontVariantLigatures: { | 1869 case CSSPropertyFontVariantLigatures: { |
| 1873 FontDescription::LigaturesState commonLigaturesState = style->fontDe
scription().commonLigaturesState(); | 1870 FontDescription::LigaturesState commonLigaturesState = style->fontDe
scription().commonLigaturesState(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 case CSSPropertyWebkitMarginBottomCollapse: | 2041 case CSSPropertyWebkitMarginBottomCollapse: |
| 2045 case CSSPropertyWebkitMarginAfterCollapse: | 2042 case CSSPropertyWebkitMarginAfterCollapse: |
| 2046 return cssValuePool().createValue(style->marginAfterCollapse()); | 2043 return cssValuePool().createValue(style->marginAfterCollapse()); |
| 2047 case CSSPropertyWebkitMarginTopCollapse: | 2044 case CSSPropertyWebkitMarginTopCollapse: |
| 2048 case CSSPropertyWebkitMarginBeforeCollapse: | 2045 case CSSPropertyWebkitMarginBeforeCollapse: |
| 2049 return cssValuePool().createValue(style->marginBeforeCollapse()); | 2046 return cssValuePool().createValue(style->marginBeforeCollapse()); |
| 2050 case CSSPropertyPerspective: | 2047 case CSSPropertyPerspective: |
| 2051 case CSSPropertyWebkitPerspective: | 2048 case CSSPropertyWebkitPerspective: |
| 2052 if (!style->hasPerspective()) | 2049 if (!style->hasPerspective()) |
| 2053 return cssValuePool().createIdentifierValue(CSSValueNone); | 2050 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2054 return zoomAdjustedPixelValue(style->perspective(), *style); | 2051 return pixelValue(style->perspective(), *style); |
| 2055 case CSSPropertyPerspectiveOrigin: | 2052 case CSSPropertyPerspectiveOrigin: |
| 2056 case CSSPropertyWebkitPerspectiveOrigin: { | 2053 case CSSPropertyWebkitPerspectiveOrigin: { |
| 2057 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2054 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2058 if (renderer) { | 2055 if (renderer) { |
| 2059 LayoutRect box; | 2056 LayoutRect box; |
| 2060 if (renderer->isBox()) | 2057 if (renderer->isBox()) |
| 2061 box = toRenderBox(renderer)->borderBoxRect(); | 2058 box = toRenderBox(renderer)->borderBoxRect(); |
| 2062 | 2059 |
| 2063 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>perspectiveOriginX(), box.width()), *style)); | 2060 list->append(pixelValue(minimumValueForLength(style->perspective
OriginX(), box.width()), *style)); |
| 2064 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>perspectiveOriginY(), box.height()), *style)); | 2061 list->append(pixelValue(minimumValueForLength(style->perspective
OriginY(), box.height()), *style)); |
| 2065 } | 2062 } |
| 2066 else { | 2063 else { |
| 2067 list->append(zoomAdjustedPixelValueForLength(style->perspectiveO
riginX(), *style)); | 2064 list->append(pixelValueForLength(style->perspectiveOriginX(), *s
tyle)); |
| 2068 list->append(zoomAdjustedPixelValueForLength(style->perspectiveO
riginY(), *style)); | 2065 list->append(pixelValueForLength(style->perspectiveOriginY(), *s
tyle)); |
| 2069 | 2066 |
| 2070 } | 2067 } |
| 2071 return list.release(); | 2068 return list.release(); |
| 2072 } | 2069 } |
| 2073 case CSSPropertyWebkitRtlOrdering: | 2070 case CSSPropertyWebkitRtlOrdering: |
| 2074 return cssValuePool().createIdentifierValue(style->rtlOrdering() ? C
SSValueVisual : CSSValueLogical); | 2071 return cssValuePool().createIdentifierValue(style->rtlOrdering() ? C
SSValueVisual : CSSValueLogical); |
| 2075 case CSSPropertyWebkitTapHighlightColor: | 2072 case CSSPropertyWebkitTapHighlightColor: |
| 2076 return currentColorOrValidColor(*style, style->tapHighlightColor()); | 2073 return currentColorOrValidColor(*style, style->tapHighlightColor()); |
| 2077 case CSSPropertyWebkitUserDrag: | 2074 case CSSPropertyWebkitUserDrag: |
| 2078 return cssValuePool().createValue(style->userDrag()); | 2075 return cssValuePool().createValue(style->userDrag()); |
| 2079 case CSSPropertyWebkitUserSelect: | 2076 case CSSPropertyWebkitUserSelect: |
| 2080 return cssValuePool().createValue(style->userSelect()); | 2077 return cssValuePool().createValue(style->userSelect()); |
| 2081 case CSSPropertyBorderBottomLeftRadius: | 2078 case CSSPropertyBorderBottomLeftRadius: |
| 2082 return valueForBorderRadiusCorner(style->borderBottomLeftRadius(), *
style); | 2079 return valueForBorderRadiusCorner(style->borderBottomLeftRadius(), *
style); |
| 2083 case CSSPropertyBorderBottomRightRadius: | 2080 case CSSPropertyBorderBottomRightRadius: |
| 2084 return valueForBorderRadiusCorner(style->borderBottomRightRadius(),
*style); | 2081 return valueForBorderRadiusCorner(style->borderBottomRightRadius(),
*style); |
| 2085 case CSSPropertyBorderTopLeftRadius: | 2082 case CSSPropertyBorderTopLeftRadius: |
| 2086 return valueForBorderRadiusCorner(style->borderTopLeftRadius(), *sty
le); | 2083 return valueForBorderRadiusCorner(style->borderTopLeftRadius(), *sty
le); |
| 2087 case CSSPropertyBorderTopRightRadius: | 2084 case CSSPropertyBorderTopRightRadius: |
| 2088 return valueForBorderRadiusCorner(style->borderTopRightRadius(), *st
yle); | 2085 return valueForBorderRadiusCorner(style->borderTopRightRadius(), *st
yle); |
| 2089 case CSSPropertyClip: { | 2086 case CSSPropertyClip: { |
| 2090 if (style->hasAutoClip()) | 2087 if (style->hasAutoClip()) |
| 2091 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2088 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 2092 RefPtr<Rect> rect = Rect::create(); | 2089 RefPtr<Rect> rect = Rect::create(); |
| 2093 rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), *st
yle)); | 2090 rect->setTop(pixelValue(style->clip().top().value(), *style)); |
| 2094 rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(),
*style)); | 2091 rect->setRight(pixelValue(style->clip().right().value(), *style)); |
| 2095 rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(
), *style)); | 2092 rect->setBottom(pixelValue(style->clip().bottom().value(), *style)); |
| 2096 rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), *
style)); | 2093 rect->setLeft(pixelValue(style->clip().left().value(), *style)); |
| 2097 return cssValuePool().createValue(rect.release()); | 2094 return cssValuePool().createValue(rect.release()); |
| 2098 } | 2095 } |
| 2099 case CSSPropertySpeak: | 2096 case CSSPropertySpeak: |
| 2100 return cssValuePool().createValue(style->speak()); | 2097 return cssValuePool().createValue(style->speak()); |
| 2101 case CSSPropertyTransform: | 2098 case CSSPropertyTransform: |
| 2102 case CSSPropertyWebkitTransform: | 2099 case CSSPropertyWebkitTransform: |
| 2103 return computedTransform(renderer, *style); | 2100 return computedTransform(renderer, *style); |
| 2104 case CSSPropertyTransformOrigin: | 2101 case CSSPropertyTransformOrigin: |
| 2105 case CSSPropertyWebkitTransformOrigin: { | 2102 case CSSPropertyWebkitTransformOrigin: { |
| 2106 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2103 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2107 if (renderer) { | 2104 if (renderer) { |
| 2108 LayoutRect box; | 2105 LayoutRect box; |
| 2109 if (renderer->isBox()) | 2106 if (renderer->isBox()) |
| 2110 box = toRenderBox(renderer)->borderBoxRect(); | 2107 box = toRenderBox(renderer)->borderBoxRect(); |
| 2111 | 2108 |
| 2112 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>transformOriginX(), box.width()), *style)); | 2109 list->append(pixelValue(minimumValueForLength(style->transformOr
iginX(), box.width()), *style)); |
| 2113 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>transformOriginY(), box.height()), *style)); | 2110 list->append(pixelValue(minimumValueForLength(style->transformOr
iginY(), box.height()), *style)); |
| 2114 if (style->transformOriginZ() != 0) | 2111 if (style->transformOriginZ() != 0) |
| 2115 list->append(zoomAdjustedPixelValue(style->transformOriginZ(
), *style)); | 2112 list->append(pixelValue(style->transformOriginZ(), *style)); |
| 2116 } else { | 2113 } else { |
| 2117 list->append(zoomAdjustedPixelValueForLength(style->transformOri
ginX(), *style)); | 2114 list->append(pixelValueForLength(style->transformOriginX(), *sty
le)); |
| 2118 list->append(zoomAdjustedPixelValueForLength(style->transformOri
ginY(), *style)); | 2115 list->append(pixelValueForLength(style->transformOriginY(), *sty
le)); |
| 2119 if (style->transformOriginZ() != 0) | 2116 if (style->transformOriginZ() != 0) |
| 2120 list->append(zoomAdjustedPixelValue(style->transformOriginZ(
), *style)); | 2117 list->append(pixelValue(style->transformOriginZ(), *style)); |
| 2121 } | 2118 } |
| 2122 return list.release(); | 2119 return list.release(); |
| 2123 } | 2120 } |
| 2124 case CSSPropertyTransformStyle: | 2121 case CSSPropertyTransformStyle: |
| 2125 case CSSPropertyWebkitTransformStyle: | 2122 case CSSPropertyWebkitTransformStyle: |
| 2126 return cssValuePool().createIdentifierValue((style->transformStyle3D
() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat); | 2123 return cssValuePool().createIdentifierValue((style->transformStyle3D
() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat); |
| 2127 case CSSPropertyTransitionDelay: | 2124 case CSSPropertyTransitionDelay: |
| 2128 case CSSPropertyWebkitTransitionDelay: | 2125 case CSSPropertyWebkitTransitionDelay: |
| 2129 return valueForAnimationDelay(style->transitions()); | 2126 return valueForAnimationDelay(style->transitions()); |
| 2130 case CSSPropertyTransitionDuration: | 2127 case CSSPropertyTransitionDuration: |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 return list.release(); | 2478 return list.release(); |
| 2482 } | 2479 } |
| 2483 | 2480 |
| 2484 void CSSComputedStyleDeclaration::trace(Visitor* visitor) | 2481 void CSSComputedStyleDeclaration::trace(Visitor* visitor) |
| 2485 { | 2482 { |
| 2486 visitor->trace(m_node); | 2483 visitor->trace(m_node); |
| 2487 CSSStyleDeclaration::trace(visitor); | 2484 CSSStyleDeclaration::trace(visitor); |
| 2488 } | 2485 } |
| 2489 | 2486 |
| 2490 } // namespace blink | 2487 } // namespace blink |
| OLD | NEW |