Commit 8214e825 authored by Abigail Klein's avatar Abigail Klein Committed by Commit Bot

Reland "webvtt: Add background opacity in mac"

This reverts commit f3d36175.

Reason for revert: The bug thought to be caused by this change was actually caused by crbug.com/966345 and fixed in https://chromium-review.googlesource.com/c/chromium/src/+/1636226/.

Original change's description:
> Revert "webvtt: Add background opacity in mac"
> 
> This reverts commit 8e606757.
> 
> Reason for revert: Caused crbug.com/964244
> 
> Original change's description:
> > webvtt: Add background opacity in mac
> >
> > To test, open a video that has a WebVTT captions file. For example, https://www.iandevlin.com/html5test/webvtt/html5-video-webvtt-sample.html is a nice example.
> >
> > Introduce new background opacity text track property for webvtt captions and wire it to apply opacity to the WebVTT caption HTML element.
> >
> > Bug: 897730
> > Change-Id: Ic8dabc2279117b7ff12eb75a9daa8d26c9d9bb25
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1592622
> > Commit-Queue: Abigail Klein <abigailbklein@google.com>
> > Auto-Submit: Abigail Klein <abigailbklein@google.com>
> > Reviewed-by: Avi Drissman <avi@chromium.org>
> > Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#659116}
> 
> Bug: 964244
> Change-Id: I76ce88cee600ed98d48426b49d1d88a40d95e507
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1622433
> Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
> Auto-Submit: Abigail Klein <abigailbklein@google.com>
> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#662163}

TBR=ellyjones@chromium.org,abigailbklein@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 964244
Change-Id: Ib14f2e59e1b84525382b207131258a46c9a18cb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643927Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Abigail Klein <abigailbklein@google.com>
Cr-Commit-Position: refs/heads/master@{#666035}
parent 4b4eed07
......@@ -47,12 +47,14 @@ std::string GetMAForegroundColorAndOpacityAsCSSColor() {
return color_utils::SkColorToRgbaString(rgba_color);
}
std::string GetMABackgroundColorAsCSSColor() {
std::string GetMABackgroundColorAndOpacityAsCSSColor() {
base::ScopedCFTypeRef<CGColorRef> cg_color(
MACaptionAppearanceCopyBackgroundColor(kUserDomain, nullptr));
float opacity = MACaptionAppearanceGetBackgroundOpacity(kUserDomain, nullptr);
return color_utils::SkColorToRgbaString(
skia::CGColorRefToSkColor(cg_color.get()));
SkColor rgba_color =
SkColorSetA(skia::CGColorRefToSkColor(cg_color.get()), 0xff * opacity);
return color_utils::SkColorToRgbaString(rgba_color);
}
// The MA text scale is a float between 0.0 and 2.0; this function converts it
......@@ -125,7 +127,7 @@ CaptionStyle CaptionStyle::FromSystemSettings() {
CaptionStyle style;
style.text_color = GetMAForegroundColorAndOpacityAsCSSColor();
style.background_color = GetMABackgroundColorAsCSSColor();
style.background_color = GetMABackgroundColorAndOpacityAsCSSColor();
style.text_size = GetMATextScaleAsCSSPercent();
style.text_shadow = GetMATextEdgeStyleAsCSSShadow();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment