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

Side by Side Diff: Source/core/html/shadow/MediaControlElements.cpp

Issue 20123003: [oilpan] The Node hierarchy should have correct accept method chains (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 ASSERT(controls); 320 ASSERT(controls);
321 321
322 Handle<MediaControlPanelMuteButtonElement> button = adoptTreeShared(new Medi aControlPanelMuteButtonElement(document, controls)); 322 Handle<MediaControlPanelMuteButtonElement> button = adoptTreeShared(new Medi aControlPanelMuteButtonElement(document, controls));
323 button->ensureUserAgentShadowRoot(); 323 button->ensureUserAgentShadowRoot();
324 button->setType("button"); 324 button->setType("button");
325 return button; 325 return button;
326 } 326 }
327 327
328 void MediaControlPanelMuteButtonElement::acceptHeapVisitor(Visitor* visitor) con st 328 void MediaControlPanelMuteButtonElement::acceptHeapVisitor(Visitor* visitor) con st
329 { 329 {
330 visitor->visit(m_controls);
330 MediaControlMuteButtonElement::acceptHeapVisitor(visitor); 331 MediaControlMuteButtonElement::acceptHeapVisitor(visitor);
331 } 332 }
332 333
333 void MediaControlPanelMuteButtonElement::defaultEventHandler(Event* event) 334 void MediaControlPanelMuteButtonElement::defaultEventHandler(Event* event)
334 { 335 {
335 if (event->type() == eventNames().mouseoverEvent) 336 if (event->type() == eventNames().mouseoverEvent)
336 m_controls->showVolumeSlider(); 337 m_controls->showVolumeSlider();
337 338
338 MediaControlMuteButtonElement::defaultEventHandler(event); 339 MediaControlMuteButtonElement::defaultEventHandler(event);
339 } 340 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 549
549 Result<MediaControlClosedCaptionsTrackListElement> MediaControlClosedCaptionsTra ckListElement::create(Handle<Document> document, MediaControls* controls) 550 Result<MediaControlClosedCaptionsTrackListElement> MediaControlClosedCaptionsTra ckListElement::create(Handle<Document> document, MediaControls* controls)
550 { 551 {
551 ASSERT(controls); 552 ASSERT(controls);
552 Handle<MediaControlClosedCaptionsTrackListElement> element = adoptTreeShared (new MediaControlClosedCaptionsTrackListElement(document, controls)); 553 Handle<MediaControlClosedCaptionsTrackListElement> element = adoptTreeShared (new MediaControlClosedCaptionsTrackListElement(document, controls));
553 return element; 554 return element;
554 } 555 }
555 556
556 void MediaControlClosedCaptionsTrackListElement::acceptHeapVisitor(Visitor* visi tor) const 557 void MediaControlClosedCaptionsTrackListElement::acceptHeapVisitor(Visitor* visi tor) const
557 { 558 {
559 visitor->visit(m_menuItems);
560 visitor->visit(m_controls);
558 MediaControlDivElement::acceptHeapVisitor(visitor); 561 MediaControlDivElement::acceptHeapVisitor(visitor);
559 } 562 }
560 563
561 void MediaControlClosedCaptionsTrackListElement::defaultEventHandler(Event* even t) 564 void MediaControlClosedCaptionsTrackListElement::defaultEventHandler(Event* even t)
562 { 565 {
563 if (event->type() == eventNames().clickEvent) { 566 if (event->type() == eventNames().clickEvent) {
564 Node* target = event->target()->toNode(); 567 Node* target = event->target()->toNode();
565 if (!target || !target->isElementNode()) 568 if (!target || !target->isElementNode())
566 return; 569 return;
567 570
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 TextTrackList* trackList = mediaElement->textTracks(); 619 TextTrackList* trackList = mediaElement->textTracks();
617 620
618 if (!trackList || !trackList->length()) 621 if (!trackList || !trackList->length())
619 return; 622 return;
620 623
621 if (m_trackListHasChanged) 624 if (m_trackListHasChanged)
622 rebuildTrackListMenu(); 625 rebuildTrackListMenu();
623 626
624 bool captionsVisible = mediaElement->closedCaptionsVisible(); 627 bool captionsVisible = mediaElement->closedCaptionsVisible();
625 for (unsigned i = 0, length = m_menuItems.size(); i < length; ++i) { 628 for (unsigned i = 0, length = m_menuItems.size(); i < length; ++i) {
626 RefPtr<Element> trackItem = m_menuItems[i]; 629 Handle<Element> trackItem = m_menuItems[i];
627 630
628 int trackIndex = trackListIndexForElement(trackItem.get()); 631 int trackIndex = trackListIndexForElement(trackItem.raw());
629 if (trackIndex == HTMLMediaElement::textTracksIndexNotFound()) 632 if (trackIndex == HTMLMediaElement::textTracksIndexNotFound())
630 continue; 633 continue;
631 634
632 if (trackIndex == HTMLMediaElement::textTracksOffIndex()) { 635 if (trackIndex == HTMLMediaElement::textTracksOffIndex()) {
633 if (captionsVisible) 636 if (captionsVisible)
634 trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXC EPTION); 637 trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXC EPTION);
635 else 638 else
636 trackItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPT ION); 639 trackItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPT ION);
637 continue; 640 continue;
638 } 641 }
639 642
640 RefPtr<TextTrack> textTrack; 643 RefPtr<TextTrack> textTrack;
641 MenuItemToTrackMap::iterator iter = m_menuToTrackMap.find(trackItem.get( )); 644 MenuItemToTrackMap::iterator iter = m_menuToTrackMap.find(trackItem.raw( ));
642 if (iter == m_menuToTrackMap.end()) 645 if (iter == m_menuToTrackMap.end())
643 continue; 646 continue;
644 textTrack = iter->value; 647 textTrack = iter->value;
645 if (!textTrack) 648 if (!textTrack)
646 continue; 649 continue;
647 if (textTrack->mode() == TextTrack::showingKeyword()) 650 if (textTrack->mode() == TextTrack::showingKeyword())
648 trackItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPTION) ; 651 trackItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPTION) ;
649 else 652 else
650 trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXCEPTI ON); 653 trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXCEPTI ON);
651 } 654 }
(...skipping 26 matching lines...) Expand all
678 RefPtr<Element> captionsHeader = doc->createElement(h3Tag, ASSERT_NO_EXCEPTI ON); 681 RefPtr<Element> captionsHeader = doc->createElement(h3Tag, ASSERT_NO_EXCEPTI ON);
679 captionsHeader->appendChild(doc->createTextNode(textTrackSubtitlesText())); 682 captionsHeader->appendChild(doc->createTextNode(textTrackSubtitlesText()));
680 appendChild(captionsHeader); 683 appendChild(captionsHeader);
681 RefPtr<Element> captionsMenuList = doc->createElement(ulTag, ASSERT_NO_EXCEP TION); 684 RefPtr<Element> captionsMenuList = doc->createElement(ulTag, ASSERT_NO_EXCEP TION);
682 685
683 RefPtr<Element> menuItem; 686 RefPtr<Element> menuItem;
684 menuItem = doc->createElement(liTag, ASSERT_NO_EXCEPTION); 687 menuItem = doc->createElement(liTag, ASSERT_NO_EXCEPTION);
685 menuItem->appendChild(doc->createTextNode(textTrackOffText())); 688 menuItem->appendChild(doc->createTextNode(textTrackOffText()));
686 menuItem->setAttribute(trackIndexAttributeName(), textTracksOffAttrValue, AS SERT_NO_EXCEPTION); 689 menuItem->setAttribute(trackIndexAttributeName(), textTracksOffAttrValue, AS SERT_NO_EXCEPTION);
687 captionsMenuList->appendChild(menuItem); 690 captionsMenuList->appendChild(menuItem);
688 m_menuItems.append(menuItem); 691 m_menuItems.append(Handle<Element>(menuItem.get()));
689 692
690 for (unsigned i = 0, length = tracksForMenu.size(); i < length; ++i) { 693 for (unsigned i = 0, length = tracksForMenu.size(); i < length; ++i) {
691 RefPtr<TextTrack> textTrack = tracksForMenu[i]; 694 RefPtr<TextTrack> textTrack = tracksForMenu[i];
692 menuItem = doc->createElement(liTag, ASSERT_NO_EXCEPTION); 695 menuItem = doc->createElement(liTag, ASSERT_NO_EXCEPTION);
693 696
694 // Add a custom attribute to the <li> element which will allow 697 // Add a custom attribute to the <li> element which will allow
695 // us to easily associate the user tapping here with the 698 // us to easily associate the user tapping here with the
696 // track. Since this list is rebuilt if the tracks change, we 699 // track. Since this list is rebuilt if the tracks change, we
697 // should always be in sync. 700 // should always be in sync.
698 menuItem->setAttribute(trackIndexAttributeName(), String::number(i), ASS ERT_NO_EXCEPTION); 701 menuItem->setAttribute(trackIndexAttributeName(), String::number(i), ASS ERT_NO_EXCEPTION);
699 702
700 menuItem->appendChild(doc->createTextNode(captionsUserPreferences->displ ayNameForTrack(textTrack.get()))); 703 menuItem->appendChild(doc->createTextNode(captionsUserPreferences->displ ayNameForTrack(textTrack.get())));
701 704
702 captionsMenuList->appendChild(menuItem); 705 captionsMenuList->appendChild(menuItem);
703 m_menuItems.append(menuItem); 706 m_menuItems.append(Handle<Element>(menuItem.get()));
704 m_menuToTrackMap.add(menuItem, textTrack); 707 m_menuToTrackMap.add(menuItem, textTrack);
705 } 708 }
706 709
707 appendChild(captionsMenuList); 710 appendChild(captionsMenuList);
708 711
709 updateDisplay(); 712 updateDisplay();
710 } 713 }
711 714
712 // ---------------------------- 715 // ----------------------------
713 716
714 MediaControlTimelineElement::MediaControlTimelineElement(Handle<Document> docume nt, MediaControls* controls) 717 MediaControlTimelineElement::MediaControlTimelineElement(Handle<Document> docume nt, MediaControls* controls)
715 : MediaControlInputElement(document, MediaSlider) 718 : MediaControlInputElement(document, MediaSlider)
716 , m_controls(controls) 719 , m_controls(controls)
717 { 720 {
718 } 721 }
719 722
720 Result<MediaControlTimelineElement> MediaControlTimelineElement::create(Handle<D ocument> document, MediaControls* controls) 723 Result<MediaControlTimelineElement> MediaControlTimelineElement::create(Handle<D ocument> document, MediaControls* controls)
721 { 724 {
722 ASSERT(controls); 725 ASSERT(controls);
723 726
724 Handle<MediaControlTimelineElement> timeline = adoptTreeShared(new MediaCont rolTimelineElement(document, controls)); 727 Handle<MediaControlTimelineElement> timeline = adoptTreeShared(new MediaCont rolTimelineElement(document, controls));
725 timeline->ensureUserAgentShadowRoot(); 728 timeline->ensureUserAgentShadowRoot();
726 timeline->setType("range"); 729 timeline->setType("range");
727 timeline->setAttribute(precisionAttr, "float"); 730 timeline->setAttribute(precisionAttr, "float");
728 return timeline; 731 return timeline;
729 } 732 }
730 733
731 void MediaControlTimelineElement::acceptHeapVisitor(Visitor* visitor) const 734 void MediaControlTimelineElement::acceptHeapVisitor(Visitor* visitor) const
732 { 735 {
736 visitor->visit(m_controls);
733 MediaControlInputElement::acceptHeapVisitor(visitor); 737 MediaControlInputElement::acceptHeapVisitor(visitor);
734 } 738 }
735 739
736 void MediaControlTimelineElement::defaultEventHandler(Event* event) 740 void MediaControlTimelineElement::defaultEventHandler(Event* event)
737 { 741 {
738 // Left button is 0. Rejects mouse events not from left button. 742 // Left button is 0. Rejects mouse events not from left button.
739 if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button()) 743 if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button())
740 return; 744 return;
741 745
742 if (!attached()) 746 if (!attached())
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 } 1127 }
1124 1128
1125 void MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged (const IntRect&) 1129 void MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged (const IntRect&)
1126 { 1130 {
1127 updateSizes(); 1131 updateSizes();
1128 } 1132 }
1129 1133
1130 // ---------------------------- 1134 // ----------------------------
1131 1135
1132 } // namespace WebCore 1136 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698