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

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

Issue 1522253002: Revert of Align HTMLImageElement relevant mutations to spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/html/HTMLPictureElement.h" 6 #include "core/html/HTMLPictureElement.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/dom/ElementTraversal.h" 9 #include "core/dom/ElementTraversal.h"
10 #include "core/frame/UseCounter.h" 10 #include "core/frame/UseCounter.h"
11 #include "core/html/HTMLImageElement.h" 11 #include "core/html/HTMLImageElement.h"
12 #include "core/html/HTMLSourceElement.h"
13 #include "core/loader/ImageLoader.h" 12 #include "core/loader/ImageLoader.h"
14 13
15 namespace blink { 14 namespace blink {
16 15
17 using namespace HTMLNames; 16 using namespace HTMLNames;
18 17
19 inline HTMLPictureElement::HTMLPictureElement(Document& document) 18 inline HTMLPictureElement::HTMLPictureElement(Document& document)
20 : HTMLElement(pictureTag, document) 19 : HTMLElement(pictureTag, document)
21 { 20 {
22 } 21 }
23 22
24 DEFINE_NODE_FACTORY(HTMLPictureElement) 23 DEFINE_NODE_FACTORY(HTMLPictureElement)
25 24
26 void HTMLPictureElement::sourceOrMediaChanged(HTMLElement* sourceElement, Node* next) 25 void HTMLPictureElement::sourceOrMediaChanged()
27 { 26 {
28 bool seenSource = false; 27 for (HTMLImageElement* imageElement = Traversal<HTMLImageElement>::firstChil d(*this); imageElement; imageElement = Traversal<HTMLImageElement>::nextSibling( *imageElement)) {
29 Node* node; 28 imageElement->selectSourceURL(ImageLoader::UpdateNormal);
30 NodeVector potentialSourceNodes;
31 getChildNodes(*this, potentialSourceNodes);
32
33 for (unsigned i = 0; i < potentialSourceNodes.size(); ++i) {
34 node = potentialSourceNodes[i].get();
35 if (sourceElement == node || (next && node == next))
36 seenSource = true;
37 if (isHTMLImageElement(node) && seenSource)
38 toHTMLImageElement(node)->selectSourceURL(ImageLoader::UpdateNormal) ;
39 } 29 }
40 } 30 }
41 31
42 Node::InsertionNotificationRequest HTMLPictureElement::insertedInto(ContainerNod e* insertionPoint) 32 Node::InsertionNotificationRequest HTMLPictureElement::insertedInto(ContainerNod e* insertionPoint)
43 { 33 {
44 UseCounter::count(document(), UseCounter::Picture); 34 UseCounter::count(document(), UseCounter::Picture);
45 return HTMLElement::insertedInto(insertionPoint); 35 return HTMLElement::insertedInto(insertionPoint);
46 } 36 }
47 37
48 } // namespace 38 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLPictureElement.h ('k') | third_party/WebKit/Source/core/html/HTMLPlugInElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698