| 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 |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Lesser General Public License for more details. | 16 * Lesser General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Lesser General Public | 18 * You should have received a copy of the GNU Lesser General Public |
| 19 * License along with this library; if not, write to the Free Software | 19 * License along with this library; if not, write to the Free Software |
| 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 21 * 02110-1301 USA | 21 * 02110-1301 USA |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "core/css/CSSComputedStyleDeclaration.h" | 24 #include "core/css/CSSComputedStyleDeclaration.h" |
| 25 | 25 |
| 26 #include "bindings/core/v8/ExceptionState.h" | 26 #include "bindings/core/v8/ExceptionState.h" |
| 27 #include "core/CSSPropertyNames.h" | 27 #include "core/CSSPropertyNames.h" |
| 28 #include "core/css/CSSIdentifierValue.h" |
| 28 #include "core/css/CSSPrimitiveValue.h" | 29 #include "core/css/CSSPrimitiveValue.h" |
| 29 #include "core/css/CSSPrimitiveValueMappings.h" | 30 #include "core/css/CSSPrimitiveValueMappings.h" |
| 30 #include "core/css/CSSPropertyIDTemplates.h" | 31 #include "core/css/CSSPropertyIDTemplates.h" |
| 31 #include "core/css/CSSPropertyMetadata.h" | 32 #include "core/css/CSSPropertyMetadata.h" |
| 32 #include "core/css/CSSSelector.h" | 33 #include "core/css/CSSSelector.h" |
| 33 #include "core/css/CSSVariableData.h" | 34 #include "core/css/CSSVariableData.h" |
| 34 #include "core/css/ComputedStyleCSSValueMapping.h" | 35 #include "core/css/ComputedStyleCSSValueMapping.h" |
| 35 #include "core/css/parser/CSSParser.h" | 36 #include "core/css/parser/CSSParser.h" |
| 36 #include "core/css/resolver/StyleResolver.h" | 37 #include "core/css/resolver/StyleResolver.h" |
| 37 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 if (!m_node) | 406 if (!m_node) |
| 406 return nullptr; | 407 return nullptr; |
| 407 | 408 |
| 408 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets(); | 409 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 409 | 410 |
| 410 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElementSpec
ifier); | 411 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElementSpec
ifier); |
| 411 if (!style) | 412 if (!style) |
| 412 return nullptr; | 413 return nullptr; |
| 413 | 414 |
| 414 if (int keywordSize = style->getFontDescription().keywordSize()) | 415 if (int keywordSize = style->getFontDescription().keywordSize()) |
| 415 return CSSPrimitiveValue::createIdentifier(cssIdentifierForFontSizeKeywo
rd(keywordSize)); | 416 return CSSIdentifierValue::create(cssIdentifierForFontSizeKeyword(keywor
dSize)); |
| 416 | 417 |
| 417 | 418 |
| 418 return zoomAdjustedPixelValue(style->getFontDescription().computedPixelSize(
), *style); | 419 return zoomAdjustedPixelValue(style->getFontDescription().computedPixelSize(
), *style); |
| 419 } | 420 } |
| 420 | 421 |
| 421 bool CSSComputedStyleDeclaration::isMonospaceFont() const | 422 bool CSSComputedStyleDeclaration::isMonospaceFont() const |
| 422 { | 423 { |
| 423 if (!m_node) | 424 if (!m_node) |
| 424 return false; | 425 return false; |
| 425 | 426 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 String CSSComputedStyleDeclaration::item(unsigned i) const | 593 String CSSComputedStyleDeclaration::item(unsigned i) const |
| 593 { | 594 { |
| 594 if (i >= length()) | 595 if (i >= length()) |
| 595 return ""; | 596 return ""; |
| 596 | 597 |
| 597 return getPropertyNameString(computableProperties()[i]); | 598 return getPropertyNameString(computableProperties()[i]); |
| 598 } | 599 } |
| 599 | 600 |
| 600 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue* propertyValue) const | 601 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue* propertyValue) const |
| 601 { | 602 { |
| 602 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() &
& m_node) { | 603 if (propertyID == CSSPropertyFontSize && (propertyValue->isPrimitiveValue()
|| propertyValue->isIdentifierValue()) && m_node) { |
| 603 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets(); | 604 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 604 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement
Specifier); | 605 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement
Specifier); |
| 605 if (style && style->getFontDescription().keywordSize()) { | 606 if (style && style->getFontDescription().keywordSize()) { |
| 606 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->getFon
tDescription().keywordSize()); | 607 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->getFon
tDescription().keywordSize()); |
| 607 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper
tyValue); | 608 if (propertyValue->isIdentifierValue() && toCSSIdentifierValue(prope
rtyValue)->getValueID() == sizeValue) |
| 608 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s
izeValue) | |
| 609 return true; | 609 return true; |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 const CSSValue* value = getPropertyCSSValue(propertyID); | 612 const CSSValue* value = getPropertyCSSValue(propertyID); |
| 613 return value && propertyValue && value->equals(*propertyValue); | 613 return value && propertyValue && value->equals(*propertyValue); |
| 614 } | 614 } |
| 615 | 615 |
| 616 MutableStylePropertySet* CSSComputedStyleDeclaration::copyProperties() const | 616 MutableStylePropertySet* CSSComputedStyleDeclaration::copyProperties() const |
| 617 { | 617 { |
| 618 return copyPropertiesInSet(computableProperties()); | 618 return copyPropertiesInSet(computableProperties()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); | 698 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); |
| 699 } | 699 } |
| 700 | 700 |
| 701 DEFINE_TRACE(CSSComputedStyleDeclaration) | 701 DEFINE_TRACE(CSSComputedStyleDeclaration) |
| 702 { | 702 { |
| 703 visitor->trace(m_node); | 703 visitor->trace(m_node); |
| 704 CSSStyleDeclaration::trace(visitor); | 704 CSSStyleDeclaration::trace(visitor); |
| 705 } | 705 } |
| 706 | 706 |
| 707 } // namespace blink | 707 } // namespace blink |
| OLD | NEW |