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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 183763027: Have ElementRareData::ensure*() methods return references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('j') | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after
3297 void Element::createUniqueElementData() 3297 void Element::createUniqueElementData()
3298 { 3298 {
3299 if (!m_elementData) 3299 if (!m_elementData)
3300 m_elementData = UniqueElementData::create(); 3300 m_elementData = UniqueElementData::create();
3301 else { 3301 else {
3302 ASSERT(!m_elementData->isUnique()); 3302 ASSERT(!m_elementData->isUnique());
3303 m_elementData = static_cast<ShareableElementData*>(m_elementData.get())- >makeUniqueCopy(); 3303 m_elementData = static_cast<ShareableElementData*>(m_elementData.get())- >makeUniqueCopy();
3304 } 3304 }
3305 } 3305 }
3306 3306
3307 InputMethodContext* Element::inputMethodContext() 3307 InputMethodContext& Element::inputMethodContext()
3308 { 3308 {
3309 return ensureElementRareData().ensureInputMethodContext(toHTMLElement(this)) ; 3309 return ensureElementRareData().ensureInputMethodContext(toHTMLElement(this)) ;
3310 } 3310 }
3311 3311
3312 bool Element::hasInputMethodContext() const 3312 bool Element::hasInputMethodContext() const
3313 { 3313 {
3314 return hasRareData() && elementRareData()->hasInputMethodContext(); 3314 return hasRareData() && elementRareData()->hasInputMethodContext();
3315 } 3315 }
3316 3316
3317 bool Element::hasPendingResources() const 3317 bool Element::hasPendingResources() const
(...skipping 19 matching lines...) Expand all
3337 elementData()->m_styleAttributeIsDirty = false; 3337 elementData()->m_styleAttributeIsDirty = false;
3338 const StylePropertySet* inlineStyle = this->inlineStyle(); 3338 const StylePropertySet* inlineStyle = this->inlineStyle();
3339 const_cast<Element*>(this)->setSynchronizedLazyAttribute(styleAttr, 3339 const_cast<Element*>(this)->setSynchronizedLazyAttribute(styleAttr,
3340 inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom); 3340 inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom);
3341 } 3341 }
3342 3342
3343 CSSStyleDeclaration* Element::style() 3343 CSSStyleDeclaration* Element::style()
3344 { 3344 {
3345 if (!isStyledElement()) 3345 if (!isStyledElement())
3346 return 0; 3346 return 0;
3347 return ensureElementRareData().ensureInlineCSSStyleDeclaration(this); 3347 return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this);
3348 } 3348 }
3349 3349
3350 MutableStylePropertySet& Element::ensureMutableInlineStyle() 3350 MutableStylePropertySet& Element::ensureMutableInlineStyle()
3351 { 3351 {
3352 ASSERT(isStyledElement()); 3352 ASSERT(isStyledElement());
3353 RefPtr<StylePropertySet>& inlineStyle = ensureUniqueElementData().m_inlineSt yle; 3353 RefPtr<StylePropertySet>& inlineStyle = ensureUniqueElementData().m_inlineSt yle;
3354 if (!inlineStyle) { 3354 if (!inlineStyle) {
3355 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H TMLQuirksMode : HTMLStandardMode; 3355 CSSParserMode mode = (!isHTMLElement() || document().inQuirksMode()) ? H TMLQuirksMode : HTMLStandardMode;
3356 inlineStyle = MutableStylePropertySet::create(mode); 3356 inlineStyle = MutableStylePropertySet::create(mode);
3357 } else if (!inlineStyle->isMutable()) { 3357 } else if (!inlineStyle->isMutable()) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3540 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3540 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3541 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3541 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3542 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3542 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3543 return false; 3543 return false;
3544 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3544 if (FullscreenElementStack::isActiveFullScreenElement(this))
3545 return false; 3545 return false;
3546 return true; 3546 return true;
3547 } 3547 }
3548 3548
3549 } // namespace WebCore 3549 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698