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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp
utedStyle& style) | 398 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp
utedStyle& style) |
399 { | 399 { |
400 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style),
CSSPrimitiveValue::UnitType::Pixels); | 400 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style),
CSSPrimitiveValue::UnitType::Pixels); |
401 } | 401 } |
402 | 402 |
403 CSSValue* CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() co
nst | 403 CSSValue* CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() co
nst |
404 { | 404 { |
405 if (!m_node) | 405 if (!m_node) |
406 return nullptr; | 406 return nullptr; |
407 | 407 |
408 m_node->document().updateLayoutIgnorePendingStylesheets(); | 408 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
409 | 409 |
410 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElementSpec
ifier); | 410 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElementSpec
ifier); |
411 if (!style) | 411 if (!style) |
412 return nullptr; | 412 return nullptr; |
413 | 413 |
414 if (int keywordSize = style->getFontDescription().keywordSize()) | 414 if (int keywordSize = style->getFontDescription().keywordSize()) |
415 return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyw
ord(keywordSize)); | 415 return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyw
ord(keywordSize)); |
416 | 416 |
417 | 417 |
418 return zoomAdjustedPixelValue(style->getFontDescription().computedPixelSize(
), *style); | 418 return zoomAdjustedPixelValue(style->getFontDescription().computedPixelSize(
), *style); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 512 } |
513 return m_node.get(); | 513 return m_node.get(); |
514 } | 514 } |
515 | 515 |
516 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(AtomicString customPr
opertyName) const | 516 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(AtomicString customPr
opertyName) const |
517 { | 517 { |
518 Node* styledNode = this->styledNode(); | 518 Node* styledNode = this->styledNode(); |
519 if (!styledNode) | 519 if (!styledNode) |
520 return nullptr; | 520 return nullptr; |
521 | 521 |
522 styledNode->document().updateLayoutTreeForNode(styledNode); | 522 styledNode->document().updateStyleAndLayoutTreeForNode(styledNode); |
523 | 523 |
524 const ComputedStyle* style = computeComputedStyle(); | 524 const ComputedStyle* style = computeComputedStyle(); |
525 if (!style) | 525 if (!style) |
526 return nullptr; | 526 return nullptr; |
527 return ComputedStyleCSSValueMapping::get(customPropertyName, *style); | 527 return ComputedStyleCSSValueMapping::get(customPropertyName, *style); |
528 } | 528 } |
529 | 529 |
530 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> CSSComputedStyle
Declaration::getVariables() const | 530 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> CSSComputedStyle
Declaration::getVariables() const |
531 { | 531 { |
532 const ComputedStyle* style = computeComputedStyle(); | 532 const ComputedStyle* style = computeComputedStyle(); |
533 if (!style) | 533 if (!style) |
534 return nullptr; | 534 return nullptr; |
535 return ComputedStyleCSSValueMapping::getVariables(*style); | 535 return ComputedStyleCSSValueMapping::getVariables(*style); |
536 } | 536 } |
537 | 537 |
538 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert
yID) const | 538 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert
yID) const |
539 { | 539 { |
540 Node* styledNode = this->styledNode(); | 540 Node* styledNode = this->styledNode(); |
541 if (!styledNode) | 541 if (!styledNode) |
542 return nullptr; | 542 return nullptr; |
543 | 543 |
544 Document& document = styledNode->document(); | 544 Document& document = styledNode->document(); |
545 document.updateLayoutTreeForNode(styledNode); | 545 document.updateStyleAndLayoutTreeForNode(styledNode); |
546 | 546 |
547 // The style recalc could have caused the styled node to be discarded or rep
laced | 547 // The style recalc could have caused the styled node to be discarded or rep
laced |
548 // if it was a PseudoElement so we need to update it. | 548 // if it was a PseudoElement so we need to update it. |
549 styledNode = this->styledNode(); | 549 styledNode = this->styledNode(); |
550 LayoutObject* layoutObject = styledNode->layoutObject(); | 550 LayoutObject* layoutObject = styledNode->layoutObject(); |
551 | 551 |
552 const ComputedStyle* style = computeComputedStyle(); | 552 const ComputedStyle* style = computeComputedStyle(); |
553 | 553 |
554 bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject) | 554 bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject) |
555 || styledNode->isInShadowTree() | 555 || styledNode->isInShadowTree() |
556 || (document.localOwner() && document.ensureStyleResolver().hasViewportD
ependentMediaQueries()); | 556 || (document.localOwner() && document.ensureStyleResolver().hasViewportD
ependentMediaQueries()); |
557 | 557 |
558 if (forceFullLayout) { | 558 if (forceFullLayout) { |
559 document.updateLayoutIgnorePendingStylesheetsForNode(styledNode); | 559 document.updateStyleAndLayoutIgnorePendingStylesheetsForNode(styledNode)
; |
560 styledNode = this->styledNode(); | 560 styledNode = this->styledNode(); |
561 style = computeComputedStyle(); | 561 style = computeComputedStyle(); |
562 layoutObject = styledNode->layoutObject(); | 562 layoutObject = styledNode->layoutObject(); |
563 } | 563 } |
564 | 564 |
565 if (!style) | 565 if (!style) |
566 return nullptr; | 566 return nullptr; |
567 | 567 |
568 CSSValue* value = ComputedStyleCSSValueMapping::get(propertyID, *style, layo
utObject, styledNode, m_allowVisitedStyle); | 568 CSSValue* value = ComputedStyleCSSValueMapping::get(propertyID, *style, layo
utObject, styledNode, m_allowVisitedStyle); |
569 if (value) | 569 if (value) |
(...skipping 23 matching lines...) Expand all Loading... |
593 { | 593 { |
594 if (i >= length()) | 594 if (i >= length()) |
595 return ""; | 595 return ""; |
596 | 596 |
597 return getPropertyNameString(computableProperties()[i]); | 597 return getPropertyNameString(computableProperties()[i]); |
598 } | 598 } |
599 | 599 |
600 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue* propertyValue) const | 600 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue* propertyValue) const |
601 { | 601 { |
602 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() &
& m_node) { | 602 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() &
& m_node) { |
603 m_node->document().updateLayoutIgnorePendingStylesheets(); | 603 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
604 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement
Specifier); | 604 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement
Specifier); |
605 if (style && style->getFontDescription().keywordSize()) { | 605 if (style && style->getFontDescription().keywordSize()) { |
606 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->getFon
tDescription().keywordSize()); | 606 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->getFon
tDescription().keywordSize()); |
607 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper
tyValue); | 607 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper
tyValue); |
608 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s
izeValue) | 608 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s
izeValue) |
609 return true; | 609 return true; |
610 } | 610 } |
611 } | 611 } |
612 CSSValue* value = getPropertyCSSValue(propertyID); | 612 CSSValue* value = getPropertyCSSValue(propertyID); |
613 return value && propertyValue && value->equals(*propertyValue); | 613 return value && propertyValue && value->equals(*propertyValue); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); | 693 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); |
694 } | 694 } |
695 | 695 |
696 DEFINE_TRACE(CSSComputedStyleDeclaration) | 696 DEFINE_TRACE(CSSComputedStyleDeclaration) |
697 { | 697 { |
698 visitor->trace(m_node); | 698 visitor->trace(m_node); |
699 CSSStyleDeclaration::trace(visitor); | 699 CSSStyleDeclaration::trace(visitor); |
700 } | 700 } |
701 | 701 |
702 } // namespace blink | 702 } // namespace blink |
OLD | NEW |