OLD | NEW |
---|---|
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 11 matching lines...) Expand all Loading... | |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/html/HTMLSourceElement.h" | 27 #include "core/html/HTMLSourceElement.h" |
28 | 28 |
29 #include "HTMLNames.h" | 29 #include "HTMLNames.h" |
30 #include "core/events/EventSender.h" | 30 #include "core/events/EventSender.h" |
31 #include "core/html/HTMLMediaElement.h" | 31 #include "core/html/HTMLMediaElement.h" |
32 #include "core/html/HTMLPictureElement.h" | |
32 #include "platform/Logging.h" | 33 #include "platform/Logging.h" |
33 | 34 |
34 using namespace std; | 35 using namespace std; |
35 | 36 |
36 namespace WebCore { | 37 namespace WebCore { |
37 | 38 |
38 using namespace HTMLNames; | 39 using namespace HTMLNames; |
39 | 40 |
40 static SourceEventSender& sourceErrorEventSender() | 41 static SourceEventSender& sourceErrorEventSender() |
41 { | 42 { |
(...skipping 17 matching lines...) Expand all Loading... | |
59 { | 60 { |
60 sourceErrorEventSender().cancelEvent(this); | 61 sourceErrorEventSender().cancelEvent(this); |
61 } | 62 } |
62 | 63 |
63 Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode * insertionPoint) | 64 Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode * insertionPoint) |
64 { | 65 { |
65 HTMLElement::insertedInto(insertionPoint); | 66 HTMLElement::insertedInto(insertionPoint); |
66 Element* parent = parentElement(); | 67 Element* parent = parentElement(); |
67 if (isHTMLMediaElement(parent)) | 68 if (isHTMLMediaElement(parent)) |
68 toHTMLMediaElement(parent)->sourceWasAdded(this); | 69 toHTMLMediaElement(parent)->sourceWasAdded(this); |
70 if (isHTMLPictureElement(parent)) | |
71 toHTMLPictureElement(parent)->sourceOrMediaChanged(); | |
69 return InsertionDone; | 72 return InsertionDone; |
70 } | 73 } |
71 | 74 |
72 void HTMLSourceElement::removedFrom(ContainerNode* removalRoot) | 75 void HTMLSourceElement::removedFrom(ContainerNode* removalRoot) |
73 { | 76 { |
74 Element* parent = parentElement(); | 77 Element* parent = parentElement(); |
75 if (!parent && removalRoot->isElementNode()) | 78 if (!parent && removalRoot->isElementNode()) |
76 parent = toElement(removalRoot); | 79 parent = toElement(removalRoot); |
77 if (isHTMLMediaElement(parent)) | 80 if (isHTMLMediaElement(parent)) |
78 toHTMLMediaElement(parent)->sourceWasRemoved(this); | 81 toHTMLMediaElement(parent)->sourceWasRemoved(this); |
82 if (isHTMLPictureElement(parent)) | |
83 toHTMLPictureElement(parent)->sourceOrMediaChanged(); | |
79 HTMLElement::removedFrom(removalRoot); | 84 HTMLElement::removedFrom(removalRoot); |
85 | |
Yoav Weiss
2014/05/23 07:39:17
Why the extra newline?
cbiesinger
2014/05/23 19:30:37
Done.
| |
80 } | 86 } |
81 | 87 |
82 void HTMLSourceElement::setSrc(const String& url) | 88 void HTMLSourceElement::setSrc(const String& url) |
83 { | 89 { |
84 setAttribute(srcAttr, AtomicString(url)); | 90 setAttribute(srcAttr, AtomicString(url)); |
85 } | 91 } |
86 | 92 |
87 const AtomicString& HTMLSourceElement::type() const | 93 const AtomicString& HTMLSourceElement::type() const |
88 { | 94 { |
89 return getAttribute(typeAttr); | 95 return getAttribute(typeAttr); |
(...skipping 21 matching lines...) Expand all Loading... | |
111 ASSERT_UNUSED(eventSender, eventSender == &sourceErrorEventSender()); | 117 ASSERT_UNUSED(eventSender, eventSender == &sourceErrorEventSender()); |
112 WTF_LOG(Media, "HTMLSourceElement::dispatchPendingEvent - %p", this); | 118 WTF_LOG(Media, "HTMLSourceElement::dispatchPendingEvent - %p", this); |
113 dispatchEvent(Event::createCancelable(EventTypeNames::error)); | 119 dispatchEvent(Event::createCancelable(EventTypeNames::error)); |
114 } | 120 } |
115 | 121 |
116 bool HTMLSourceElement::isURLAttribute(const Attribute& attribute) const | 122 bool HTMLSourceElement::isURLAttribute(const Attribute& attribute) const |
117 { | 123 { |
118 return attribute.name() == srcAttr || HTMLElement::isURLAttribute(attribute) ; | 124 return attribute.name() == srcAttr || HTMLElement::isURLAttribute(attribute) ; |
119 } | 125 } |
120 | 126 |
127 void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) | |
128 { | |
129 HTMLElement::parseAttribute(name, value); | |
130 if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) { | |
131 Element* parent = parentElement(); | |
132 if (isHTMLPictureElement(parent)) { | |
133 toHTMLPictureElement(parent)->sourceOrMediaChanged(); | |
134 } | |
Yoav Weiss
2014/05/23 07:39:17
No need for these braces
cbiesinger
2014/05/23 19:30:37
Done.
| |
135 } | |
121 } | 136 } |
137 | |
138 } | |
OLD | NEW |