| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 CSSPropertyBorderTopRightRadius, | 86 CSSPropertyBorderTopRightRadius, |
| 87 CSSPropertyBorderTopStyle, | 87 CSSPropertyBorderTopStyle, |
| 88 CSSPropertyBorderTopWidth, | 88 CSSPropertyBorderTopWidth, |
| 89 CSSPropertyBottom, | 89 CSSPropertyBottom, |
| 90 CSSPropertyBoxShadow, | 90 CSSPropertyBoxShadow, |
| 91 CSSPropertyBoxSizing, | 91 CSSPropertyBoxSizing, |
| 92 CSSPropertyCaptionSide, | 92 CSSPropertyCaptionSide, |
| 93 CSSPropertyClear, | 93 CSSPropertyClear, |
| 94 CSSPropertyClip, | 94 CSSPropertyClip, |
| 95 CSSPropertyColor, | 95 CSSPropertyColor, |
| 96 CSSPropertyColumnCount, |
| 97 CSSPropertyColumnGap, |
| 98 CSSPropertyColumnRuleColor, |
| 99 CSSPropertyColumnRuleStyle, |
| 100 CSSPropertyColumnRuleWidth, |
| 101 CSSPropertyColumnSpan, |
| 102 CSSPropertyColumnWidth, |
| 96 CSSPropertyCursor, | 103 CSSPropertyCursor, |
| 97 CSSPropertyDirection, | 104 CSSPropertyDirection, |
| 98 CSSPropertyDisplay, | 105 CSSPropertyDisplay, |
| 99 CSSPropertyEmptyCells, | 106 CSSPropertyEmptyCells, |
| 100 CSSPropertyFloat, | 107 CSSPropertyFloat, |
| 101 CSSPropertyFontFamily, | 108 CSSPropertyFontFamily, |
| 102 CSSPropertyFontKerning, | 109 CSSPropertyFontKerning, |
| 103 CSSPropertyFontSize, | 110 CSSPropertyFontSize, |
| 104 CSSPropertyFontSizeAdjust, | 111 CSSPropertyFontSizeAdjust, |
| 105 CSSPropertyFontStretch, | 112 CSSPropertyFontStretch, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 CSSPropertyWebkitBoxFlexGroup, | 208 CSSPropertyWebkitBoxFlexGroup, |
| 202 CSSPropertyWebkitBoxLines, | 209 CSSPropertyWebkitBoxLines, |
| 203 CSSPropertyWebkitBoxOrdinalGroup, | 210 CSSPropertyWebkitBoxOrdinalGroup, |
| 204 CSSPropertyWebkitBoxOrient, | 211 CSSPropertyWebkitBoxOrient, |
| 205 CSSPropertyWebkitBoxPack, | 212 CSSPropertyWebkitBoxPack, |
| 206 CSSPropertyWebkitBoxReflect, | 213 CSSPropertyWebkitBoxReflect, |
| 207 CSSPropertyWebkitClipPath, | 214 CSSPropertyWebkitClipPath, |
| 208 CSSPropertyWebkitColumnBreakAfter, | 215 CSSPropertyWebkitColumnBreakAfter, |
| 209 CSSPropertyWebkitColumnBreakBefore, | 216 CSSPropertyWebkitColumnBreakBefore, |
| 210 CSSPropertyWebkitColumnBreakInside, | 217 CSSPropertyWebkitColumnBreakInside, |
| 211 CSSPropertyWebkitColumnCount, | |
| 212 CSSPropertyWebkitColumnGap, | |
| 213 CSSPropertyWebkitColumnRuleColor, | |
| 214 CSSPropertyWebkitColumnRuleStyle, | |
| 215 CSSPropertyWebkitColumnRuleWidth, | |
| 216 CSSPropertyWebkitColumnSpan, | |
| 217 CSSPropertyWebkitColumnWidth, | |
| 218 CSSPropertyWebkitFilter, | 218 CSSPropertyWebkitFilter, |
| 219 CSSPropertyAlignContent, | 219 CSSPropertyAlignContent, |
| 220 CSSPropertyAlignItems, | 220 CSSPropertyAlignItems, |
| 221 CSSPropertyAlignSelf, | 221 CSSPropertyAlignSelf, |
| 222 CSSPropertyFlexBasis, | 222 CSSPropertyFlexBasis, |
| 223 CSSPropertyFlexGrow, | 223 CSSPropertyFlexGrow, |
| 224 CSSPropertyFlexShrink, | 224 CSSPropertyFlexShrink, |
| 225 CSSPropertyFlexDirection, | 225 CSSPropertyFlexDirection, |
| 226 CSSPropertyFlexWrap, | 226 CSSPropertyFlexWrap, |
| 227 CSSPropertyJustifyContent, | 227 CSSPropertyJustifyContent, |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 { | 514 { |
| 515 if (!m_node) | 515 if (!m_node) |
| 516 return 0; | 516 return 0; |
| 517 if (m_node->isElementNode()) { | 517 if (m_node->isElementNode()) { |
| 518 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl
ementSpecifier)) | 518 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl
ementSpecifier)) |
| 519 return element; | 519 return element; |
| 520 } | 520 } |
| 521 return m_node.get(); | 521 return m_node.get(); |
| 522 } | 522 } |
| 523 | 523 |
| 524 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
e(CSSPropertyID propertyID) const | 524 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
e(CSSPropertyID unresolvedProperty) const |
| 525 { | 525 { |
| 526 CSSPropertyID propertyID = resolveCSSPropertyID(unresolvedProperty); |
| 526 Node* styledNode = this->styledNode(); | 527 Node* styledNode = this->styledNode(); |
| 527 if (!styledNode) | 528 if (!styledNode) |
| 528 return nullptr; | 529 return nullptr; |
| 529 LayoutObject* layoutObject = styledNode->layoutObject(); | 530 LayoutObject* layoutObject = styledNode->layoutObject(); |
| 530 const ComputedStyle* style; | 531 const ComputedStyle* style; |
| 531 | 532 |
| 532 Document& document = styledNode->document(); | 533 Document& document = styledNode->document(); |
| 533 | 534 |
| 534 // A timing update may be required if a compositor animation is running. | 535 // A timing update may be required if a compositor animation is running. |
| 535 DocumentAnimations::updateAnimationTimingForGetComputedStyle(*styledNode, pr
opertyID); | 536 DocumentAnimations::updateAnimationTimingForGetComputedStyle(*styledNode, pr
opertyID); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 550 if (forceFullLayout) { | 551 if (forceFullLayout) { |
| 551 document.updateLayoutIgnorePendingStylesheets(); | 552 document.updateLayoutIgnorePendingStylesheets(); |
| 552 styledNode = this->styledNode(); | 553 styledNode = this->styledNode(); |
| 553 style = computeComputedStyle(); | 554 style = computeComputedStyle(); |
| 554 layoutObject = styledNode->layoutObject(); | 555 layoutObject = styledNode->layoutObject(); |
| 555 } | 556 } |
| 556 | 557 |
| 557 if (!style) | 558 if (!style) |
| 558 return nullptr; | 559 return nullptr; |
| 559 | 560 |
| 560 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(prope
rtyID, *style, layoutObject, styledNode, m_allowVisitedStyle); | 561 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(unres
olvedProperty, *style, layoutObject, styledNode, ComputedStyleCSSValueMapping::N
otDoingShorthand, m_allowVisitedStyle); |
| 561 if (value) | 562 if (value) |
| 562 return value; | 563 return value; |
| 563 | 564 |
| 564 logUnimplementedPropertyID(propertyID); | 565 logUnimplementedPropertyID(propertyID); |
| 565 return nullptr; | 566 return nullptr; |
| 566 } | 567 } |
| 567 | 568 |
| 568 String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) c
onst | 569 String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID unresolvedPro
perty) const |
| 569 { | 570 { |
| 570 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(propertyID); | 571 RefPtrWillBeRawPtr<CSSValue> value = getPropertyCSSValue(unresolvedProperty)
; |
| 571 if (value) | 572 if (value) |
| 572 return value->cssText(); | 573 return value->cssText(); |
| 573 return ""; | 574 return "undefined"; |
| 574 } | 575 } |
| 575 | 576 |
| 576 | 577 |
| 577 unsigned CSSComputedStyleDeclaration::length() const | 578 unsigned CSSComputedStyleDeclaration::length() const |
| 578 { | 579 { |
| 579 if (!m_node || !m_node->inActiveDocument()) | 580 if (!m_node || !m_node->inActiveDocument()) |
| 580 return 0; | 581 return 0; |
| 581 return computableProperties().size(); | 582 return computableProperties().size(); |
| 582 } | 583 } |
| 583 | 584 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 { | 657 { |
| 657 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + name + "' property is read-only."); | 658 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + name + "' property is read-only."); |
| 658 } | 659 } |
| 659 | 660 |
| 660 String CSSComputedStyleDeclaration::removeProperty(const String& name, Exception
State& exceptionState) | 661 String CSSComputedStyleDeclaration::removeProperty(const String& name, Exception
State& exceptionState) |
| 661 { | 662 { |
| 662 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + name + "' property is read-only."); | 663 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + name + "' property is read-only."); |
| 663 return String(); | 664 return String(); |
| 664 } | 665 } |
| 665 | 666 |
| 666 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
eInternal(CSSPropertyID propertyID) | 667 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
eInternal(CSSPropertyID unresolvedProperty) |
| 667 { | 668 { |
| 668 return getPropertyCSSValue(propertyID); | 669 return getPropertyCSSValue(unresolvedProperty); |
| 669 } | 670 } |
| 670 | 671 |
| 671 String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID prope
rtyID) | 672 String CSSComputedStyleDeclaration::getPropertyValueInternal(CSSPropertyID unres
olvedProperty) |
| 672 { | 673 { |
| 673 return getPropertyValue(propertyID); | 674 return getPropertyValue(unresolvedProperty); |
| 674 } | 675 } |
| 675 | 676 |
| 676 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID id, const St
ring&, bool, ExceptionState& exceptionState) | 677 void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID id, const St
ring&, bool, ExceptionState& exceptionState) |
| 677 { | 678 { |
| 678 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); | 679 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); |
| 679 } | 680 } |
| 680 | 681 |
| 681 DEFINE_TRACE(CSSComputedStyleDeclaration) | 682 DEFINE_TRACE(CSSComputedStyleDeclaration) |
| 682 { | 683 { |
| 683 visitor->trace(m_node); | 684 visitor->trace(m_node); |
| 684 CSSStyleDeclaration::trace(visitor); | 685 CSSStyleDeclaration::trace(visitor); |
| 685 } | 686 } |
| 686 | 687 |
| 687 } // namespace blink | 688 } // namespace blink |
| OLD | NEW |