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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tag
Name, Document* document) | 52 PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tag
Name, Document* document) |
53 { | 53 { |
54 return adoptRef(new HTMLSourceElement(tagName, document)); | 54 return adoptRef(new HTMLSourceElement(tagName, document)); |
55 } | 55 } |
56 | 56 |
57 void HTMLSourceElement::insertedIntoTree(bool deep) | 57 void HTMLSourceElement::insertedIntoTree(bool deep) |
58 { | 58 { |
59 HTMLElement::insertedIntoTree(deep); | 59 HTMLElement::insertedIntoTree(deep); |
60 if (parentNode() && (parentNode()->hasTagName(audioTag) || parentNode()->has
TagName(videoTag))) | 60 Element* parent = parentElement(); |
| 61 if (parent && parent->isMediaElement()) |
61 static_cast<HTMLMediaElement*>(parentNode())->sourceWasAdded(this); | 62 static_cast<HTMLMediaElement*>(parentNode())->sourceWasAdded(this); |
62 } | 63 } |
63 | 64 |
64 void HTMLSourceElement::willRemove() | 65 void HTMLSourceElement::willRemove() |
65 { | 66 { |
66 if (parentNode() && (parentNode()->hasTagName(audioTag) || parentNode()->has
TagName(videoTag))) | 67 Element* parent = parentElement(); |
| 68 if (parent && parent->isMediaElement()) |
67 static_cast<HTMLMediaElement*>(parentNode())->sourceWillBeRemoved(this); | 69 static_cast<HTMLMediaElement*>(parentNode())->sourceWillBeRemoved(this); |
68 HTMLElement::willRemove(); | 70 HTMLElement::willRemove(); |
69 } | 71 } |
70 | 72 |
71 void HTMLSourceElement::setSrc(const String& url) | 73 void HTMLSourceElement::setSrc(const String& url) |
72 { | 74 { |
73 setAttribute(srcAttr, url); | 75 setAttribute(srcAttr, url); |
74 } | 76 } |
75 | 77 |
76 String HTMLSourceElement::media() const | 78 String HTMLSourceElement::media() const |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 117 } |
116 | 118 |
117 bool HTMLSourceElement::isURLAttribute(Attribute* attribute) const | 119 bool HTMLSourceElement::isURLAttribute(Attribute* attribute) const |
118 { | 120 { |
119 return attribute->name() == srcAttr; | 121 return attribute->name() == srcAttr; |
120 } | 122 } |
121 | 123 |
122 } | 124 } |
123 | 125 |
124 #endif | 126 #endif |
OLD | NEW |