1. 28 Feb, 2013 1 commit
  2. 23 Feb, 2013 1 commit
  3. 20 Feb, 2013 1 commit
  4. 14 Feb, 2013 1 commit
  5. 13 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      [Mac] Caption menu should have only one item selected · 70109507
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109730
      
      Reviewed by Dean Jackson.
      
      Source/WebCore: 
      
      No new tests, media/track/track-user-preferences.html was modified to test the changes.
      
      * CMakeLists.txt: Add CaptionUserPreferences.cpp.
      * GNUmakefile.list.am: Ditto.
      * Target.pri: Ditto.
      * WebCore.gypi: Ditto.
      * WebCore.vcproj/WebCore.vcproj: Ditto.
      * WebCore.vcxproj/WebCore.vcxproj: Ditto.
      * WebCore.xcodeproj/project.pbxproj: Ditto.
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_processingPreferenceChange.
      (WebCore::HTMLMediaElement::configureTextTrackGroup): Only end up with one selected track when
          called because of a preferences change.
      (WebCore::HTMLMediaElement::captionPreferencesChanged): Call setClosedCaptionsVisible instead
          of calling markCaptionAndSubtitleTracksAsUnconfigured directly.
      (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Process all tracks, 
          not just track elements.
      * html/HTMLMediaElement.h:
      
      * page/CaptionUserPreferences.cpp: Added so the functionality can be tested in DRT.
      (WebCore::CaptionUserPreferences::registerForPreferencesChangedCallbacks):
      (WebCore::CaptionUserPreferences::unregisterForPreferencesChangedCallbacks):
      (WebCore::CaptionUserPreferences::setUserPrefersCaptions):
      (WebCore::CaptionUserPreferences::captionPreferencesChanged):
      (WebCore::CaptionUserPreferences::preferredLanguages):
      (WebCore::CaptionUserPreferences::setPreferredLanguage):
      (WebCore::CaptionUserPreferences::displayNameForTrack):
      * page/CaptionUserPreferences.h:
      
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::registerForPreferencesChangedCallbacks): Moved some logic
          to base class.
      (WebCore::CaptionUserPreferencesMac::captionPreferencesChanged): Ditto.
      
      LayoutTests: 
      
      * media/track/track-user-preferences-expected.txt:
      * media/track/track-user-preferences.html: Update test to check for reactions to preferences.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      70109507
  6. 12 Feb, 2013 1 commit
  7. 11 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      [Mac] Track language selection should be sticky · b54d1c88
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109466
      
      Reviewed by Dean Jackson.
      
      .: 
      
      * Source/autotools/symbols.filter: Export PageGroup::captionPreferences and Page::initGroup.
      
      Source/WebCore: 
      
      Choosing a text track from the caption menu should make that track's language the
      preferred caption language. Turning captions off from the menu should disable captions
      in videos loaded subsequently.
      
      OS X has system support for these settings, so changes made by DRT should not change the
      settings on the user's system. Add support for all other ports in DRT only.
      
      Test: media/track/track-user-preferences.html
      
      * WebCore.exp.in: Export PageGroup::captionPreferences().
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::HTMLMediaElement): Use page()->group().captionPreferences().
      (WebCore::HTMLMediaElement::attach): Ditto.
      (WebCore::HTMLMediaElement::detach): Ditto.
      (WebCore::HTMLMediaElement::userPrefersCaptions): Ditto.
      (WebCore::HTMLMediaElement::configureTextTrackGroup): Ditto. Update for 
          preferredLanguageFromList change.
      (WebCore::HTMLMediaElement::toggleTrackAtIndex): Set user prefs for captions visible and
          caption language as appropriate.
      
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler): Remove unneeded comment.
      (WebCore::MediaControlTextTrackContainerElement::updateSizes):  Use page()->group().captionPreferences().
      
      * html/shadow/MediaControlsApple.cpp:
      (WebCore::MediaControlsApple::closedCaptionTracksChanged): Update caption menu button visibility.
      
      * page/CaptionUserPreferences.h:
      (WebCore::CaptionUserPreferences::userPrefersCaptions): Support "testing" mode.
      (WebCore::CaptionUserPreferences::setUserPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferences::registerForPreferencesChangedCallbacks): Ditto.
      (WebCore::CaptionUserPreferences::unregisterForPreferencesChangedCallbacks): Ditto.
      (WebCore::CaptionUserPreferences::setPreferredLanguage): Ditto.
      (WebCore::CaptionUserPreferences::preferredLanguages): Ditto.
      (WebCore::CaptionUserPreferences::testingMode): Ditto.
      (WebCore::CaptionUserPreferences::setTestingMode): Ditto.
      (WebCore::CaptionUserPreferences::CaptionUserPreferences): Ditto.
      
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::userPrefersCaptions): Support "testing" mode.
      (WebCore::CaptionUserPreferencesMac::setUserPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferencesMac::userHasCaptionPreferences): Ditto.
      (WebCore::CaptionUserPreferencesMac::registerForPreferencesChangedCallbacks): Change name from
          registerForCaptionPreferencesChangedCallbacks. Support "testing" mode.
      (WebCore::CaptionUserPreferencesMac::unregisterForPreferencesChangedCallbacks):  Change name from
          unregisterForCaptionPreferencesChangedCallbacks. Support "testing" mode.
      (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Support "testing" mode.
      (WebCore::CaptionUserPreferencesMac::captionFontSizeScale): Ditto.
      (WebCore::CaptionUserPreferencesMac::setPreferredLanguage): Ditto.
      (WebCore::CaptionUserPreferencesMac::preferredLanguages): Ditto. Return the platform override when set.
      
      * page/PageGroup.cpp:
      (WebCore::PageGroup::registerForCaptionPreferencesChangedCallbacks): Remove because it is already
          available from the caption preference object.
      (WebCore::PageGroup::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
      (WebCore::PageGroup::userPrefersCaptions): Ditto.
      (WebCore::PageGroup::userHasCaptionPreferences): Ditto.
      (WebCore::PageGroup::captionFontSizeScale): Ditto.
      * page/PageGroup.h:
      
      * platform/Language.cpp:
      (WebCore::preferredLanguageFromList): Take the list of preferred languages instead of assuming
          the system list.
      * platform/Language.h:
      
      * testing/Internals.cpp:
      (WebCore::Internals::resetToConsistentState): Disable caption testing mode.
      (WebCore::Internals::Internals): Enable caption testing mode so the user's system
          preferences are not modified.
      
      LayoutTests: 
      
      * media/track/track-user-preferences-expected.txt: Added.
      * media/track/track-user-preferences.html: Added.
      
      * platform/chromium/TestExpectations: Skip new test, it depends on the track menu.
      * platform/efl/TestExpectations: Ditto.
      * platform/gtk/TestExpectations: Ditto.
      * platform/qt/TestExpectations: Ditto.
      * platform/win/TestExpectations: Ditto.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b54d1c88
  8. 09 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      [Mac] Do not assume MediaAccessibility framework is installed · 4ef7e2a7
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109365
      
      Reviewed by Sam Weinig.
      
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::userPrefersCaptions): Call the base class if the framework
          is not available.
      (WebCore::CaptionUserPreferencesMac::setUserPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferencesMac::userHasCaptionPreferences): Ditto.
      (WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Ditto.
      (WebCore::CaptionUserPreferencesMac::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
      (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Ditto.
      (WebCore::CaptionUserPreferencesMac::captionFontSizeScale): Ditto.
      (WebCore::CaptionUserPreferencesMac::setPreferredLanguage): Ditto.
      (WebCore::CaptionUserPreferencesMac::preferredLanguages): Ditto.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4ef7e2a7
  9. 08 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      [Mac] respect in-band caption color · 2cd48f46
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109203
      
      Reviewed by Dean Jackson.
      
      Source/WebCore: 
      
      Test: media/track/track-in-band-style.html
      
      * WebCore.xcodeproj/project.pbxproj: Add HTMLDivElement.h to private headers because it is 
          included by HTMLTextElement, which is included by HTMLMediaElement.h, which is included 
          by files in WebKit/WebKit2.
      * html/track/InbandTextTrack.cpp:
      (WebCore::InbandTextTrack::addGenericCue): Set cue colors if necessary.
      
      * html/track/TextTrackCue.h:
      (WebCore::TextTrackCue::element): New, accessor for the cue element so it can be styled.
      
      * html/track/TextTrackCueGeneric.cpp:
      (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): Set container and cue background 
          color if necessary.
      (WebCore::TextTrackCueGeneric::operator==): Compare cue colors.
      * html/track/TextTrackCueGeneric.h:
      (WebCore::TextTrackCueGeneric::foregroundColor): Add color accessors.
      (WebCore::TextTrackCueGeneric::setForegroundColor):
      (WebCore::TextTrackCueGeneric::backgroundColor):
      (WebCore::TextTrackCueGeneric::setBackgroundColor):
      
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Always
          regenerate override CSS when an element registers for callbacks.
      (WebCore::CaptionUserPreferencesMac::captionsWindowCSS): Drive by fix of "window color" padding.
      (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Log the stylesheet generated
          for easier debugging.
      
      * platform/graphics/InbandTextTrackPrivateClient.h:
      (WebCore::GenericCueData::foregroundColor): Add color getters/setters.
      (WebCore::GenericCueData::setForegroundColor):
      (WebCore::GenericCueData::backgroundColor):
      (WebCore::GenericCueData::setBackgroundColor):
      
      * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
      (WebCore::makeRGBA32FromARGBCFArray): Initialize a RGBA32 from a CFArray of color values.
      (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Process cue colors.
      
      LayoutTests: 
      
      * media/track/track-in-band-style-expected.txt: Added.
      * media/track/track-in-band-style.html: Added.
      
      * platform/chromium/TestExpectations: Skip new test.
      * platform/efl/TestExpectations: Ditto.
      * platform/gtk/TestExpectations: Ditto.
      * platform/mac/TestExpectations: Ditto.
      * platform/qt/TestExpectations: Ditto.
      * platform/win/TestExpectations: Ditto.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2cd48f46
  10. 05 Feb, 2013 2 commits
    • eric.carlson@apple.com's avatar
      More updates to Caption user preferences · 0908653c
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=108997
      
      Reviewed by Dean Jackson.
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::captionPreferencesChanged): Give the media controls a chance
          to update for a preferences change.
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlTextTrackContainerElement::updateSizes): Add optional "force update" 
          param to force font size recalc even when the video size hasn't changed.
      * html/shadow/MediaControlElements.h:
      
      * html/shadow/MediaControls.cpp:
      (WebCore::MediaControls::textTrackPreferencesChanged): New, force a font size recalc.
      * html/shadow/MediaControls.h:
      
      * html/track/TextTrackCueGeneric.cpp:
      (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): Don't set width/size of cues
          that use default positioning. Use "start" as the default alignment.
      
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::captionsWindowCSS): Set padding when the window is visible
          so it shows around the cue background.
      (WebCore::CaptionUserPreferencesMac::captionsBackgroundCSS): Set padding to 0 when the background
          is visible.
      (WebCore::CaptionUserPreferencesMac::windowRoundedCornerRadiusCSS): Add "px" to the border radius
          so it actually works.
      * rendering/RenderTextTrackCue.cpp:
      (WebCore::RenderTextTrackCue::layout): Special case generic cues with default style.
      (WebCore::RenderTextTrackCue::repositionGenericCue):
      * rendering/RenderTextTrackCue.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0908653c
    • dino@apple.com's avatar
      [Mac] Captions menu should indicate language and type of track · 53a29d41
      dino@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=108882
      
      Reviewed by Eric Carlson.
      
      Source/WebCore:
      
      On Mac, we want a specific format for menu items in a caption list. Since
      other ports might want different formats, move the generation of the label
      into CaptionsUserPreferences where it can be overridden.
      
      This required CaptionsUserPreferences to become public on the PageGroup, so
      it could be used when creating the menu. Also, since CaptionsUserPreferences
      was hidden on Mountain Lion and below, be a little more specific about
      which pieces can be seen on which builds.
      
      Covered by existing media/video-controls-captions-trackmenu tests.
      
      * English.lproj/Localizable.strings: Remove textTrackClosedCaptionsText.
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu): Build only
          one section and get the track's display name from the user preferences.
      * page/CaptionUserPreferences.h:
      (WebCore::CaptionUserPreferences::displayNameForTrack): Default implementation of
          virtual function that provides a label for a captions menu item.
      * page/CaptionUserPreferencesMac.h: Add the new virtual function, and expose just
          a bit of this class outside 10.9 builds.
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::CaptionUserPreferencesMac): Guard features for system version.
      (WebCore::CaptionUserPreferencesMac::~CaptionUserPreferencesMac): Ditto.
      (WebCore::CaptionUserPreferencesMac::displayNameForTrack): New OS X-specific method that
          returns a string for the menu label.
      * page/PageGroup.cpp:
      (WebCore::PageGroup::captionPreferences): Unguard for system version.
      * page/PageGroup.h: Make captionPreferences public.
      * platform/LocalizedStrings.cpp: Remove textTrackClosedCaptionsText - not needed any more.
      * platform/LocalizedStrings.h: Remove textTrackClosedCaptionsText.
      
      LayoutTests:
      
      Now that the captions menu can be labelled in a platform-specific way, move
      the results into the platform directory. At the moment, they are skipped
      everywhere but Mac. Also update the tests to the new menu structure, which
      only has a single list of entries.
      
      * media/video-controls-captions-trackmenu-localized.html: Updated for new menu structure.
      * media/video-controls-captions-trackmenu-expected.txt: Removed.
      * media/video-controls-captions-trackmenu-localized-expected.txt: Removed.
      * media/video-controls-captions-trackmenu-sorted-expected.txt: Removed.
      * media/video-controls-captions-trackmenu-sorted.html: Updated for new menu structure.
      * media/video-controls-captions-trackmenu.html: Updated for new menu structure.
      * platform/mac/media/video-controls-captions-trackmenu-expected.txt: New platform specific results.
      * platform/mac/media/video-controls-captions-trackmenu-localized-expected.txt: Ditto.
      * platform/mac/media/video-controls-captions-trackmenu-sorted-expected.txt: Ditto.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      53a29d41
  11. 04 Feb, 2013 1 commit
    • eric.carlson@apple.com's avatar
      Update CaptionUserPreferences · f02a61ae
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=108783
      
      Reviewed by Dean Jackson.
      
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlTextTrackContainerElement::updateSizes): Mark font size as important
          when necessary.
      * page/CaptionUserPreferences.h:
      (WebCore::CaptionUserPreferences::setUserPrefersCaptions): New, allow a port to remember that
          the user has chosen to see captions.
      (WebCore::CaptionUserPreferences::setPreferredLanguage): New, allow a port to remember the
          user's preferred caption language.
      (WebCore::CaptionUserPreferences::preferredLanguages): New, return a Vector of the user's 
          preferred caption languages.
      * page/CaptionUserPreferencesMac.h:
      * page/CaptionUserPreferencesMac.mm:
      * page/PageGroup.cpp:
      (WebCore::PageGroup::captionPreferences):
      (WebCore::PageGroup::captionFontSizeScale):
      * page/PageGroup.h:
      * platform/Language.cpp:
      (WebCore::userPreferredLanguagesOverride): New, return the user preferred languages override
          used during testing.
      * platform/Language.h:
      * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
      (WebCore::InbandTextTrackPrivateAVFObjC::kind):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f02a61ae
  12. 04 Jan, 2013 1 commit
    • commit-queue@webkit.org's avatar
      Implement :future pseudo class for the WebVTT ::cue pseudo element · 324b0985
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=105473
      
      Patch by Dima Gorbik <dgorbik@apple.com> on 2013-01-04
      Reviewed by Antti Koivisto.
      
      Source/WebCore:
      
      This patch changes the approach of showing past/future node objects.
      Before upper-level containers were used to put past and future nodes inside. Styles were applied
      to containers. Now styles could be applied directly to nodes by using ::cue(:future).
      That allows to style future/past WebVTT nodes even if they are nested.
      
      Existing test was modified to cover new cases.
      
      * css/CSSSelector.cpp: added :future pseudo class support.
      (WebCore::CSSSelector::pseudoId):
      (WebCore::nameToPseudoTypeMap):
      (WebCore::CSSSelector::extractPseudoType):
      * css/CSSSelector.h:
      * css/SelectorChecker.cpp: ditto.
      (WebCore::SelectorChecker::checkOneSelector):
      * css/StyleResolver.cpp:
      (WebCore::StyleResolver::canShareStyleWithElement): define style sharing rules for WebVTT objects.
      * css/mediaControls.css:
      (video::-webkit-media-text-track-all-nodes):
      (video::cue(:future)): added standard user-agent styles for the future nodes.
      * dom/Element.cpp: setter functions don't have an argument now because WebVTT type enum was introduced and the right type is set
      when the setter is being called.
      (WebCore::Element::setIsWebVTTNode):
      (WebCore):
      (WebCore::Element::isWebVTTFutureNode):
      (WebCore::Element::setIsWebVTTFutureNode):
      * dom/Element.h:
      (Element):
      * dom/ElementRareData.h:
      (ElementRareData):
      * dom/NodeRareData.cpp:
      (SameSizeAsNodeRareData): added a dummy enum value. Enum is integer type and is aligned in Windows when placed in the bitfield,
      so it takes more space.
      * dom/NodeRareData.h:
      (WebCore::NodeRareData::NodeRareData):
      (WebCore::NodeRareData::isWebVTTNode):
      (WebCore::NodeRareData::setIsWebVTTNode):
      (WebCore::NodeRareData::isWebVTTFutureNode):
      (WebCore::NodeRareData::setIsWebVTTFutureNode):
      (NodeRareData):
      * html/shadow/MediaControlElements.cpp:
      (WebCore):
      * html/track/TextTrack.h: add a WebVTT node object type enum.
      (TextTrack):
      * html/track/TextTrackCue.cpp:
      (WebCore::TextTrackCue::allNodesShadowPseudoId):
      (WebCore::TextTrackCue::TextTrackCue):
      (WebCore::TextTrackCue::getCueAsHTML):
      (WebCore):
      (WebCore::TextTrackCue::setNodeObjectFlags): determine if the node is future or past and mark as WebVTT node.
      This combines the functionality related to marking nodes implemented before in updateDisplayTree and
      markNodesAsWebVTTNodes.
      (WebCore::TextTrackCue::updateDisplayTree):
      (WebCore::TextTrackCue::getDisplayTree):
      * html/track/TextTrackCue.h:
      (TextTrackCue):
      * html/track/WebVTTParser.cpp:
      (WebCore::WebVTTParser::constructTreeFromToken): no need to mark nodes as WebVTT nodes when parsing. This is done at the
      rendering stage later.
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): the container name has changed.
      
      LayoutTests:
      
      Modified the track css matching test to cover :future pseudo-class case.
      
      * media/track/captions-webvtt/captions-inner-timestamps.vtt: Removed.
      * media/track/captions-webvtt/styling.vtt:
      * media/track/track-css-matching-expected.txt:
      * media/track/track-css-matching.html:
      * media/track/track-cue-rendering-inner-timestamps-expected.txt: Removed.
      * media/track/track-cue-rendering-inner-timestamps.html: The test was removed because it was based on the old
      future/past nodes rendering logic.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138784 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      324b0985
  13. 24 Oct, 2012 2 commits
    • eric.carlson@apple.com's avatar
      Allow ports to override text track rendering style · 579c7272
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=97800
      <rdar://problem/12044964>
      
      Unreviewed Build fix.
              
      CGFloat is already a float in a 32-bit build so narrowPrecisionToFloat() is unnecessary
      
      * page/CaptionUserPreferencesMac.mm:
      (WebCore::CaptionUserPreferencesMac::captionFontSizeScale):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      579c7272
    • eric.carlson@apple.com's avatar
      Allow ports to override text track rendering style · 68e8da75
      eric.carlson@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=97800
      <rdar://problem/12044964>
      
      Reviewed by Maciej Stachowiak.
      
      Source/WebCore:
      
      * WebCore.exp.in: Export new WebkitSystemInterface functions.
      * WebCore.xcodeproj/project.pbxproj: Add CaptionUserPreferences.h, CaptionUserPreferencesMac.mm,
          and CaptionUserPreferencesMac.h.
      
      * css/mediaControls.css: Rearrange the caption CSS so it is possible to style the cue window,
          background, and text independently.
      
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_disableCaptions with theme->userPrefersCaptions().
      (WebCore::HTMLMediaElement::attach): Register for caption preferences change callbacks.
      (WebCore::HTMLMediaElement::detach): Unregister for caption preferences change callbacks.
      (WebCore::HTMLMediaElement::userPrefersCaptions): Return theme->userPrefersCaptions().
      (WebCore::HTMLMediaElement::userIsInterestedInThisTrackKind): Consider userPrefersCaptions().
      (WebCore::HTMLMediaElement::setClosedCaptionsVisible): Move the code that marks all tracks as
          un-configured to markCaptionAndSubtitleTracksAsUnconfigured so it can be reused.
      (WebCore::HTMLMediaElement::captionPreferencesChanged): New, force a reevaluation of all text tracks.
      (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): New, code moved from
          setClosedCaptionsVisible
      * html/HTMLMediaElement.h: Inherit from CaptionPreferencesChangedListener.
      
      * html/shadow/MediaControlElements.cpp:
      (WebCore::MediaControlTextTrackContainerElement::updateSizes): Get rid of unnecessary member
          variable. Get caption font scale from theme instead of hard coding.
      * html/shadow/MediaControlElements.h:
      
      * html/track/TextTrack.cpp:
      (WebCore::TextTrack::TextTrack): Change attributes from String to AtomicString.
      (WebCore::TextTrack::isValidKindKeyword): Ditto.
      (WebCore::TextTrack::setKind): Ditto.
      (WebCore::TextTrack::setMode): Ditto.
      (WebCore::TextTrack::mode): Ditto.
      * html/track/TextTrack.h:
      (WebCore::TextTrack::create): Ditto.
      (WebCore::TextTrack::kind): Ditto.
      (WebCore::TextTrack::label): Ditto.
      (WebCore::TextTrack::setLabel): Ditto.
      (WebCore::TextTrack::language): Ditto.
      (WebCore::TextTrack::setLanguage): Ditto.
      
      * html/track/TextTrackCue.cpp:
      (WebCore::TextTrackCueBox::TextTrackCueBox): Set the shadow pseudo id.
      (WebCore::TextTrackCueBox::textTrackCueBoxShadowPseudoId): New, class method to return the
          shadow pseudo id so it can be used elsewhere.
      (WebCore::TextTrackCueBox::shadowPseudoId): Call textTrackCueBoxShadowPseudoId.
      (WebCore::TextTrackCue::pastNodesShadowPseudoId): New, class method to return the
          shadow pseudo id so it can be used elsewhere.
      (WebCore::TextTrackCue::futureNodesShadowPseudoId): Ditto.
      (WebCore::TextTrackCue::updateDisplayTree):
      * html/track/TextTrackCue.h:
      
      * page/CaptionUserPreferences.h: Added.
      * page/CaptionUserPreferencesMac.h: Added.
      * page/CaptionUserPreferencesMac.mm: Added.
      (WebCore::userCaptionPreferencesChangedNotificationCallback):
      (WebCore::CaptionUserPreferencesMac::CaptionUserPreferencesMac):
      (WebCore::CaptionUserPreferencesMac::~CaptionUserPreferencesMac):
      (WebCore::CaptionUserPreferencesMac::userHasCaptionPreferences): New, passthrough to WKSI function.
      (WebCore::CaptionUserPreferencesMac::userPrefersCaptions): Ditto.
      (WebCore::CaptionUserPreferencesMac::captionsWindowColor): Return Color with user's caption window color preference.
      (WebCore::CaptionUserPreferencesMac::captionsBackgroundColor): Return Color with user's caption
          background color preference.
      (WebCore::CaptionUserPreferencesMac::captionsTextColor): Return Color with user's caption text color preference.
      (WebCore::CaptionUserPreferencesMac::captionsEdgeColorForTextColor): Return Color for text edge effect.
      (WebCore::CaptionUserPreferencesMac::cssPropertyWithTextEdgeColor): Return String with CSS to set a text-shadow
          or webkit-text-stroke property.
      (WebCore::CaptionUserPreferencesMac::cssColorProperty): Return a String with css to set a property
          with a color value.
      (WebCore::CaptionUserPreferencesMac::captionsTextEdgeStyle): Return a String with css to style caption
          text with the user's preferred text edge stye.
      (WebCore::CaptionUserPreferencesMac::captionsDefaultFont): Return a String with css to style caption
          text with the user's preferred font.
      (WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Return a String with css to style captions
          with the user's preferred style.
      (WebCore::CaptionUserPreferencesMac::captionFontSizeScale): Return the user's preferred caption font scale.
      (WebCore::CaptionUserPreferencesMac::captionPreferencesChanged): Notify listeners of caption preference change.
      (WebCore::CaptionUserPreferencesMac::registerForCaptionPreferencesChangedCallbacks): Add a caption preferences
          changes listener.
      (WebCore::CaptionUserPreferencesMac::unregisterForCaptionPreferencesChangedCallbacks): Remove a caption preferences
          changes listener.
      (WebCore::CaptionUserPreferencesMac::updateCaptionStyleSheetOveride): New, if theme has a captions style sheet override,
          inject it into the current page group, otherwise remove injected sheet.
      
      * page/PageGroup.cpp:
      (WebCore::PageGroup::captionPreferences):
      (WebCore::PageGroup::registerForCaptionPreferencesChangedCallbacks): New, passthrough to platform specific function
          of the same name.
      (WebCore::PageGroup::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
      (WebCore::PageGroup::userPrefersCaptions): Ditto.
      (WebCore::PageGroup::userHasCaptionPreferences): Ditto.
      (WebCore::PageGroup::captionFontSizeScale): Ditto.
      * page/PageGroup.h:
      
      * platform/mac/WebCoreSystemInterface.h: Updated.
      * platform/mac/WebCoreSystemInterface.mm: Ditto.
      
      Source/WebKit/mac:
      
      * WebCoreSupport/WebSystemInterface.mm:
      (InitWebCoreSystemInterface): Initialize new WKSI function pointers.
      
      Source/WebKit2:
      
      * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
      (InitWebCoreSystemInterface): Initialize new WKSI function pointers.
      
      WebKitLibraries:
      
      Update WKSI header with SPI for getting the user caption appearance preferences.
      
      * WebKitSystemInterface.h:
      
      LayoutTests:
      
      * media/track/track-cue-rendering-expected.txt: Update results for caption css changes.
      * media/track/track-cue-rendering.html:
      * platform/chromium/TestExpectations: Skip tests that need to be rebaselined.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      68e8da75