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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp
utedStyle& style) | 397 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp
utedStyle& style) |
398 { | 398 { |
399 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style),
CSSPrimitiveValue::UnitType::Pixels); | 399 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style),
CSSPrimitiveValue::UnitType::Pixels); |
400 } | 400 } |
401 | 401 |
402 CSSValue* CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() co
nst | 402 CSSValue* CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringKeyword() co
nst |
403 { | 403 { |
404 if (!m_node) | 404 if (!m_node) |
405 return nullptr; | 405 return nullptr; |
406 | 406 |
407 m_node->document().updateLayoutIgnorePendingStylesheets(); | 407 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
408 | 408 |
409 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElementSpec
ifier); | 409 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElementSpec
ifier); |
410 if (!style) | 410 if (!style) |
411 return nullptr; | 411 return nullptr; |
412 | 412 |
413 if (int keywordSize = style->getFontDescription().keywordSize()) | 413 if (int keywordSize = style->getFontDescription().keywordSize()) |
414 return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyw
ord(keywordSize)); | 414 return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyw
ord(keywordSize)); |
415 | 415 |
416 | 416 |
417 return zoomAdjustedPixelValue(style->getFontDescription().computedPixelSize(
), *style); | 417 return zoomAdjustedPixelValue(style->getFontDescription().computedPixelSize(
), *style); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert
yID) const | 531 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert
yID) const |
532 { | 532 { |
533 Node* styledNode = this->styledNode(); | 533 Node* styledNode = this->styledNode(); |
534 if (!styledNode) | 534 if (!styledNode) |
535 return nullptr; | 535 return nullptr; |
536 LayoutObject* layoutObject = styledNode->layoutObject(); | 536 LayoutObject* layoutObject = styledNode->layoutObject(); |
537 const ComputedStyle* style; | 537 const ComputedStyle* style; |
538 | 538 |
539 Document& document = styledNode->document(); | 539 Document& document = styledNode->document(); |
540 | 540 |
541 document.updateLayoutTreeForNode(styledNode); | 541 document.updateStyleAndLayoutTreeForNode(styledNode); |
542 | 542 |
543 // The style recalc could have caused the styled node to be discarded or rep
laced | 543 // 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. | 544 // if it was a PseudoElement so we need to update it. |
545 styledNode = this->styledNode(); | 545 styledNode = this->styledNode(); |
546 layoutObject = styledNode->layoutObject(); | 546 layoutObject = styledNode->layoutObject(); |
547 | 547 |
548 style = computeComputedStyle(); | 548 style = computeComputedStyle(); |
549 | 549 |
550 bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject) | 550 bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject) |
551 || styledNode->isInShadowTree() | 551 || styledNode->isInShadowTree() |
552 || (document.ownerElement() && document.ensureStyleResolver().hasViewpor
tDependentMediaQueries()); | 552 || (document.ownerElement() && document.ensureStyleResolver().hasViewpor
tDependentMediaQueries()); |
553 | 553 |
554 if (forceFullLayout) { | 554 if (forceFullLayout) { |
555 document.updateLayoutIgnorePendingStylesheetsForNode(styledNode); | 555 document.updateStyleAndLayoutIgnorePendingStylesheetsForNode(styledNode)
; |
556 styledNode = this->styledNode(); | 556 styledNode = this->styledNode(); |
557 style = computeComputedStyle(); | 557 style = computeComputedStyle(); |
558 layoutObject = styledNode->layoutObject(); | 558 layoutObject = styledNode->layoutObject(); |
559 } | 559 } |
560 | 560 |
561 if (!style) | 561 if (!style) |
562 return nullptr; | 562 return nullptr; |
563 | 563 |
564 CSSValue* value = ComputedStyleCSSValueMapping::get(propertyID, *style, layo
utObject, styledNode, m_allowVisitedStyle); | 564 CSSValue* value = ComputedStyleCSSValueMapping::get(propertyID, *style, layo
utObject, styledNode, m_allowVisitedStyle); |
565 if (value) | 565 if (value) |
(...skipping 23 matching lines...) Expand all Loading... |
589 { | 589 { |
590 if (i >= length()) | 590 if (i >= length()) |
591 return ""; | 591 return ""; |
592 | 592 |
593 return getPropertyNameString(computableProperties()[i]); | 593 return getPropertyNameString(computableProperties()[i]); |
594 } | 594 } |
595 | 595 |
596 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue* propertyValue) const | 596 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue* propertyValue) const |
597 { | 597 { |
598 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() &
& m_node) { | 598 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() &
& m_node) { |
599 m_node->document().updateLayoutIgnorePendingStylesheets(); | 599 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
600 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement
Specifier); | 600 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement
Specifier); |
601 if (style && style->getFontDescription().keywordSize()) { | 601 if (style && style->getFontDescription().keywordSize()) { |
602 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->getFon
tDescription().keywordSize()); | 602 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->getFon
tDescription().keywordSize()); |
603 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper
tyValue); | 603 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper
tyValue); |
604 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s
izeValue) | 604 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s
izeValue) |
605 return true; | 605 return true; |
606 } | 606 } |
607 } | 607 } |
608 CSSValue* value = getPropertyCSSValue(propertyID); | 608 CSSValue* value = getPropertyCSSValue(propertyID); |
609 return value && propertyValue && value->equals(*propertyValue); | 609 return value && propertyValue && value->equals(*propertyValue); |
(...skipping 79 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."); | 689 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a
re computed, and therefore the '" + getPropertyNameString(id) + "' property is r
ead-only."); |
690 } | 690 } |
691 | 691 |
692 DEFINE_TRACE(CSSComputedStyleDeclaration) | 692 DEFINE_TRACE(CSSComputedStyleDeclaration) |
693 { | 693 { |
694 visitor->trace(m_node); | 694 visitor->trace(m_node); |
695 CSSStyleDeclaration::trace(visitor); | 695 CSSStyleDeclaration::trace(visitor); |
696 } | 696 } |
697 | 697 |
698 } // namespace blink | 698 } // namespace blink |
OLD | NEW |