Changeset 170908 in webkit


Ignore:
Timestamp:
Jul 8, 2014, 9:53:03 PM (11 years ago)
Author:
eric.carlson@apple.com
Message:

[iOS] user caption preferences not applied
https://bugs.webkit.org/show_bug.cgi?id=134599

Reviewed by Sam Weinig.

  • page/CaptionUserPreferences.cpp:

(WebCore::CaptionUserPreferences::updateCaptionStyleSheetOveride): All Pages in a PageGroup
do not necessarily use the same PageUserContentController, so apply and remove caption user
the style sheet directly to each page rather than to the page group.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r170906 r170908  
     12014-07-08  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [iOS] user caption preferences not applied
     4        https://bugs.webkit.org/show_bug.cgi?id=134599
     5
     6        Reviewed by Sam Weinig.
     7
     8        * page/CaptionUserPreferences.cpp:
     9        (WebCore::CaptionUserPreferences::updateCaptionStyleSheetOveride): All Pages in a PageGroup
     10        do not necessarily use the same PageUserContentController, so apply and remove caption user
     11        the style sheet directly to each page rather than to the page group.
     12
    1132014-07-08  Commit Queue  <commit-queue@webkit.org>
    214
  • trunk/Source/WebCore/page/CaptionUserPreferences.cpp

    r165607 r170908  
    3434#include "Settings.h"
    3535#include "TextTrackList.h"
     36#include "UserContentController.h"
    3637#include "UserStyleSheetTypes.h"
    3738
     
    240241    DEPRECATED_DEFINE_STATIC_LOCAL(URL, captionsStyleSheetURL, (ParsedURLString, "user-captions-override:01F6AF12-C3B0-4F70-AF5E-A3E00234DC23"));
    241242
    242     m_pageGroup.removeUserStyleSheetFromWorld(mainThreadNormalWorld(), captionsStyleSheetURL);
     243    auto& pages = m_pageGroup.pages();
     244    for (auto& page : pages) {
     245        if (auto* pageUserContentController = page->userContentController())
     246            pageUserContentController->removeUserStyleSheet(mainThreadNormalWorld(), captionsStyleSheetURL);
     247    }
    243248
    244249    String captionsOverrideStyleSheet = captionsStyleSheetOverride();
     
    246251        return;
    247252
    248     m_pageGroup.addUserStyleSheetToWorld(mainThreadNormalWorld(), captionsOverrideStyleSheet, captionsStyleSheetURL, Vector<String>(),
    249         Vector<String>(), InjectInAllFrames, UserStyleAuthorLevel, InjectInExistingDocuments);
     253    for (auto& page : pages) {
     254        if (auto* pageUserContentController = page->userContentController()) {
     255            auto userStyleSheet = std::make_unique<UserStyleSheet>(captionsOverrideStyleSheet, captionsStyleSheetURL, Vector<String>(), Vector<String>(), InjectInAllFrames, UserStyleAuthorLevel);
     256            pageUserContentController->addUserStyleSheet(mainThreadNormalWorld(), std::move(userStyleSheet), InjectInExistingDocuments);
     257        }
     258    }
    250259}
    251260
Note: See TracChangeset for help on using the changeset viewer.