Title: [144508] trunk
- Revision
- 144508
- Author
- [email protected]
- Date
- 2013-03-01 14:42:02 -0800 (Fri, 01 Mar 2013)
Log Message
Support padding, margin and border for internal UA cue styling
https://bugs.webkit.org/show_bug.cgi?id=110703
Reviewed by Eric Carlson.
Source/WebCore:
For some particular user agent styling this allows the possibility
of making the window around the cue text bigger to match some user
styles (see CaptionUserPreferencesMac::captionsStyleSheetOverride).
These properties *cannot* be set through by using the ::cue
pseudo-element and, as specified, are used only internally.
Note: This patch is identical to the previously commited one,
as it was rolled back without related tests failing.
Test: media/track/track-cue-rendering-with-padding.html
* css/mediaControls.css:
(video::-webkit-media-text-track-display): Set the CSS box model
to include in the specified width or height the values of
padding / margin / border by using -webkit-box-sizing and avoid
overflow over 100% width because of having these properties set.
* rendering/RenderTextTrackCue.cpp:
(WebCore::RenderTextTrackCue::isOutside): To not interfere with
the regular WebVTT positioning algorithm, the check is done for
the absolute content box.
(WebCore::RenderTextTrackCue::repositionCueSnapToLinesSet): Added
an extra adjustment step to accomodate vertical padding (and not
overflow the cue container)
LayoutTests:
* media/track/track-cue-rendering-with-padding-expected.txt: Added.
* media/track/track-cue-rendering-with-padding.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (144507 => 144508)
--- trunk/LayoutTests/ChangeLog 2013-03-01 22:39:10 UTC (rev 144507)
+++ trunk/LayoutTests/ChangeLog 2013-03-01 22:42:02 UTC (rev 144508)
@@ -1,3 +1,13 @@
+2013-03-01 Victor Carbune <[email protected]>
+
+ Support padding, margin and border for internal UA cue styling
+ https://bugs.webkit.org/show_bug.cgi?id=110703
+
+ Reviewed by Eric Carlson.
+
+ * media/track/track-cue-rendering-with-padding-expected.txt: Added.
+ * media/track/track-cue-rendering-with-padding.html: Added.
+
2013-03-01 Chris Fleizach <[email protected]>
AX: Upstream iOS Accessibility layout tests
Added: trunk/LayoutTests/media/track/track-cue-rendering-with-padding-expected.txt (0 => 144508)
--- trunk/LayoutTests/media/track/track-cue-rendering-with-padding-expected.txt (rev 0)
+++ trunk/LayoutTests/media/track/track-cue-rendering-with-padding-expected.txt 2013-03-01 22:42:02 UTC (rev 144508)
@@ -0,0 +1,9 @@
+Rendering text track cue line with padding set.
+
+EVENT(canplaythrough)
+EVENT(seeked)
+
+** Cue should be displayed entirely within the container. **
+EXPECTED (cueDisplayBottomPoint <= cueContainerBottomPoint == 'true') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/track/track-cue-rendering-with-padding.html (0 => 144508)
--- trunk/LayoutTests/media/track/track-cue-rendering-with-padding.html (rev 0)
+++ trunk/LayoutTests/media/track/track-cue-rendering-with-padding.html 2013-03-01 22:42:02 UTC (rev 144508)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <style type="text/css">
+ video::-webkit-media-text-track-display {
+ padding: 15px;
+ }
+ </style>
+
+ <script src=""
+ <script src=""
+ <script src=""
+
+ <script>
+ var cueContainerBottomPoint;
+ var cueDisplayBottomPoint;
+
+ function startTest()
+ {
+ if (!window.internals) {
+ consoleWrite("<br><b>** This test only works in DRT! **<" + "/b>");
+ return;
+ }
+
+ var cueContainerElement = textTrackDisplayElement(video);
+ var cueDisplayElement = textTrackDisplayElement(video, 'display', 0);
+
+ cueDisplayBottomPoint = cueDisplayElement.offsetTop + cueDisplayElement.offsetHeight;
+ cueContainerBottomPoint = cueContainerElement.offsetTop + cueContainerElement.offsetHeight;
+
+ consoleWrite("<br>** Cue should be displayed entirely within the container. **");
+ testExpected("cueDisplayBottomPoint <= cueContainerBottomPoint", true);
+ endTest();
+ }
+
+ function loaded()
+ {
+ consoleWrite("Rendering text track cue line with padding set.<br>");
+ findMediaElement();
+
+ testTrack = document.querySelector('track');
+ video.src = "" '../content/test');
+
+ waitForEvent('seeked', startTest);
+ waitForEvent('canplaythrough', function() {
+ video.currentTime = .25;
+ });
+ }
+
+ </script>
+ </head>
+ <body _onload_="loaded()">
+ <video controls>
+ <track src="" kind="captions" default>
+ </video>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (144507 => 144508)
--- trunk/Source/WebCore/ChangeLog 2013-03-01 22:39:10 UTC (rev 144507)
+++ trunk/Source/WebCore/ChangeLog 2013-03-01 22:42:02 UTC (rev 144508)
@@ -1,3 +1,35 @@
+2013-03-01 Victor Carbune <[email protected]>
+
+ Support padding, margin and border for internal UA cue styling
+ https://bugs.webkit.org/show_bug.cgi?id=110703
+
+ Reviewed by Eric Carlson.
+
+ For some particular user agent styling this allows the possibility
+ of making the window around the cue text bigger to match some user
+ styles (see CaptionUserPreferencesMac::captionsStyleSheetOverride).
+
+ These properties *cannot* be set through by using the ::cue
+ pseudo-element and, as specified, are used only internally.
+
+ Note: This patch is identical to the previously commited one,
+ as it was rolled back without related tests failing.
+
+ Test: media/track/track-cue-rendering-with-padding.html
+
+ * css/mediaControls.css:
+ (video::-webkit-media-text-track-display): Set the CSS box model
+ to include in the specified width or height the values of
+ padding / margin / border by using -webkit-box-sizing and avoid
+ overflow over 100% width because of having these properties set.
+ * rendering/RenderTextTrackCue.cpp:
+ (WebCore::RenderTextTrackCue::isOutside): To not interfere with
+ the regular WebVTT positioning algorithm, the check is done for
+ the absolute content box.
+ (WebCore::RenderTextTrackCue::repositionCueSnapToLinesSet): Added
+ an extra adjustment step to accomodate vertical padding (and not
+ overflow the cue container)
+
2013-03-01 Andy Estes <[email protected]>
REGRESSION (r125809): CFStrings created via StringImpl::createCFString() might reference freed memory when Objective-C garbage collection is enabled
Modified: trunk/Source/WebCore/css/mediaControls.css (144507 => 144508)
--- trunk/Source/WebCore/css/mediaControls.css 2013-03-01 22:39:10 UTC (rev 144507)
+++ trunk/Source/WebCore/css/mediaControls.css 2013-03-01 22:42:02 UTC (rev 144508)
@@ -249,6 +249,7 @@
position: absolute;
overflow: hidden;
white-space: pre-wrap;
+ -webkit-box-sizing: border-box;
}
video::cue(:future) {
Modified: trunk/Source/WebCore/rendering/RenderTextTrackCue.cpp (144507 => 144508)
--- trunk/Source/WebCore/rendering/RenderTextTrackCue.cpp 2013-03-01 22:39:10 UTC (rev 144507)
+++ trunk/Source/WebCore/rendering/RenderTextTrackCue.cpp 2013-03-01 22:42:02 UTC (rev 144508)
@@ -123,7 +123,7 @@
bool RenderTextTrackCue::isOutside() const
{
- return !containingBlock()->absoluteBoundingBoxRect().contains(absoluteBoundingBoxRect());
+ return !containingBlock()->absoluteBoundingBoxRect().contains(absoluteContentBox());
}
bool RenderTextTrackCue::isOverlapping() const
@@ -225,6 +225,25 @@
// 19. Jump back to the step labeled step loop.
}
+
+ // Acommodate extra top and bottom padding, border or margin.
+ // Note: this is supported only for internal UA styling, not through the cue selector.
+ if (hasInlineDirectionBordersPaddingOrMargin()) {
+ IntRect containerRect = containingBlock()->absoluteBoundingBoxRect();
+ IntRect cueRect = absoluteBoundingBoxRect();
+
+ int topOverflow = cueRect.y() - containerRect.y();
+ int bottomOverflow = containerRect.y() + containerRect.height() - cueRect.y() - cueRect.height();
+
+ int adjustment = 0;
+ if (topOverflow < 0)
+ adjustment = -topOverflow;
+ else if (bottomOverflow < 0)
+ adjustment = bottomOverflow;
+
+ if (adjustment)
+ setY(y() + adjustment);
+ }
}
void RenderTextTrackCue::repositionGenericCue()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes