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 removeMediaQueryListListener(); | |
84 if (media.isEmpty()) | 85 if (media.isEmpty()) |
85 return; | 86 return; |
86 | 87 |
87 removeMediaQueryListListener(); | |
88 MediaQuerySet* set = MediaQuerySet::create(media); | 88 MediaQuerySet* set = MediaQuerySet::create(media); |
89 m_mediaQueryList = MediaQueryList::create(&document(), &document().mediaQuer yMatcher(), set); | 89 m_mediaQueryList = MediaQueryList::create(&document(), &document().mediaQuer yMatcher(), set); |
cbiesinger
2016/09/07 16:01:41
Should this also be set to null if media.isEmpty()
| |
90 addMediaQueryListListener(); | 90 addMediaQueryListListener(); |
91 } | 91 } |
92 | 92 |
93 void HTMLSourceElement::didMoveToNewDocument(Document& oldDocument) | 93 void HTMLSourceElement::didMoveToNewDocument(Document& oldDocument) |
94 { | 94 { |
95 createMediaQueryList(fastGetAttribute(mediaAttr)); | 95 createMediaQueryList(fastGetAttribute(mediaAttr)); |
96 HTMLElement::didMoveToNewDocument(oldDocument); | 96 HTMLElement::didMoveToNewDocument(oldDocument); |
97 } | 97 } |
98 | 98 |
99 Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode * insertionPoint) | 99 Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode * insertionPoint) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 } | 200 } |
201 | 201 |
202 DEFINE_TRACE(HTMLSourceElement) | 202 DEFINE_TRACE(HTMLSourceElement) |
203 { | 203 { |
204 visitor->trace(m_mediaQueryList); | 204 visitor->trace(m_mediaQueryList); |
205 visitor->trace(m_listener); | 205 visitor->trace(m_listener); |
206 HTMLElement::trace(visitor); | 206 HTMLElement::trace(visitor); |
207 } | 207 } |
208 | 208 |
209 } // namespace blink | 209 } // namespace blink |
OLD | NEW |