Changeset 151512 in webkit
- Timestamp:
- Jun 12, 2013 10:33:31 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r151510 r151512 1 2013-06-12 Ruth Fong <ruth_fong@apple.com> 2 3 Allow for toggling fullscreen on <video> elements 4 https://bugs.webkit.org/show_bug.cgi?id=117220 5 6 Reviewed by Dean Jackson. 7 8 This patch adds the ability for fullscreen 9 context menu item on <video> elements to switch between "Enter Fullscreen" 10 and "Exit Fullscreen" and behave appropriately. 11 12 No new tests. media/context-menu-action.html, 13 which has been disabled by bug 116651, is used to test context menus. 14 15 * English.lproj/Localizable.strings: Add "Exit Fullscreen" string. 16 * html/HTMLMediaElement.cpp: 17 (WebCore::HTMLMediaElement::toggleFullscreenState): Added to appropriately enter/exit fullscreen. 18 * html/HTMLMediaElement.h: 19 * page/ContextMenuController.cpp: 20 * platform/ContextMenuItem.h: 21 * platform/LocalizedStrings.cpp: 22 * platform/LocalizedStrings.h: 23 Updated to rename variables more appropriately to reflect the toggle-ability of video fullscreen. 24 * rendering/HitTestResult.cpp: 25 (WebCore::HitTestResult::mediaIsInFullscreen): Added to check if an element 26 was a media element in fullscreen. 27 (WebCore::HitTestResult::toggleMediaFullscreenState): Added to hook into 28 HTMLMediaElement::toggleFullscreenState. 29 * rendering/HitTestResult.h: 30 1 31 2013-06-12 Sergio Villar Senin <svillar@igalia.com> 2 32 -
trunk/Source/WebCore/English.lproj/Localizable.strings
r151469 r151512 176 176 "Enter Fullscreen" = "Enter Fullscreen"; 177 177 178 /* Video Exit Fullscreen context menu item */ 179 "Exit Fullscreen" = "Exit Fullscreen"; 180 178 181 /* Default application name for Open With context menu */ 179 182 "Finder" = "Finder"; -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r151282 r151512 4363 4363 } 4364 4364 4365 void HTMLMediaElement::toggleFullscreenState() 4366 { 4367 LOG(Media, "HTMLMediaElement::toggleFullscreenState - isFullscreen() is %s", boolString(isFullscreen())); 4368 4369 if (isFullscreen()) 4370 exitFullscreen(); 4371 else 4372 enterFullscreen(); 4373 } 4374 4365 4375 void HTMLMediaElement::enterFullscreen() 4366 4376 { -
trunk/Source/WebCore/html/HTMLMediaElement.h
r151282 r151512 338 338 339 339 bool isFullscreen() const; 340 void toggleFullscreenState(); 340 341 void enterFullscreen(); 341 342 void exitFullscreen(); -
trunk/Source/WebCore/page/ContextMenuController.cpp
r150575 r151512 264 264 m_hitTestResult.toggleMediaLoopPlayback(); 265 265 break; 266 case ContextMenuItemTagToggleVideoFullscreen: 267 m_hitTestResult.toggleMediaFullscreenState(); 268 break; 266 269 case ContextMenuItemTagEnterVideoFullscreen: 267 270 m_hitTestResult.enterFullscreenForVideo(); … … 731 734 #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 0 732 735 #endif 736 #endif 737 738 #if PLATFORM(MAC) 739 #define SUPPORTS_TOGGLE_VIDEO_FULLSCREEN 1 740 #else 741 #define SUPPORTS_TOGGLE_VIDEO_FULLSCREEN 0 733 742 #endif 734 743 … … 763 772 ContextMenuItem ToggleMediaLoop(CheckableActionType, ContextMenuItemTagToggleMediaLoop, 764 773 contextMenuItemTagToggleMediaLoop()); 765 ContextMenuItem EnterVideoFullscreen(ActionType, ContextMenuItemTagEnterVideoFullscreen, 774 ContextMenuItem EnterVideoFullscreen(ActionType, ContextMenuItemTagEnterVideoFullscreen, 775 contextMenuItemTagEnterVideoFullscreen()); 776 ContextMenuItem ToggleVideoFullscreen(ActionType, ContextMenuItemTagToggleVideoFullscreen, 766 777 contextMenuItemTagEnterVideoFullscreen()); 767 778 #if PLATFORM(MAC) … … 846 857 appendItem(ToggleMediaControls, m_contextMenu.get()); 847 858 appendItem(ToggleMediaLoop, m_contextMenu.get()); 859 #if SUPPORTS_TOGGLE_VIDEO_FULLSCREEN 860 appendItem(ToggleVideoFullscreen, m_contextMenu.get()); 861 #else 848 862 appendItem(EnterVideoFullscreen, m_contextMenu.get()); 849 863 #endif 850 864 appendItem(*separatorItem(), m_contextMenu.get()); 851 865 appendItem(CopyMediaLinkItem, m_contextMenu.get()); … … 1343 1357 shouldCheck = m_hitTestResult.mediaLoopEnabled(); 1344 1358 break; 1359 case ContextMenuItemTagToggleVideoFullscreen: 1360 #if SUPPORTS_TOGGLE_VIDEO_FULLSCREEN 1361 item.setTitle(m_hitTestResult.mediaIsInFullscreen() ? contextMenuItemTagExitVideoFullscreen() : contextMenuItemTagEnterVideoFullscreen()); 1362 break; 1363 #endif 1345 1364 case ContextMenuItemTagEnterVideoFullscreen: 1346 1365 shouldEnable = m_hitTestResult.mediaSupportsFullscreen(); -
trunk/Source/WebCore/platform/ContextMenuItem.h
r149186 r151512 162 162 ContextMenuItemTagDictationAlternative, 163 163 ContextMenuItemTagOpenLinkInThisWindow, 164 ContextMenuItemTagToggleVideoFullscreen, 164 165 ContextMenuItemBaseCustomTag = 5000, 165 166 ContextMenuItemCustomTagNoAction = 5998, -
trunk/Source/WebCore/platform/LocalizedStrings.cpp
r151469 r151512 493 493 { 494 494 return WEB_UI_STRING("Enter Fullscreen", "Video Enter Fullscreen context menu item"); 495 } 496 497 String contextMenuItemTagExitVideoFullscreen() 498 { 499 return WEB_UI_STRING("Exit Fullscreen", "Video Exit Fullscreen context menu item"); 495 500 } 496 501 -
trunk/Source/WebCore/platform/LocalizedStrings.h
r151469 r151512 138 138 String contextMenuItemTagToggleMediaLoop(); 139 139 String contextMenuItemTagEnterVideoFullscreen(); 140 String contextMenuItemTagExitVideoFullscreen(); 140 141 String contextMenuItemTagMediaPlay(); 141 142 String contextMenuItemTagMediaPause(); -
trunk/Source/WebCore/rendering/HitTestResult.cpp
r151003 r151512 400 400 } 401 401 402 bool HitTestResult::mediaIsInFullscreen() const 403 { 404 #if ENABLE(VIDEO) 405 if (HTMLMediaElement* mediaElement = this->mediaElement()) 406 return mediaElement->isVideo() && mediaElement->isFullscreen(); 407 #endif 408 return false; 409 } 410 411 void HitTestResult::toggleMediaFullscreenState() const 412 { 413 #if ENABLE(VIDEO) 414 if (HTMLMediaElement* mediaElement = this->mediaElement()) { 415 if (mediaElement->isVideo() && mediaElement->supportsFullscreen()) { 416 UserGestureIndicator indicator(DefinitelyProcessingNewUserGesture); 417 mediaElement->toggleFullscreenState(); 418 } 419 } 420 #endif 421 } 422 402 423 void HitTestResult::enterFullscreenForVideo() const 403 424 { -
trunk/Source/WebCore/rendering/HitTestResult.h
r147739 r151512 113 113 void toggleMediaControlsDisplay() const; 114 114 void toggleMediaLoopPlayback() const; 115 bool mediaIsInFullscreen() const; 116 void toggleMediaFullscreenState() const; 115 117 void enterFullscreenForVideo() const; 116 118 bool mediaControlsEnabled() const; -
trunk/Source/WebKit2/ChangeLog
r151508 r151512 1 2013-06-12 Ruth Fong <ruth_fong@apple.com> 2 3 Allow for toggling fullscreen on <video> elements 4 https://bugs.webkit.org/show_bug.cgi?id=117220 5 6 Reviewed by Dean Jackson. 7 8 * Shared/API/c/WKContextMenuItemTypes.h: 9 * Shared/API/c/WKSharedAPICast.h: 10 Added variables to support the toggle-ability of the fullscreen 11 video context menu item. 12 1 13 2013-06-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 14 -
trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h
r143700 r151512 118 118 kWKContextMenuItemTagSelectAll, 119 119 kWKContextMenuItemTagOpenLinkInThisWindow, 120 kWKContextMenuItemTagToggleVideoFullscreen, 120 121 kWKContextMenuItemBaseApplicationTag = 10000 121 122 }; -
trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
r150695 r151512 469 469 case WebCore::ContextMenuItemTagToggleMediaLoop: 470 470 return kWKContextMenuItemTagToggleMediaLoop; 471 case WebCore::ContextMenuItemTagToggleVideoFullscreen: 472 return kWKContextMenuItemTagToggleVideoFullscreen; 471 473 case WebCore::ContextMenuItemTagEnterVideoFullscreen: 472 474 return kWKContextMenuItemTagEnterVideoFullscreen; … … 659 661 case kWKContextMenuItemTagToggleMediaLoop: 660 662 return WebCore::ContextMenuItemTagToggleMediaLoop; 663 case kWKContextMenuItemTagToggleVideoFullscreen: 664 return WebCore::ContextMenuItemTagToggleVideoFullscreen; 661 665 case kWKContextMenuItemTagEnterVideoFullscreen: 662 666 return WebCore::ContextMenuItemTagEnterVideoFullscreen;
Note: See TracChangeset
for help on using the changeset viewer.