Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: Source/core/html/track/vtt/VTTCue.cpp

Issue 921833003: Expose APIs for text track settings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments from fs Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. 2 * Copyright (c) 2013, Opera Software ASA. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 20 matching lines...) Expand all
31 #include "core/html/track/vtt/VTTCue.h" 31 #include "core/html/track/vtt/VTTCue.h"
32 32
33 #include "bindings/core/v8/ExceptionMessages.h" 33 #include "bindings/core/v8/ExceptionMessages.h"
34 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 34 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
35 #include "bindings/core/v8/UnionTypesCore.h" 35 #include "bindings/core/v8/UnionTypesCore.h"
36 #include "core/CSSPropertyNames.h" 36 #include "core/CSSPropertyNames.h"
37 #include "core/CSSValueKeywords.h" 37 #include "core/CSSValueKeywords.h"
38 #include "core/dom/DocumentFragment.h" 38 #include "core/dom/DocumentFragment.h"
39 #include "core/dom/NodeTraversal.h" 39 #include "core/dom/NodeTraversal.h"
40 #include "core/events/Event.h" 40 #include "core/events/Event.h"
41 #include "core/frame/Settings.h"
41 #include "core/frame/UseCounter.h" 42 #include "core/frame/UseCounter.h"
42 #include "core/html/HTMLDivElement.h" 43 #include "core/html/HTMLDivElement.h"
43 #include "core/html/track/TextTrack.h" 44 #include "core/html/track/TextTrack.h"
44 #include "core/html/track/TextTrackCueList.h" 45 #include "core/html/track/TextTrackCueList.h"
45 #include "core/html/track/vtt/VTTElement.h" 46 #include "core/html/track/vtt/VTTElement.h"
46 #include "core/html/track/vtt/VTTParser.h" 47 #include "core/html/track/vtt/VTTParser.h"
47 #include "core/html/track/vtt/VTTRegionList.h" 48 #include "core/html/track/vtt/VTTRegionList.h"
48 #include "core/html/track/vtt/VTTScanner.h" 49 #include "core/html/track/vtt/VTTScanner.h"
49 #include "core/rendering/RenderVTTCue.h" 50 #include "core/rendering/RenderVTTCue.h"
50 #include "platform/FloatConversion.h" 51 #include "platform/FloatConversion.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // across the width of the video's rendering area, and the point y% 198 // across the width of the video's rendering area, and the point y%
198 // along the height of the bounding box of the boxes in boxes is y% 199 // along the height of the bounding box of the boxes in boxes is y%
199 // of the way across the height of the video's rendering area, while 200 // of the way across the height of the video's rendering area, while
200 // maintaining the relative positions of the boxes in boxes to each 201 // maintaining the relative positions of the boxes in boxes to each
201 // other. 202 // other.
202 setInlineStyleProperty(CSSPropertyWebkitTransform, 203 setInlineStyleProperty(CSSPropertyWebkitTransform,
203 String::format("translate(-%.2f%%, -%.2f%%)", position.x(), position .y())); 204 String::format("translate(-%.2f%%, -%.2f%%)", position.x(), position .y()));
204 205
205 setInlineStyleProperty(CSSPropertyWhiteSpace, CSSValuePre); 206 setInlineStyleProperty(CSSPropertyWhiteSpace, CSSValuePre);
206 } 207 }
208
209 Settings* settings = m_cue->element()->document().settings();
210 if (settings) {
211 m_cue->element()->setInlineStyleProperty(CSSPropertyBackgroundColor, set tings->textTrackBackgroundColor(), true);
212 m_cue->element()->setInlineStyleProperty(CSSPropertyFontFamily, settings ->textTrackFontFamily(), true);
213 m_cue->element()->setInlineStyleProperty(CSSPropertyFontStyle, settings- >textTrackFontStyle(), true);
214 m_cue->element()->setInlineStyleProperty(CSSPropertyFontVariant, setting s->textTrackFontVariant(), true);
215 m_cue->element()->setInlineStyleProperty(CSSPropertyColor, settings->tex tTrackTextColor(), true);
216 m_cue->element()->setInlineStyleProperty(CSSPropertyTextShadow, settings ->textTrackTextShadow(), true);
217 m_cue->element()->setInlineStyleProperty(CSSPropertyFontSize, settings-> textTrackTextSize(), true);
218 // Override background color for the cue box
219 setInlineStyleProperty(CSSPropertyBackgroundColor, settings->textTrackWi ndowColor(), true);
220 }
207 } 221 }
208 222
209 LayoutObject* VTTCueBox::createRenderer(const LayoutStyle&) 223 LayoutObject* VTTCueBox::createRenderer(const LayoutStyle&)
210 { 224 {
211 return new RenderVTTCue(this); 225 return new RenderVTTCue(this);
212 } 226 }
213 227
214 void VTTCueBox::trace(Visitor* visitor) 228 void VTTCueBox::trace(Visitor* visitor)
215 { 229 {
216 visitor->trace(m_cue); 230 visitor->trace(m_cue);
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 1148
1135 void VTTCue::trace(Visitor* visitor) 1149 void VTTCue::trace(Visitor* visitor)
1136 { 1150 {
1137 visitor->trace(m_vttNodeTree); 1151 visitor->trace(m_vttNodeTree);
1138 visitor->trace(m_cueBackgroundBox); 1152 visitor->trace(m_cueBackgroundBox);
1139 visitor->trace(m_displayTree); 1153 visitor->trace(m_displayTree);
1140 TextTrackCue::trace(visitor); 1154 TextTrackCue::trace(visitor);
1141 } 1155 }
1142 1156
1143 } // namespace blink 1157 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698