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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLTitleElement.cpp ('k') | Source/core/html/HTMLVideoElement.cpp » ('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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 track()->setLanguage(value); 111 track()->setLanguage(value);
112 else if (name == defaultAttr) 112 else if (name == defaultAttr)
113 track()->setIsDefault(!value.isNull()); 113 track()->setIsDefault(!value.isNull());
114 } 114 }
115 115
116 HTMLElement::parseAttribute(name, value); 116 HTMLElement::parseAttribute(name, value);
117 } 117 }
118 118
119 KURL HTMLTrackElement::src() const 119 KURL HTMLTrackElement::src() const
120 { 120 {
121 return document()->completeURL(getAttribute(srcAttr)); 121 return document().completeURL(getAttribute(srcAttr));
122 } 122 }
123 123
124 void HTMLTrackElement::setSrc(const String& url) 124 void HTMLTrackElement::setSrc(const String& url)
125 { 125 {
126 setAttribute(srcAttr, url); 126 setAttribute(srcAttr, url);
127 } 127 }
128 128
129 String HTMLTrackElement::kind() 129 String HTMLTrackElement::kind()
130 { 130 {
131 return track()->kind(); 131 return track()->kind();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 return false; 245 return false;
246 246
247 // 4.8.10.12.3 Sourcing out-of-band text tracks 247 // 4.8.10.12.3 Sourcing out-of-band text tracks
248 248
249 // 4. Download: If URL is not the empty string, perform a potentially CORS-e nabled fetch of URL, with the 249 // 4. Download: If URL is not the empty string, perform a potentially CORS-e nabled fetch of URL, with the
250 // mode being the state of the media element's crossorigin content attribute , the origin being the 250 // mode being the state of the media element's crossorigin content attribute , the origin being the
251 // origin of the media element's Document, and the default origin behaviour set to fail. 251 // origin of the media element's Document, and the default origin behaviour set to fail.
252 if (url.isEmpty()) 252 if (url.isEmpty())
253 return false; 253 return false;
254 254
255 if (!document()->contentSecurityPolicy()->allowMediaFromSource(url)) { 255 if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) {
256 LOG(Media, "HTMLTrackElement::canLoadUrl(%s) -> rejected by Content Secu rity Policy", urlForLoggingTrack(url).utf8().data()); 256 LOG(Media, "HTMLTrackElement::canLoadUrl(%s) -> rejected by Content Secu rity Policy", urlForLoggingTrack(url).utf8().data());
257 return false; 257 return false;
258 } 258 }
259 259
260 return dispatchBeforeLoadEvent(url.string()); 260 return dispatchBeforeLoadEvent(url.string());
261 } 261 }
262 262
263 void HTMLTrackElement::didCompleteLoad(LoadableTextTrack*, LoadStatus status) 263 void HTMLTrackElement::didCompleteLoad(LoadableTextTrack*, LoadStatus status)
264 { 264 {
265 // 4.8.10.12.3 Sourcing out-of-band text tracks (continued) 265 // 4.8.10.12.3 Sourcing out-of-band text tracks (continued)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 HTMLMediaElement* HTMLTrackElement::mediaElement() const 357 HTMLMediaElement* HTMLTrackElement::mediaElement() const
358 { 358 {
359 Element* parent = parentElement(); 359 Element* parent = parentElement();
360 if (parent && parent->isMediaElement()) 360 if (parent && parent->isMediaElement())
361 return toHTMLMediaElement(parentNode()); 361 return toHTMLMediaElement(parentNode());
362 return 0; 362 return 0;
363 } 363 }
364 364
365 } 365 }
366 366
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTitleElement.cpp ('k') | Source/core/html/HTMLVideoElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698