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

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

Issue 147933002: Remove the media attribute from the resource selection algorithm (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/UseCounter.h ('k') | 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, 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 16 matching lines...) Expand all
27 #include "core/html/HTMLMediaElement.h" 27 #include "core/html/HTMLMediaElement.h"
28 28
29 #include <limits> 29 #include <limits>
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "RuntimeEnabledFeatures.h" 31 #include "RuntimeEnabledFeatures.h"
32 #include "bindings/v8/ExceptionState.h" 32 #include "bindings/v8/ExceptionState.h"
33 #include "bindings/v8/ExceptionStatePlaceholder.h" 33 #include "bindings/v8/ExceptionStatePlaceholder.h"
34 #include "bindings/v8/ScriptController.h" 34 #include "bindings/v8/ScriptController.h"
35 #include "bindings/v8/ScriptEventListener.h" 35 #include "bindings/v8/ScriptEventListener.h"
36 #include "core/css/MediaList.h" 36 #include "core/css/MediaList.h"
37 #include "core/css/MediaQueryEvaluator.h"
38 #include "core/dom/Attribute.h" 37 #include "core/dom/Attribute.h"
39 #include "core/dom/ExceptionCode.h" 38 #include "core/dom/ExceptionCode.h"
40 #include "core/dom/FullscreenElementStack.h" 39 #include "core/dom/FullscreenElementStack.h"
41 #include "core/dom/shadow/ShadowRoot.h" 40 #include "core/dom/shadow/ShadowRoot.h"
42 #include "core/events/Event.h" 41 #include "core/events/Event.h"
43 #include "core/events/ThreadLocalEventNames.h" 42 #include "core/events/ThreadLocalEventNames.h"
44 #include "core/frame/ContentSecurityPolicy.h" 43 #include "core/frame/ContentSecurityPolicy.h"
45 #include "core/frame/Frame.h" 44 #include "core/frame/Frame.h"
46 #include "core/frame/Settings.h" 45 #include "core/frame/Settings.h"
47 #include "core/frame/UseCounter.h" 46 #include "core/frame/UseCounter.h"
(...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2904 node = potentialSourceNodes[i].get(); 2903 node = potentialSourceNodes[i].get();
2905 if (lookingForStartNode && m_nextChildNodeToConsider != node) 2904 if (lookingForStartNode && m_nextChildNodeToConsider != node)
2906 continue; 2905 continue;
2907 lookingForStartNode = false; 2906 lookingForStartNode = false;
2908 2907
2909 if (!node->hasTagName(sourceTag)) 2908 if (!node->hasTagName(sourceTag))
2910 continue; 2909 continue;
2911 if (node->parentNode() != this) 2910 if (node->parentNode() != this)
2912 continue; 2911 continue;
2913 2912
2914 UseCounter::count(document(), UseCounter::SourceElementCandidate);
2915 source = toHTMLSourceElement(node); 2913 source = toHTMLSourceElement(node);
2916 2914
2917 // 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 2915 // 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
2918 mediaURL = source->getNonEmptyURLAttribute(srcAttr); 2916 mediaURL = source->getNonEmptyURLAttribute(srcAttr);
2919 #if !LOG_DISABLED 2917 #if !LOG_DISABLED
2920 if (shouldLog) 2918 if (shouldLog)
2921 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is % s", urlForLoggingMedia(mediaURL).utf8().data()); 2919 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is % s", urlForLoggingMedia(mediaURL).utf8().data());
2922 #endif 2920 #endif
2923 if (mediaURL.isEmpty()) 2921 if (mediaURL.isEmpty())
2924 goto check_again; 2922 goto check_again;
2925 2923
2926 if (source->fastHasAttribute(mediaAttr)) {
2927 MediaQueryEvaluator screenEval("screen", document().frame(), rendere r() ? renderer()->style() : 0);
2928 RefPtr<MediaQuerySet> media = MediaQuerySet::create(source->media()) ;
2929 #if !LOG_DISABLED
2930 if (shouldLog)
2931 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'media ' is %s", source->media().utf8().data());
2932 #endif
2933 if (!screenEval.eval(media.get())) {
2934 UseCounter::count(document(), UseCounter::SourceElementNonMatchi ngMedia);
2935 goto check_again;
2936 }
2937 }
2938
2939 type = source->type(); 2924 type = source->type();
2940 // FIXME(82965): Add support for keySystem in <source> and set system fr om source. 2925 // FIXME(82965): Add support for keySystem in <source> and set system fr om source.
2941 if (type.isEmpty() && mediaURL.protocolIsData()) 2926 if (type.isEmpty() && mediaURL.protocolIsData())
2942 type = mimeTypeFromDataURL(mediaURL); 2927 type = mimeTypeFromDataURL(mediaURL);
2943 if (!type.isEmpty() || !system.isEmpty()) { 2928 if (!type.isEmpty() || !system.isEmpty()) {
2944 #if !LOG_DISABLED 2929 #if !LOG_DISABLED
2945 if (shouldLog) 2930 if (shouldLog)
2946 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is '%s' - key system is '%s'", type.utf8().data(), system.utf8().data()); 2931 WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'type' is '%s' - key system is '%s'", type.utf8().data(), system.utf8().data());
2947 #endif 2932 #endif
2948 if (!supportsType(ContentType(type), system)) 2933 if (!supportsType(ContentType(type), system))
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
3969 { 3954 {
3970 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); 3955 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource));
3971 } 3956 }
3972 3957
3973 bool HTMLMediaElement::isInteractiveContent() const 3958 bool HTMLMediaElement::isInteractiveContent() const
3974 { 3959 {
3975 return fastHasAttribute(controlsAttr); 3960 return fastHasAttribute(controlsAttr);
3976 } 3961 }
3977 3962
3978 } 3963 }
OLDNEW
« no previous file with comments | « Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698