Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 1225553002: CSSValue Immediates: Make CSSPrimitiveValue a container (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_1
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a re computed, and therefore read-only."); 403 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a re computed, and therefore read-only.");
404 } 404 }
405 405
406 static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize) 406 static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
407 { 407 {
408 ASSERT_ARG(keywordSize, keywordSize); 408 ASSERT_ARG(keywordSize, keywordSize);
409 ASSERT_ARG(keywordSize, keywordSize <= 8); 409 ASSERT_ARG(keywordSize, keywordSize <= 8);
410 return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1); 410 return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1);
411 } 411 }
412 412
413 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(d ouble value, const ComputedStyle& style) 413 inline static CSSPrimitiveValue zoomAdjustedPixelValue(double value, const Compu tedStyle& style)
414 { 414 {
415 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX); 415 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
416 } 416 }
417 417
418 NullableCSSValue CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeywo rd() const 418 NullableCSSValue CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeywo rd() const
419 { 419 {
420 if (!m_node) 420 if (!m_node)
421 return nullptr; 421 return nullptr;
422 422
423 m_node->document().updateLayoutIgnorePendingStylesheets(); 423 m_node->document().updateLayoutIgnorePendingStylesheets();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(proper tyValue); 613 const CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(propert yValue);
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
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
OLDNEW
« no previous file with comments | « Source/core/css/CSSCalculationValueTest.cpp ('k') | Source/core/css/CSSContentDistributionValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698