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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSourceElement.cpp

Issue 1511523002: Align HTMLImageElement relevant mutations to spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix removal issue when a text node is between <source> and <img> Created 5 years 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) 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 HTMLElement::didMoveToNewDocument(oldDocument); 101 HTMLElement::didMoveToNewDocument(oldDocument);
102 } 102 }
103 103
104 Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode * insertionPoint) 104 Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode * insertionPoint)
105 { 105 {
106 HTMLElement::insertedInto(insertionPoint); 106 HTMLElement::insertedInto(insertionPoint);
107 Element* parent = parentElement(); 107 Element* parent = parentElement();
108 if (isHTMLMediaElement(parent)) 108 if (isHTMLMediaElement(parent))
109 toHTMLMediaElement(parent)->sourceWasAdded(this); 109 toHTMLMediaElement(parent)->sourceWasAdded(this);
110 if (isHTMLPictureElement(parent)) 110 if (isHTMLPictureElement(parent))
111 toHTMLPictureElement(parent)->sourceOrMediaChanged(); 111 toHTMLPictureElement(parent)->sourceOrMediaChanged(this);
112 return InsertionDone; 112 return InsertionDone;
113 } 113 }
114 114
115 void HTMLSourceElement::removedFrom(ContainerNode* removalRoot) 115 void HTMLSourceElement::removedFrom(ContainerNode* insertionPoint, Node* next)
116 { 116 {
117 Element* parent = parentElement(); 117 Element* parent = parentElement();
118 if (!parent && removalRoot->isElementNode()) 118 if (!parent && insertionPoint->isElementNode())
119 parent = toElement(removalRoot); 119 parent = toElement(insertionPoint);
120 if (isHTMLMediaElement(parent)) 120 if (isHTMLMediaElement(parent))
121 toHTMLMediaElement(parent)->sourceWasRemoved(this); 121 toHTMLMediaElement(parent)->sourceWasRemoved(this);
122 if (isHTMLPictureElement(parent)) 122 if (isHTMLPictureElement(parent))
123 toHTMLPictureElement(parent)->sourceOrMediaChanged(); 123 toHTMLPictureElement(parent)->sourceOrMediaChanged(this, next);
124 HTMLElement::removedFrom(removalRoot); 124 HTMLElement::removedFrom(insertionPoint, next);
125 } 125 }
126 126
127 void HTMLSourceElement::setSrc(const String& url) 127 void HTMLSourceElement::setSrc(const String& url)
128 { 128 {
129 setAttribute(srcAttr, AtomicString(url)); 129 setAttribute(srcAttr, AtomicString(url));
130 } 130 }
131 131
132 const AtomicString& HTMLSourceElement::type() const 132 const AtomicString& HTMLSourceElement::type() const
133 { 133 {
134 return getAttribute(typeAttr); 134 return getAttribute(typeAttr);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 172 }
173 173
174 void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& oldValue, const AtomicString& value) 174 void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& oldValue, const AtomicString& value)
175 { 175 {
176 HTMLElement::parseAttribute(name, oldValue, value); 176 HTMLElement::parseAttribute(name, oldValue, value);
177 if (name == mediaAttr) 177 if (name == mediaAttr)
178 createMediaQueryList(value); 178 createMediaQueryList(value);
179 if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) { 179 if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) {
180 Element* parent = parentElement(); 180 Element* parent = parentElement();
181 if (isHTMLPictureElement(parent)) 181 if (isHTMLPictureElement(parent))
182 toHTMLPictureElement(parent)->sourceOrMediaChanged(); 182 toHTMLPictureElement(parent)->sourceOrMediaChanged(this);
183 } 183 }
184 } 184 }
185 185
186 void HTMLSourceElement::notifyMediaQueryChanged() 186 void HTMLSourceElement::notifyMediaQueryChanged()
187 { 187 {
188 Element* parent = parentElement(); 188 Element* parent = parentElement();
189 if (isHTMLPictureElement(parent)) 189 if (isHTMLPictureElement(parent))
190 toHTMLPictureElement(parent)->sourceOrMediaChanged(); 190 toHTMLPictureElement(parent)->sourceOrMediaChanged(this);
191 } 191 }
192 192
193 DEFINE_TRACE(HTMLSourceElement) 193 DEFINE_TRACE(HTMLSourceElement)
194 { 194 {
195 visitor->trace(m_mediaQueryList); 195 visitor->trace(m_mediaQueryList);
196 visitor->trace(m_listener); 196 visitor->trace(m_listener);
197 HTMLElement::trace(visitor); 197 HTMLElement::trace(visitor);
198 } 198 }
199 199
200 } 200 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698