Skip to content
  • jer.noble@apple.com's avatar
    Default mouse cursor behavior should be auto-hide for full screen video with custom controls · e0173750
    jer.noble@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=107601
    
    Reviewed by Beth Dakin.
    
    Source/WebCore:
    
    Test: fullscreen/video-cursor-auto-hide.html
    
    To facilitate automatically hiding the mouse cursor after a certain amount of idle mouse
    time, add a new CSS property '-webkit-cursor-visibility', and handle that value inside of
    EventHandler. When that value is present, the EventHandler will start a timer which, when
    fired, will set the view's cursor to the None cursor. Subsequent mouse moves will either
    cancel the timer, or reset the auto-hide timer.
    
    Add a new CSS property, '-webkit-cursor-visibility':
    * css/CSSComputedStyleDeclaration.cpp:
    (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
    * css/CSSParser.cpp:
    (WebCore::CSSParser::parseValue):
    * css/CSSPrimitiveValueMappings.h:
    (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
    (WebCore::CSSPrimitiveValue::operator ECursorVisibility):
    * css/CSSProperty.cpp:
    (WebCore::CSSProperty::isInheritedProperty):
    * css/CSSPropertyNames.in:
    * css/CSSValueKeywords.in:
    * css/StyleBuilder.cpp:
    (WebCore::StyleBuilder::StyleBuilder):
    * css/StyleResolver.cpp:
    (WebCore::StyleResolver::applyProperty):
    
    Add a rule for video descendants of full screen elements to auto-hide the cursor on hover:
    * css/fullscreen.css:
    (:-webkit-full-screen video:hover):
    
    Add a new timer, m_autoHideCursorTimer, to control resetting the view's cursor to None after
    enough mouse idle time has passed.
    * page/EventHandler.cpp:
    (WebCore::EventHandler::EventHandler):
    (WebCore::EventHandler::~EventHandler):
    (WebCore::EventHandler::clear):
    (WebCore::EventHandler::selectCursor):
    (WebCore::EventHandler::startAutoHideCursorTimer):
    (WebCore::EventHandler::cancelAutoHideCursorTimer):
    (WebCore::EventHandler::autoHideCursorTimerFired):
    * page/EventHandler.h:
    
    Make FrameView::isActive() a public function (like it is in its superclass).
    * page/FrameView.h:
    (FrameView):
    
    Move the definition for timeWithoutMouseMovementBeforeHidingControls from page->theme()
    to page->settings() and allow that setting to be overridden in InternalSettings for
    testing purposes:
    * page/Settings.cpp:
    (WebCore::Settings::Settings):
    * page/Settings.h:
    (WebCore::Settings::setTimeWithoutMouseMovementBeforeHidingControls):
    (WebCore::Settings::timeWithoutMouseMovementBeforeHidingControls):
    * rendering/RenderTheme.h:
    * testing/InternalSettings.cpp:
    (WebCore::InternalSettings::Backup::Backup):
    (WebCore::InternalSettings::Backup::restoreTo):
    (WebCore::InternalSettings::setTimeWithoutMouseMovementBeforeHidingControls):
    * testing/InternalSettings.h:
    (InternalSettings):
    * testing/InternalSettings.idl:
    * html/shadow/MediaControls.cpp:
    (WebCore::MediaControls::startHideFullscreenControlsTimer):
    
    Add support to FeatureObserver for CURSOR_VISIBILITY:
    * page/FeatureObserver.h:
    
    Enable the feature flag:
    * Configurations/FeatureDefines.xcconfig:
    
    Source/WebKit:
    
    Enable the CURSOR_VISIBILITY feature.
    
    * WebKit.vcxproj/FeatureDefines.props:
    
    Source/WebKit/mac:
    
    Enable the CURSOR_VISIBILITY feature.
    
    * Configurations/FeatureDefines.xcconfig:
    
    Source/WebKit2:
    
    Enable the CURSOR_VISIBILITY feature.
    
    * Configurations/FeatureDefines.xcconfig:
    
    Source/WTF:
    
    Enable the CURSOR_VISIBILITY feature.
    
    * wtf/FeatureDefines.h:
    
    LayoutTests:
    
    * fullscreen/video-cursor-auto-hide-expected.txt: Added.
    * fullscreen/video-cursor-auto-hide.html: Added.
    
    Add an expected failing result in platforms which do not enable CURSOR_VISIBILITY.
    * platform/chromium/TestExpectations:
    * platform/efl/TestExpectations:
    * platform/gtk/TestExpectations:
    * platform/qt/TestExpectations:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145003 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    e0173750