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

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

Issue 1547183002: Catch null return value from computeComputedStyle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 return nullptr; 524 return nullptr;
525 if (m_node->isElementNode()) { 525 if (m_node->isElementNode()) {
526 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl ementSpecifier)) 526 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl ementSpecifier))
527 return element; 527 return element;
528 } 528 }
529 return m_node.get(); 529 return m_node.get();
530 } 530 }
531 531
532 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu e(AtomicString customPropertyName) const 532 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu e(AtomicString customPropertyName) const
533 { 533 {
534 return ComputedStyleCSSValueMapping::get(customPropertyName, *computeCompute dStyle()); 534 const ComputedStyle* style = computeComputedStyle();
535 if (!style)
536 return nullptr;
537 return ComputedStyleCSSValueMapping::get(customPropertyName, *style);
535 } 538 }
536 539
537 const HashMap<AtomicString, RefPtr<CSSVariableData>>* CSSComputedStyleDeclaratio n::getVariables() const 540 const HashMap<AtomicString, RefPtr<CSSVariableData>>* CSSComputedStyleDeclaratio n::getVariables() const
538 { 541 {
539 return ComputedStyleCSSValueMapping::getVariables(*computeComputedStyle()); 542 const ComputedStyle* style = computeComputedStyle();
543 if (!style)
544 return nullptr;
545 return ComputedStyleCSSValueMapping::getVariables(*style);
540 } 546 }
541 547
542 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu e(CSSPropertyID propertyID) const 548 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu e(CSSPropertyID propertyID) const
543 { 549 {
544 Node* styledNode = this->styledNode(); 550 Node* styledNode = this->styledNode();
545 if (!styledNode) 551 if (!styledNode)
546 return nullptr; 552 return nullptr;
547 LayoutObject* layoutObject = styledNode->layoutObject(); 553 LayoutObject* layoutObject = styledNode->layoutObject();
548 const ComputedStyle* style; 554 const ComputedStyle* style;
549 555
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a re computed, and therefore the '" + getPropertyNameString(id) + "' property is r ead-only."); 706 exceptionState.throwDOMException(NoModificationAllowedError, "These styles a re computed, and therefore the '" + getPropertyNameString(id) + "' property is r ead-only.");
701 } 707 }
702 708
703 DEFINE_TRACE(CSSComputedStyleDeclaration) 709 DEFINE_TRACE(CSSComputedStyleDeclaration)
704 { 710 {
705 visitor->trace(m_node); 711 visitor->trace(m_node);
706 CSSStyleDeclaration::trace(visitor); 712 CSSStyleDeclaration::trace(visitor);
707 } 713 }
708 714
709 } // namespace blink 715 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698