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

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

Issue 594533002: Replace HTMLMediaElement::isActive() with Node::inActiveDocument() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 1 month 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/HTMLMediaElement.h ('k') | Source/core/rendering/RenderVideo.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) 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 , m_webLayer(nullptr) 350 , m_webLayer(nullptr)
351 , m_preload(MediaPlayer::Auto) 351 , m_preload(MediaPlayer::Auto)
352 , m_displayMode(Unknown) 352 , m_displayMode(Unknown)
353 , m_cachedTime(MediaPlayer::invalidTime()) 353 , m_cachedTime(MediaPlayer::invalidTime())
354 , m_fragmentEndTime(MediaPlayer::invalidTime()) 354 , m_fragmentEndTime(MediaPlayer::invalidTime())
355 , m_pendingActionFlags(0) 355 , m_pendingActionFlags(0)
356 , m_userGestureRequiredForPlay(false) 356 , m_userGestureRequiredForPlay(false)
357 , m_playing(false) 357 , m_playing(false)
358 , m_shouldDelayLoadEvent(false) 358 , m_shouldDelayLoadEvent(false)
359 , m_haveFiredLoadedData(false) 359 , m_haveFiredLoadedData(false)
360 , m_active(true)
361 , m_autoplaying(true) 360 , m_autoplaying(true)
362 , m_muted(false) 361 , m_muted(false)
363 , m_paused(true) 362 , m_paused(true)
364 , m_seeking(false) 363 , m_seeking(false)
365 , m_sentStalledEvent(false) 364 , m_sentStalledEvent(false)
366 , m_sentEndEvent(false) 365 , m_sentEndEvent(false)
367 , m_closedCaptionsVisible(false) 366 , m_closedCaptionsVisible(false)
368 , m_completelyLoaded(false) 367 , m_completelyLoaded(false)
369 , m_havePreparedToPlay(false) 368 , m_havePreparedToPlay(false)
370 , m_tracksAreReady(true) 369 , m_tracksAreReady(true)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 { 595 {
597 return new RenderMedia(this); 596 return new RenderMedia(this);
598 } 597 }
599 598
600 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) 599 Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint)
601 { 600 {
602 WTF_LOG(Media, "HTMLMediaElement::insertedInto(%p, %p)", this, insertionPoin t); 601 WTF_LOG(Media, "HTMLMediaElement::insertedInto(%p, %p)", this, insertionPoin t);
603 602
604 HTMLElement::insertedInto(insertionPoint); 603 HTMLElement::insertedInto(insertionPoint);
605 if (insertionPoint->inDocument()) { 604 if (insertionPoint->inDocument()) {
606 m_active = true;
607
608 if (!getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY) 605 if (!getAttribute(srcAttr).isEmpty() && m_networkState == NETWORK_EMPTY)
609 scheduleDelayedAction(LoadMediaResource); 606 scheduleDelayedAction(LoadMediaResource);
610 } 607 }
611 608
612 return InsertionShouldCallDidNotifySubtreeInsertions; 609 return InsertionShouldCallDidNotifySubtreeInsertions;
613 } 610 }
614 611
615 void HTMLMediaElement::didNotifySubtreeInsertionsToDocument() 612 void HTMLMediaElement::didNotifySubtreeInsertionsToDocument()
616 { 613 {
617 configureMediaControls(); 614 configureMediaControls();
618 } 615 }
619 616
620 void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint) 617 void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint)
621 { 618 {
622 WTF_LOG(Media, "HTMLMediaElement::removedFrom(%p, %p)", this, insertionPoint ); 619 WTF_LOG(Media, "HTMLMediaElement::removedFrom(%p, %p)", this, insertionPoint );
623 620
624 m_active = false; 621 if (insertionPoint->inActiveDocument()) {
625 if (insertionPoint->inDocument() && insertionPoint->document().isActive()) {
626 configureMediaControls(); 622 configureMediaControls();
627 if (m_networkState > NETWORK_EMPTY) 623 if (m_networkState > NETWORK_EMPTY)
628 pause(); 624 pause();
629 } 625 }
630 626
631 HTMLElement::removedFrom(insertionPoint); 627 HTMLElement::removedFrom(insertionPoint);
632 } 628 }
633 629
634 void HTMLMediaElement::attach(const AttachContext& context) 630 void HTMLMediaElement::attach(const AttachContext& context)
635 { 631 {
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 1465
1470 void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests() 1466 void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests()
1471 { 1467 {
1472 ++m_ignoreTrackDisplayUpdate; 1468 ++m_ignoreTrackDisplayUpdate;
1473 } 1469 }
1474 1470
1475 void HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests() 1471 void HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests()
1476 { 1472 {
1477 ASSERT(m_ignoreTrackDisplayUpdate); 1473 ASSERT(m_ignoreTrackDisplayUpdate);
1478 --m_ignoreTrackDisplayUpdate; 1474 --m_ignoreTrackDisplayUpdate;
1479 if (!m_ignoreTrackDisplayUpdate && m_active) 1475 if (!m_ignoreTrackDisplayUpdate && inActiveDocument())
1480 updateActiveTextTrackCues(currentTime()); 1476 updateActiveTextTrackCues(currentTime());
1481 } 1477 }
1482 1478
1483 void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList * cues) 1479 void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList * cues)
1484 { 1480 {
1485 WTF_LOG(Media, "HTMLMediaElement::textTrackAddCues(%p)", this); 1481 WTF_LOG(Media, "HTMLMediaElement::textTrackAddCues(%p)", this);
1486 if (track->mode() == TextTrack::disabledKeyword()) 1482 if (track->mode() == TextTrack::disabledKeyword())
1487 return; 1483 return;
1488 1484
1489 TrackDisplayUpdateScope scope(this); 1485 TrackDisplayUpdateScope scope(this);
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 configureTextTrackDisplay(AssumeNoVisibleChange); 3549 configureTextTrackDisplay(AssumeNoVisibleChange);
3554 } 3550 }
3555 3551
3556 void HTMLMediaElement::stop() 3552 void HTMLMediaElement::stop()
3557 { 3553 {
3558 WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this); 3554 WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this);
3559 3555
3560 if (m_playing && m_initialPlayWithoutUserGestures) 3556 if (m_playing && m_initialPlayWithoutUserGestures)
3561 gesturelessInitialPlayHalted(); 3557 gesturelessInitialPlayHalted();
3562 3558
3563 m_active = false;
3564 userCancelledLoad(); 3559 userCancelledLoad();
3565 3560
3566 // Stop the playback without generating events 3561 // Stop the playback without generating events
3567 m_playing = false; 3562 m_playing = false;
3568 m_paused = true; 3563 m_paused = true;
3569 m_seeking = false; 3564 m_seeking = false;
3570 3565
3571 if (renderer()) 3566 if (renderer())
3572 renderer()->updateFromElement(); 3567 renderer()->updateFromElement();
3573 3568
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
4100 4095
4101 #if ENABLE(WEB_AUDIO) 4096 #if ENABLE(WEB_AUDIO)
4102 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 4097 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
4103 { 4098 {
4104 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 4099 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
4105 audioSourceProvider()->setClient(nullptr); 4100 audioSourceProvider()->setClient(nullptr);
4106 } 4101 }
4107 #endif 4102 #endif
4108 4103
4109 } 4104 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/rendering/RenderVideo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698