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

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

Issue 10703186: Merge 122432 - [Shadow DOM] <video> with <shadow> crashes (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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 | « Source/WebCore/html/HTMLMediaElement.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 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed.
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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 frame->loader()->client()->showMediaPlayerProxyPlugin(m_proxyWidget. get()); 481 frame->loader()->client()->showMediaPlayerProxyPlugin(m_proxyWidget. get());
482 } 482 }
483 return mediaRenderer; 483 return mediaRenderer;
484 #else 484 #else
485 return new (arena) RenderMedia(this); 485 return new (arena) RenderMedia(this);
486 #endif 486 #endif
487 } 487 }
488 488
489 bool HTMLMediaElement::childShouldCreateRenderer(const NodeRenderingContext& chi ldContext) const 489 bool HTMLMediaElement::childShouldCreateRenderer(const NodeRenderingContext& chi ldContext) const
490 { 490 {
491 return childContext.isOnUpperEncapsulationBoundary() && HTMLElement::childSh ouldCreateRenderer(childContext); 491 if (!hasMediaControls())
492 return false;
493 // Only allows nodes from the controls shadow subtree.
494 return (mediaControls()->treeScope() == childContext.node()->treeScope()
495 && childContext.isOnUpperEncapsulationBoundary() && HTMLElement::chi ldShouldCreateRenderer(childContext));
492 } 496 }
493 497
494 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) 498 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint)
495 { 499 {
496 LOG(Media, "HTMLMediaElement::insertedInto"); 500 LOG(Media, "HTMLMediaElement::insertedInto");
497 HTMLElement::insertedInto(insertionPoint); 501 HTMLElement::insertedInto(insertionPoint);
498 if (insertionPoint->inDocument() && !getAttribute(srcAttr).isEmpty() && m_ne tworkState == NETWORK_EMPTY) 502 if (insertionPoint->inDocument() && !getAttribute(srcAttr).isEmpty() && m_ne tworkState == NETWORK_EMPTY)
499 scheduleLoad(MediaResource); 503 scheduleLoad(MediaResource);
500 configureMediaControls(); 504 configureMediaControls();
501 return InsertionDone; 505 return InsertionDone;
(...skipping 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after
4137 { 4141 {
4138 if (!m_player) 4142 if (!m_player)
4139 return; 4143 return;
4140 4144
4141 Settings* settings = document()->settings(); 4145 Settings* settings = document()->settings();
4142 bool privateMode = !settings || settings->privateBrowsingEnabled(); 4146 bool privateMode = !settings || settings->privateBrowsingEnabled();
4143 LOG(Media, "HTMLMediaElement::privateBrowsingStateDidChange(%s)", boolString (privateMode)); 4147 LOG(Media, "HTMLMediaElement::privateBrowsingStateDidChange(%s)", boolString (privateMode));
4144 m_player->setPrivateBrowsingMode(privateMode); 4148 m_player->setPrivateBrowsingMode(privateMode);
4145 } 4149 }
4146 4150
4147 MediaControls* HTMLMediaElement::mediaControls() 4151 MediaControls* HTMLMediaElement::mediaControls() const
4148 { 4152 {
4149 return toMediaControls(shadow()->oldestShadowRoot()->firstChild()); 4153 return toMediaControls(shadow()->oldestShadowRoot()->firstChild());
4150 } 4154 }
4151 4155
4152 bool HTMLMediaElement::hasMediaControls() 4156 bool HTMLMediaElement::hasMediaControls() const
4153 { 4157 {
4154 ElementShadow* elementShadow = shadow(); 4158 ElementShadow* elementShadow = shadow();
4155 if (!elementShadow) 4159 if (!elementShadow)
4156 return false; 4160 return false;
4157 4161
4158 Node* node = elementShadow->oldestShadowRoot()->firstChild(); 4162 Node* node = elementShadow->oldestShadowRoot()->firstChild();
4159 return node && node->isMediaControls(); 4163 return node && node->isMediaControls();
4160 } 4164 }
4161 4165
4162 bool HTMLMediaElement::createMediaControls() 4166 bool HTMLMediaElement::createMediaControls()
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
4483 return document()->url().host(); 4487 return document()->url().host();
4484 } 4488 }
4485 4489
4486 void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture() 4490 void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
4487 { 4491 {
4488 m_restrictions = NoRestrictions; 4492 m_restrictions = NoRestrictions;
4489 } 4493 }
4490 4494
4491 } 4495 }
4492 #endif 4496 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698