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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 DEFINE_NODE_FACTORY(HTMLSourceElement) | 76 DEFINE_NODE_FACTORY(HTMLSourceElement) |
77 | 77 |
78 HTMLSourceElement::~HTMLSourceElement() | 78 HTMLSourceElement::~HTMLSourceElement() |
79 { | 79 { |
80 } | 80 } |
81 | 81 |
82 void HTMLSourceElement::createMediaQueryList(const AtomicString& media) | 82 void HTMLSourceElement::createMediaQueryList(const AtomicString& media) |
83 { | 83 { |
84 if (media.isEmpty()) | 84 removeMediaQueryListListener(); |
| 85 if (media.isEmpty()) { |
| 86 m_mediaQueryList = nullptr; |
85 return; | 87 return; |
| 88 } |
86 | 89 |
87 removeMediaQueryListListener(); | |
88 MediaQuerySet* set = MediaQuerySet::create(media); | 90 MediaQuerySet* set = MediaQuerySet::create(media); |
89 m_mediaQueryList = MediaQueryList::create(&document(), &document().mediaQuer
yMatcher(), set); | 91 m_mediaQueryList = MediaQueryList::create(&document(), &document().mediaQuer
yMatcher(), set); |
90 addMediaQueryListListener(); | 92 addMediaQueryListListener(); |
91 } | 93 } |
92 | 94 |
93 void HTMLSourceElement::didMoveToNewDocument(Document& oldDocument) | 95 void HTMLSourceElement::didMoveToNewDocument(Document& oldDocument) |
94 { | 96 { |
95 createMediaQueryList(fastGetAttribute(mediaAttr)); | 97 createMediaQueryList(fastGetAttribute(mediaAttr)); |
96 HTMLElement::didMoveToNewDocument(oldDocument); | 98 HTMLElement::didMoveToNewDocument(oldDocument); |
97 } | 99 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 202 } |
201 | 203 |
202 DEFINE_TRACE(HTMLSourceElement) | 204 DEFINE_TRACE(HTMLSourceElement) |
203 { | 205 { |
204 visitor->trace(m_mediaQueryList); | 206 visitor->trace(m_mediaQueryList); |
205 visitor->trace(m_listener); | 207 visitor->trace(m_listener); |
206 HTMLElement::trace(visitor); | 208 HTMLElement::trace(visitor); |
207 } | 209 } |
208 | 210 |
209 } // namespace blink | 211 } // namespace blink |
OLD | NEW |