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

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

Issue 2307353002: Remove HTMLSourceElement media listener if media attribute is empty (Closed)
Patch Set: Created 4 years, 3 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698