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

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

Issue 1896793002: Rename (updateLayout/updateStyle).*.() to updateStyleAndLayout.*.() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(); 517 Node* styledNode = this->styledNode();
518 if (!styledNode) 518 if (!styledNode)
519 return nullptr; 519 return nullptr;
520 520
521 styledNode->document().updateLayoutTreeForNode(styledNode); 521 styledNode->document().updateStyleAndLayoutTreeForNode(styledNode);
522 522
523 const ComputedStyle* style = computeComputedStyle(); 523 const ComputedStyle* style = computeComputedStyle();
524 if (!style) 524 if (!style)
525 return nullptr; 525 return nullptr;
526 return ComputedStyleCSSValueMapping::get(customPropertyName, *style); 526 return ComputedStyleCSSValueMapping::get(customPropertyName, *style);
527 } 527 }
528 528
529 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> CSSComputedStyle Declaration::getVariables() const 529 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> CSSComputedStyle Declaration::getVariables() const
530 { 530 {
531 const ComputedStyle* style = computeComputedStyle(); 531 const ComputedStyle* style = computeComputedStyle();
532 if (!style) 532 if (!style)
533 return nullptr; 533 return nullptr;
534 return ComputedStyleCSSValueMapping::getVariables(*style); 534 return ComputedStyleCSSValueMapping::getVariables(*style);
535 } 535 }
536 536
537 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert yID) const 537 CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert yID) const
538 { 538 {
539 Node* styledNode = this->styledNode(); 539 Node* styledNode = this->styledNode();
540 if (!styledNode) 540 if (!styledNode)
541 return nullptr; 541 return nullptr;
542 542
543 Document& document = styledNode->document(); 543 Document& document = styledNode->document();
544 document.updateLayoutTreeForNode(styledNode); 544 document.updateStyleAndLayoutTreeForNode(styledNode);
545 545
546 // 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
547 // if it was a PseudoElement so we need to update it. 547 // if it was a PseudoElement so we need to update it.
548 styledNode = this->styledNode(); 548 styledNode = this->styledNode();
549 LayoutObject* layoutObject = styledNode->layoutObject(); 549 LayoutObject* layoutObject = styledNode->layoutObject();
550 550
551 const ComputedStyle* style = computeComputedStyle(); 551 const ComputedStyle* style = computeComputedStyle();
552 552
553 bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject) 553 bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject)
554 || styledNode->isInShadowTree() 554 || styledNode->isInShadowTree()
555 || (document.ownerElement() && document.ensureStyleResolver().hasViewpor tDependentMediaQueries()); 555 || (document.ownerElement() && document.ensureStyleResolver().hasViewpor tDependentMediaQueries());
556 556
557 if (forceFullLayout) { 557 if (forceFullLayout) {
558 document.updateLayoutIgnorePendingStylesheetsForNode(styledNode); 558 document.updateStyleAndLayoutIgnorePendingStylesheetsForNode(styledNode) ;
559 styledNode = this->styledNode(); 559 styledNode = this->styledNode();
560 style = computeComputedStyle(); 560 style = computeComputedStyle();
561 layoutObject = styledNode->layoutObject(); 561 layoutObject = styledNode->layoutObject();
562 } 562 }
563 563
564 if (!style) 564 if (!style)
565 return nullptr; 565 return nullptr;
566 566
567 CSSValue* value = ComputedStyleCSSValueMapping::get(propertyID, *style, layo utObject, styledNode, m_allowVisitedStyle); 567 CSSValue* value = ComputedStyleCSSValueMapping::get(propertyID, *style, layo utObject, styledNode, m_allowVisitedStyle);
568 if (value) 568 if (value)
(...skipping 23 matching lines...) Expand all
592 { 592 {
593 if (i >= length()) 593 if (i >= length())
594 return ""; 594 return "";
595 595
596 return getPropertyNameString(computableProperties()[i]); 596 return getPropertyNameString(computableProperties()[i]);
597 } 597 }
598 598
599 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c onst CSSValue* propertyValue) const 599 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c onst CSSValue* propertyValue) const
600 { 600 {
601 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() & & m_node) { 601 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() & & m_node) {
602 m_node->document().updateLayoutIgnorePendingStylesheets(); 602 m_node->document().updateStyleAndLayoutIgnorePendingStylesheets();
603 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement Specifier); 603 const ComputedStyle* style = m_node->ensureComputedStyle(m_pseudoElement Specifier);
604 if (style && style->getFontDescription().keywordSize()) { 604 if (style && style->getFontDescription().keywordSize()) {
605 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->getFon tDescription().keywordSize()); 605 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->getFon tDescription().keywordSize());
606 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper tyValue); 606 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper tyValue);
607 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s izeValue) 607 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s izeValue)
608 return true; 608 return true;
609 } 609 }
610 } 610 }
611 CSSValue* value = getPropertyCSSValue(propertyID); 611 CSSValue* value = getPropertyCSSValue(propertyID);
612 return value && propertyValue && value->equals(*propertyValue); 612 return value && propertyValue && value->equals(*propertyValue);
(...skipping 79 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

Powered by Google App Engine
This is Rietveld 408576698