| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 styledNode = this->styledNode(); | 566 styledNode = this->styledNode(); |
| 567 style = computeComputedStyle(); | 567 style = computeComputedStyle(); |
| 568 layoutObject = styledNode->layoutObject(); | 568 layoutObject = styledNode->layoutObject(); |
| 569 } | 569 } |
| 570 | 570 |
| 571 if (!style) | 571 if (!style) |
| 572 return nullptr; | 572 return nullptr; |
| 573 | 573 |
| 574 NullableCSSValue value = ComputedStyleCSSValueMapping::get(propertyID, *styl
e, layoutObject, styledNode, m_allowVisitedStyle); | 574 NullableCSSValue value = ComputedStyleCSSValueMapping::get(propertyID, *styl
e, layoutObject, styledNode, m_allowVisitedStyle); |
| 575 if (value) | 575 if (value) |
| 576 return *value; | 576 return value; |
| 577 | 577 |
| 578 logUnimplementedPropertyID(propertyID); | 578 logUnimplementedPropertyID(propertyID); |
| 579 return nullptr; | 579 return nullptr; |
| 580 } | 580 } |
| 581 | 581 |
| 582 String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) c
onst | 582 String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) c
onst |
| 583 { | 583 { |
| 584 NullableCSSValue value = getPropertyCSSValue(propertyID); | 584 NullableCSSValue value = getPropertyCSSValue(propertyID); |
| 585 if (value) | 585 if (value) |
| 586 return value->cssText(); | 586 return value->cssText(); |
| 587 return ""; | 587 return ""; |
| 588 } | 588 } |
| 589 | 589 |
| 590 | 590 |
| 591 unsigned CSSComputedStyleDeclaration::length() const | 591 unsigned CSSComputedStyleDeclaration::length() const |
| 592 { | 592 { |
| 593 if (!m_node || !m_node->inActiveDocument()) | 593 if (!m_node || !m_node->inActiveDocument()) |
| 594 return 0; | 594 return 0; |
| 595 return computableProperties().size(); | 595 return computableProperties().size(); |
| 596 } | 596 } |
| 597 | 597 |
| 598 String CSSComputedStyleDeclaration::item(unsigned i) const | 598 String CSSComputedStyleDeclaration::item(unsigned i) const |
| 599 { | 599 { |
| 600 if (i >= length()) | 600 if (i >= length()) |
| 601 return ""; | 601 return ""; |
| 602 | 602 |
| 603 return getPropertyNameString(computableProperties()[i]); | 603 return getPropertyNameString(computableProperties()[i]); |
| 604 } | 604 } |
| 605 | 605 |
| 606 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue propertyValue) const | 606 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue& propertyValue) const |
| 607 { | 607 { |
| 608 if (propertyID == CSSPropertyFontSize && propertyValue.isPrimitiveValue() &&
m_node) { | 608 if (propertyID == CSSPropertyFontSize && propertyValue.isPrimitiveValue() &&
m_node) { |
| 609 m_node->document().updateLayoutIgnorePendingStylesheets(); | 609 m_node->document().updateLayoutIgnorePendingStylesheets(); |
| 610 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement
Specifier); | 610 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement
Specifier); |
| 611 if (style && style->fontDescription().keywordSize()) { | 611 if (style && style->fontDescription().keywordSize()) { |
| 612 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->fontDe
scription().keywordSize()); | 612 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->fontDe
scription().keywordSize()); |
| 613 const CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(propert
yValue); | 613 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(proper
tyValue); |
| 614 if (primitiveValue.isValueID() && primitiveValue.getValueID() == siz
eValue) | 614 if (primitiveValue.isValueID() && primitiveValue.getValueID() == siz
eValue) |
| 615 return true; | 615 return true; |
| 616 } | 616 } |
| 617 } | 617 } |
| 618 NullableCSSValue value = getPropertyCSSValue(propertyID); | 618 NullableCSSValue value = getPropertyCSSValue(propertyID); |
| 619 return value && value->equals(propertyValue); | 619 return value && value->equals(propertyValue); |
| 620 } | 620 } |
| 621 | 621 |
| 622 PassRefPtrWillBeRawPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::cop
yProperties() const | 622 PassRefPtrWillBeRawPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::cop
yProperties() const |
| 623 { | 623 { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); | 692 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); |
| 693 } | 693 } |
| 694 | 694 |
| 695 DEFINE_TRACE(CSSComputedStyleDeclaration) | 695 DEFINE_TRACE(CSSComputedStyleDeclaration) |
| 696 { | 696 { |
| 697 visitor->trace(m_node); | 697 visitor->trace(m_node); |
| 698 CSSStyleDeclaration::trace(visitor); | 698 CSSStyleDeclaration::trace(visitor); |
| 699 } | 699 } |
| 700 | 700 |
| 701 } // namespace blink | 701 } // namespace blink |
| OLD | NEW |