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

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

Issue 2625873010: Resolve CSS url(...) non-<image> values against the correct base (Closed)
Patch Set: Rebase Created 3 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
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. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 22 matching lines...) Expand all
33 #include "bindings/core/v8/V8DOMActivityLogger.h" 33 #include "bindings/core/v8/V8DOMActivityLogger.h"
34 #include "bindings/core/v8/V8DOMWrapper.h" 34 #include "bindings/core/v8/V8DOMWrapper.h"
35 #include "bindings/core/v8/V8PerContextData.h" 35 #include "bindings/core/v8/V8PerContextData.h"
36 #include "core/CSSValueKeywords.h" 36 #include "core/CSSValueKeywords.h"
37 #include "core/SVGNames.h" 37 #include "core/SVGNames.h"
38 #include "core/XMLNames.h" 38 #include "core/XMLNames.h"
39 #include "core/animation/AnimationTimeline.h" 39 #include "core/animation/AnimationTimeline.h"
40 #include "core/animation/CustomCompositorAnimations.h" 40 #include "core/animation/CustomCompositorAnimations.h"
41 #include "core/animation/css/CSSAnimations.h" 41 #include "core/animation/css/CSSAnimations.h"
42 #include "core/css/CSSIdentifierValue.h" 42 #include "core/css/CSSIdentifierValue.h"
43 #include "core/css/CSSImageValue.h"
44 #include "core/css/CSSPrimitiveValue.h" 43 #include "core/css/CSSPrimitiveValue.h"
45 #include "core/css/CSSStyleSheet.h" 44 #include "core/css/CSSStyleSheet.h"
45 #include "core/css/CSSValue.h"
46 #include "core/css/PropertySetCSSStyleDeclaration.h" 46 #include "core/css/PropertySetCSSStyleDeclaration.h"
47 #include "core/css/StylePropertySet.h" 47 #include "core/css/StylePropertySet.h"
48 #include "core/css/parser/CSSParser.h" 48 #include "core/css/parser/CSSParser.h"
49 #include "core/css/resolver/SelectorFilterParentScope.h" 49 #include "core/css/resolver/SelectorFilterParentScope.h"
50 #include "core/css/resolver/StyleResolver.h" 50 #include "core/css/resolver/StyleResolver.h"
51 #include "core/css/resolver/StyleResolverStats.h" 51 #include "core/css/resolver/StyleResolverStats.h"
52 #include "core/css/resolver/StyleSharingDepthScope.h" 52 #include "core/css/resolver/StyleSharingDepthScope.h"
53 #include "core/dom/AXObjectCache.h" 53 #include "core/dom/AXObjectCache.h"
54 #include "core/dom/Attr.h" 54 #include "core/dom/Attr.h"
55 #include "core/dom/CSSSelectorWatch.h" 55 #include "core/dom/CSSSelectorWatch.h"
(...skipping 3543 matching lines...) Expand 10 before | Expand all | Expand 10 after
3599 const Document& oldDocument, 3599 const Document& oldDocument,
3600 const Document& newDocument) { 3600 const Document& newDocument) {
3601 if (oldDocument == newDocument) 3601 if (oldDocument == newDocument)
3602 return false; 3602 return false;
3603 if (oldDocument.baseURL() == newDocument.baseURL()) 3603 if (oldDocument.baseURL() == newDocument.baseURL())
3604 return false; 3604 return false;
3605 const StylePropertySet* style = element.inlineStyle(); 3605 const StylePropertySet* style = element.inlineStyle();
3606 if (!style) 3606 if (!style)
3607 return false; 3607 return false;
3608 for (unsigned i = 0; i < style->propertyCount(); ++i) { 3608 for (unsigned i = 0; i < style->propertyCount(); ++i) {
3609 // FIXME: Should handle all URL-based properties: CSSImageSetValue, 3609 if (style->propertyAt(i).value().mayContainUrl())
3610 // CSSCursorImageValue, etc.
3611 if (style->propertyAt(i).value().isImageValue())
3612 return true; 3610 return true;
3613 } 3611 }
3614 return false; 3612 return false;
3615 } 3613 }
3616 3614
3617 static void reResolveURLsInInlineStyle(const Document& document, 3615 static void reResolveURLsInInlineStyle(const Document& document,
3618 MutableStylePropertySet& style) { 3616 MutableStylePropertySet& style) {
3619 for (unsigned i = 0; i < style.propertyCount(); ++i) { 3617 for (unsigned i = 0; i < style.propertyCount(); ++i) {
3620 StylePropertySet::PropertyReference property = style.propertyAt(i); 3618 const CSSValue& value = style.propertyAt(i).value();
3621 // FIXME: Should handle all URL-based properties: CSSImageSetValue, 3619 if (value.mayContainUrl())
3622 // CSSCursorImageValue, etc. 3620 value.reResolveUrl(document);
3623 if (property.value().isImageValue())
3624 toCSSImageValue(property.value()).reResolveURL(document);
3625 } 3621 }
3626 } 3622 }
3627 3623
3628 void Element::didMoveToNewDocument(Document& oldDocument) { 3624 void Element::didMoveToNewDocument(Document& oldDocument) {
3629 Node::didMoveToNewDocument(oldDocument); 3625 Node::didMoveToNewDocument(oldDocument);
3630 3626
3631 // If the documents differ by quirks mode then they differ by case sensitivity 3627 // If the documents differ by quirks mode then they differ by case sensitivity
3632 // for class and id names so we need to go through the attribute change logic 3628 // for class and id names so we need to go through the attribute change logic
3633 // to pick up the new casing in the ElementData. 3629 // to pick up the new casing in the ElementData.
3634 if (oldDocument.inQuirksMode() != document().inQuirksMode()) { 3630 if (oldDocument.inQuirksMode() != document().inQuirksMode()) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
4130 } 4126 }
4131 4127
4132 DEFINE_TRACE_WRAPPERS(Element) { 4128 DEFINE_TRACE_WRAPPERS(Element) {
4133 if (hasRareData()) { 4129 if (hasRareData()) {
4134 visitor->traceWrappers(elementRareData()); 4130 visitor->traceWrappers(elementRareData());
4135 } 4131 }
4136 ContainerNode::traceWrappers(visitor); 4132 ContainerNode::traceWrappers(visitor);
4137 } 4133 }
4138 4134
4139 } // namespace blink 4135 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698