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

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

Issue 181663002: Have Document::elementSheet() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/Document.cpp ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('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 3337 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 3348
3349 // We reconstruct the property set instead of mutating if there is no CSSOM wrapper. 3349 // We reconstruct the property set instead of mutating if there is no CSSOM wrapper.
3350 // This makes wrapperless property sets immutable and so cacheable. 3350 // This makes wrapperless property sets immutable and so cacheable.
3351 if (inlineStyle && !inlineStyle->isMutable()) 3351 if (inlineStyle && !inlineStyle->isMutable())
3352 inlineStyle.clear(); 3352 inlineStyle.clear();
3353 3353
3354 if (!inlineStyle) { 3354 if (!inlineStyle) {
3355 inlineStyle = BisonCSSParser::parseInlineStyleDeclaration(newStyleString , this); 3355 inlineStyle = BisonCSSParser::parseInlineStyleDeclaration(newStyleString , this);
3356 } else { 3356 } else {
3357 ASSERT(inlineStyle->isMutable()); 3357 ASSERT(inlineStyle->isMutable());
3358 static_pointer_cast<MutableStylePropertySet>(inlineStyle)->parseDeclarat ion(newStyleString, document().elementSheet()->contents()); 3358 static_pointer_cast<MutableStylePropertySet>(inlineStyle)->parseDeclarat ion(newStyleString, document().elementSheet().contents());
3359 } 3359 }
3360 } 3360 }
3361 3361
3362 void Element::styleAttributeChanged(const AtomicString& newStyleString, Attribut eModificationReason modificationReason) 3362 void Element::styleAttributeChanged(const AtomicString& newStyleString, Attribut eModificationReason modificationReason)
3363 { 3363 {
3364 ASSERT(isStyledElement()); 3364 ASSERT(isStyledElement());
3365 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst(); 3365 WTF::OrdinalNumber startLineNumber = WTF::OrdinalNumber::beforeFirst();
3366 if (document().scriptableDocumentParser() && !document().isInDocumentWrite() ) 3366 if (document().scriptableDocumentParser() && !document().isInDocumentWrite() )
3367 startLineNumber = document().scriptableDocumentParser()->lineNumber(); 3367 startLineNumber = document().scriptableDocumentParser()->lineNumber();
3368 3368
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 { 3407 {
3408 ASSERT(isStyledElement()); 3408 ASSERT(isStyledElement());
3409 ensureMutableInlineStyle()->setProperty(propertyID, cssValuePool().createVal ue(value, unit), important); 3409 ensureMutableInlineStyle()->setProperty(propertyID, cssValuePool().createVal ue(value, unit), important);
3410 inlineStyleChanged(); 3410 inlineStyleChanged();
3411 return true; 3411 return true;
3412 } 3412 }
3413 3413
3414 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const String& val ue, bool important) 3414 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, const String& val ue, bool important)
3415 { 3415 {
3416 ASSERT(isStyledElement()); 3416 ASSERT(isStyledElement());
3417 bool changes = ensureMutableInlineStyle()->setProperty(propertyID, value, im portant, document().elementSheet()->contents()); 3417 bool changes = ensureMutableInlineStyle()->setProperty(propertyID, value, im portant, document().elementSheet().contents());
3418 if (changes) 3418 if (changes)
3419 inlineStyleChanged(); 3419 inlineStyleChanged();
3420 return changes; 3420 return changes;
3421 } 3421 }
3422 3422
3423 bool Element::removeInlineStyleProperty(CSSPropertyID propertyID) 3423 bool Element::removeInlineStyleProperty(CSSPropertyID propertyID)
3424 { 3424 {
3425 ASSERT(isStyledElement()); 3425 ASSERT(isStyledElement());
3426 if (!inlineStyle()) 3426 if (!inlineStyle())
3427 return false; 3427 return false;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3510 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3510 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3511 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3511 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3512 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3512 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3513 return false; 3513 return false;
3514 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3514 if (FullscreenElementStack::isActiveFullScreenElement(this))
3515 return false; 3515 return false;
3516 return true; 3516 return true;
3517 } 3517 }
3518 3518
3519 } // namespace WebCore 3519 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698