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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 32583007: Add UseCounter for HTMLSourceElement.media (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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 | Source/core/page/UseCounter.h » ('j') | 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, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 node = potentialSourceNodes[i].get(); 2874 node = potentialSourceNodes[i].get();
2875 if (lookingForStartNode && m_nextChildNodeToConsider != node) 2875 if (lookingForStartNode && m_nextChildNodeToConsider != node)
2876 continue; 2876 continue;
2877 lookingForStartNode = false; 2877 lookingForStartNode = false;
2878 2878
2879 if (!node->hasTagName(sourceTag)) 2879 if (!node->hasTagName(sourceTag))
2880 continue; 2880 continue;
2881 if (node->parentNode() != this) 2881 if (node->parentNode() != this)
2882 continue; 2882 continue;
2883 2883
2884 UseCounter::count(document(), UseCounter::SourceElementCandidate);
2884 source = toHTMLSourceElement(node); 2885 source = toHTMLSourceElement(node);
2885 2886
2886 // If candidate does not have a src attribute, or if its src attribute's value is the empty string ... jump down to the failed step below 2887 // If candidate does not have a src attribute, or if its src attribute's value is the empty string ... jump down to the failed step below
2887 mediaURL = source->getNonEmptyURLAttribute(srcAttr); 2888 mediaURL = source->getNonEmptyURLAttribute(srcAttr);
2888 #if !LOG_DISABLED 2889 #if !LOG_DISABLED
2889 if (shouldLog) 2890 if (shouldLog)
2890 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is %s", urlForLoggingMedia(mediaURL).utf8().data()); 2891 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is %s", urlForLoggingMedia(mediaURL).utf8().data());
2891 #endif 2892 #endif
2892 if (mediaURL.isEmpty()) 2893 if (mediaURL.isEmpty())
2893 goto check_again; 2894 goto check_again;
2894 2895
2895 if (source->fastHasAttribute(mediaAttr)) { 2896 if (source->fastHasAttribute(mediaAttr)) {
2896 MediaQueryEvaluator screenEval("screen", document().frame(), rendere r() ? renderer()->style() : 0); 2897 MediaQueryEvaluator screenEval("screen", document().frame(), rendere r() ? renderer()->style() : 0);
2897 RefPtr<MediaQuerySet> media = MediaQuerySet::create(source->media()) ; 2898 RefPtr<MediaQuerySet> media = MediaQuerySet::create(source->media()) ;
2898 #if !LOG_DISABLED 2899 #if !LOG_DISABLED
2899 if (shouldLog) 2900 if (shouldLog)
2900 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'media' is %s", source->media().utf8().data()); 2901 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'media' is %s", source->media().utf8().data());
2901 #endif 2902 #endif
2902 if (!screenEval.eval(media.get())) 2903 if (!screenEval.eval(media.get())) {
2904 UseCounter::count(document(), UseCounter::SourceElementNonMatchi ngMedia);
2903 goto check_again; 2905 goto check_again;
2906 }
2904 } 2907 }
2905 2908
2906 type = source->type(); 2909 type = source->type();
2907 // FIXME(82965): Add support for keySystem in <source> and set system fr om source. 2910 // FIXME(82965): Add support for keySystem in <source> and set system fr om source.
2908 if (type.isEmpty() && mediaURL.protocolIsData()) 2911 if (type.isEmpty() && mediaURL.protocolIsData())
2909 type = mimeTypeFromDataURL(mediaURL); 2912 type = mimeTypeFromDataURL(mediaURL);
2910 if (!type.isEmpty() || !system.isEmpty()) { 2913 if (!type.isEmpty() || !system.isEmpty()) {
2911 #if !LOG_DISABLED 2914 #if !LOG_DISABLED
2912 if (shouldLog) 2915 if (shouldLog)
2913 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is '%s' - key system is '%s'", type.utf8().data(), system.utf8().data()); 2916 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is '%s' - key system is '%s'", type.utf8().data(), system.utf8().data());
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 { 3889 {
3887 scheduleLayerUpdate(); 3890 scheduleLayerUpdate();
3888 } 3891 }
3889 3892
3890 bool HTMLMediaElement::isInteractiveContent() const 3893 bool HTMLMediaElement::isInteractiveContent() const
3891 { 3894 {
3892 return fastHasAttribute(controlsAttr); 3895 return fastHasAttribute(controlsAttr);
3893 } 3896 }
3894 3897
3895 } 3898 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/page/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698