Changeset 144443 in webkit


Ignore:
Timestamp:
Mar 1, 2013 4:32:43 AM (11 years ago)
Author:
vcarbune@chromium.org
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.

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.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r144442 r144443  
     12013-03-01  Victor Carbune  <vcarbune@chromium.org>
     2
     3        Support padding, margin and border for internal UA cue styling
     4        https://bugs.webkit.org/show_bug.cgi?id=110703
     5
     6        Reviewed by Eric Carlson.
     7
     8        * media/track/track-cue-rendering-with-padding-expected.txt: Added.
     9        * media/track/track-cue-rendering-with-padding.html: Added.
     10
    1112013-03-01  Takashi Toyoshima  <toyoshim@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r144439 r144443  
     12013-03-01  Victor Carbune  <vcarbune@chromium.org>
     2
     3        Support padding, margin and border for internal UA cue styling
     4        https://bugs.webkit.org/show_bug.cgi?id=110703
     5
     6        Reviewed by Eric Carlson.
     7
     8        For some particular user agent styling this allows the possibility
     9        of making the window around the cue text bigger to match some user
     10        styles (see CaptionUserPreferencesMac::captionsStyleSheetOverride).
     11
     12        These properties *cannot* be set through by using the ::cue
     13        pseudo-element and, as specified, are used only internally.
     14
     15        Test: media/track/track-cue-rendering-with-padding.html
     16
     17        * css/mediaControls.css:
     18        (video::-webkit-media-text-track-display): Set the CSS box model
     19        to include in the specified width or height the values of
     20        padding / margin / border by using -webkit-box-sizing and avoid
     21        overflow over 100% width because of having these properties set.
     22        * rendering/RenderTextTrackCue.cpp:
     23        (WebCore::RenderTextTrackCue::isOutside): To not interfere with
     24        the regular WebVTT positioning algorithm, the check is done for
     25        the absolute content box.
     26        (WebCore::RenderTextTrackCue::repositionCueSnapToLinesSet): Added
     27        an extra adjustment step to accomodate vertical padding (and not
     28        overflow the cue container)
     29
    1302013-02-26  Eugene Klyuchnikov  <eustas@chromium.org>
    231
  • trunk/Source/WebCore/css/mediaControls.css

    r142947 r144443  
    250250    overflow: hidden;
    251251    white-space: pre-wrap;
     252    -webkit-box-sizing: border-box;
    252253}
    253254
  • trunk/Source/WebCore/rendering/RenderTextTrackCue.cpp

    r141966 r144443  
    124124bool RenderTextTrackCue::isOutside() const
    125125{
    126     return !containingBlock()->absoluteBoundingBoxRect().contains(absoluteBoundingBoxRect());
     126    return !containingBlock()->absoluteBoundingBoxRect().contains(absoluteContentBox());
    127127}
    128128
     
    226226        // 19. Jump back to the step labeled step loop.
    227227    }
     228
     229    // Acommodate extra top and bottom padding, border or margin.
     230    // Note: this is supported only for internal UA styling, not through the cue selector.
     231    if (hasInlineDirectionBordersPaddingOrMargin()) {
     232        IntRect containerRect = containingBlock()->absoluteBoundingBoxRect();
     233        IntRect cueRect = absoluteBoundingBoxRect();
     234
     235        int topOverflow = cueRect.y() - containerRect.y();
     236        int bottomOverflow = containerRect.y() + containerRect.height() - cueRect.y() - cueRect.height();
     237
     238        int adjustment = 0;
     239        if (topOverflow < 0)
     240            adjustment = -topOverflow;
     241        else if (bottomOverflow < 0)
     242            adjustment = bottomOverflow;
     243
     244        if (adjustment)
     245            setY(y() + adjustment);
     246    }
    228247}
    229248
Note: See TracChangeset for help on using the changeset viewer.