| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 return nullptr; | 507 return nullptr; |
| 508 if (m_node->isElementNode()) { | 508 if (m_node->isElementNode()) { |
| 509 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl
ementSpecifier)) | 509 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl
ementSpecifier)) |
| 510 return element; | 510 return element; |
| 511 } | 511 } |
| 512 return m_node.get(); | 512 return m_node.get(); |
| 513 } | 513 } |
| 514 | 514 |
| 515 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(AtomicString customPr
opertyName) const | 515 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(AtomicString customPr
opertyName) const |
| 516 { | 516 { |
| 517 Node* styledNode = this->styledNode(); |
| 518 if (!styledNode) |
| 519 return nullptr; |
| 520 |
| 521 styledNode->document().updateLayoutTreeForNode(styledNode); |
| 522 |
| 517 const ComputedStyle* style = computeComputedStyle(); | 523 const ComputedStyle* style = computeComputedStyle(); |
| 518 if (!style) | 524 if (!style) |
| 519 return nullptr; | 525 return nullptr; |
| 520 return ComputedStyleCSSValueMapping::get(customPropertyName, *style); | 526 return ComputedStyleCSSValueMapping::get(customPropertyName, *style); |
| 521 } | 527 } |
| 522 | 528 |
| 523 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> CSSComputedStyle
Declaration::getVariables() const | 529 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> CSSComputedStyle
Declaration::getVariables() const |
| 524 { | 530 { |
| 525 const ComputedStyle* style = computeComputedStyle(); | 531 const ComputedStyle* style = computeComputedStyle(); |
| 526 if (!style) | 532 if (!style) |
| 527 return nullptr; | 533 return nullptr; |
| 528 return ComputedStyleCSSValueMapping::getVariables(*style); | 534 return ComputedStyleCSSValueMapping::getVariables(*style); |
| 529 } | 535 } |
| 530 | 536 |
| 531 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert
yID) const | 537 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert
yID) const |
| 532 { | 538 { |
| 533 Node* styledNode = this->styledNode(); | 539 Node* styledNode = this->styledNode(); |
| 534 if (!styledNode) | 540 if (!styledNode) |
| 535 return nullptr; | 541 return nullptr; |
| 536 LayoutObject* layoutObject = styledNode->layoutObject(); | |
| 537 const ComputedStyle* style; | |
| 538 | 542 |
| 539 Document& document = styledNode->document(); | 543 Document& document = styledNode->document(); |
| 540 | |
| 541 document.updateLayoutTreeForNode(styledNode); | 544 document.updateLayoutTreeForNode(styledNode); |
| 542 | 545 |
| 543 // The style recalc could have caused the styled node to be discarded or rep
laced | 546 // The style recalc could have caused the styled node to be discarded or rep
laced |
| 544 // if it was a PseudoElement so we need to update it. | 547 // if it was a PseudoElement so we need to update it. |
| 545 styledNode = this->styledNode(); | 548 styledNode = this->styledNode(); |
| 546 layoutObject = styledNode->layoutObject(); | 549 LayoutObject* layoutObject = styledNode->layoutObject(); |
| 547 | 550 |
| 548 style = computeComputedStyle(); | 551 const ComputedStyle* style = computeComputedStyle(); |
| 549 | 552 |
| 550 bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject) | 553 bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject) |
| 551 || styledNode->isInShadowTree() | 554 || styledNode->isInShadowTree() |
| 552 || (document.ownerElement() && document.ensureStyleResolver().hasViewpor
tDependentMediaQueries()); | 555 || (document.ownerElement() && document.ensureStyleResolver().hasViewpor
tDependentMediaQueries()); |
| 553 | 556 |
| 554 if (forceFullLayout) { | 557 if (forceFullLayout) { |
| 555 document.updateLayoutIgnorePendingStylesheetsForNode(styledNode); | 558 document.updateLayoutIgnorePendingStylesheetsForNode(styledNode); |
| 556 styledNode = this->styledNode(); | 559 styledNode = this->styledNode(); |
| 557 style = computeComputedStyle(); | 560 style = computeComputedStyle(); |
| 558 layoutObject = styledNode->layoutObject(); | 561 layoutObject = styledNode->layoutObject(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 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."); |
| 690 } | 693 } |
| 691 | 694 |
| 692 DEFINE_TRACE(CSSComputedStyleDeclaration) | 695 DEFINE_TRACE(CSSComputedStyleDeclaration) |
| 693 { | 696 { |
| 694 visitor->trace(m_node); | 697 visitor->trace(m_node); |
| 695 CSSStyleDeclaration::trace(visitor); | 698 CSSStyleDeclaration::trace(visitor); |
| 696 } | 699 } |
| 697 | 700 |
| 698 } // namespace blink | 701 } // namespace blink |
| OLD | NEW |