Changeset 54048 in webkit


Ignore:
Timestamp:
Jan 28, 2010 11:42:05 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-28 Nicholas Young <nicholas.young@nokia.com>

Reviewed by Eric Carlson.

Prefer provided video element width/height properties to hard coded
defaults for intrinsic size when natural video size is unavailable.
https://bugs.webkit.org/show_bug.cgi?id=34302

No new tests needed.

  • rendering/RenderVideo.cpp: Attempt to use width/height properties (WebCore::RenderVideo::RenderVideo):
  • rendering/RenderVideo.h: More appropriate constructor signature
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54047 r54048  
     12010-01-28  Nicholas Young  <nicholas.young@nokia.com>
     2
     3        Reviewed by Eric Carlson.
     4
     5        Prefer provided video element width/height properties to hard coded
     6        defaults for intrinsic size when natural video size is unavailable.
     7        https://bugs.webkit.org/show_bug.cgi?id=34302
     8
     9        No new tests needed.
     10
     11        * rendering/RenderVideo.cpp: Attempt to use width/height properties
     12        (WebCore::RenderVideo::RenderVideo):
     13        * rendering/RenderVideo.h: More appropriate constructor signature
     14
    1152010-01-28  Oliver Hunt  <oliver@apple.com>
    216
  • trunk/WebCore/rendering/RenderVideo.cpp

    r53146 r54048  
    5151static const int cDefaultHeight = 150;
    5252
    53 RenderVideo::RenderVideo(HTMLMediaElement* video)
     53RenderVideo::RenderVideo(HTMLVideoElement* video)
    5454    : RenderMedia(video)
    5555{
     
    5757        setIntrinsicSize(video->player()->naturalSize());
    5858    else {
    59         // Video in standalone media documents should not use the default 300x150
    60         // size since they also have audio thrown at them. By setting the intrinsic
    61         // size to 300x1 the video will resize itself in these cases, and audio will
    62         // have the correct height (it needs to be > 0 for controls to render properly).
    63         if (video->ownerDocument() && video->ownerDocument()->isMediaDocument())
     59        // When the natural size of the video is unavailable, we use the provided
     60        // width and height attributes of the video element as the intrinsic size until
     61        // better values become available. If these attributes are not set, we fall back
     62        // to a default video size (300x150).
     63        if (video->hasAttribute(widthAttr) && video->hasAttribute(heightAttr))
     64            setIntrinsicSize(IntSize(video->width(), video->height()));
     65        else if (video->ownerDocument() && video->ownerDocument()->isMediaDocument()) {
     66            // Video in standalone media documents should not use the default 300x150
     67            // size since they also have audio thrown at them. By setting the intrinsic
     68            // size to 300x1 the video will resize itself in these cases, and audio will
     69            // have the correct height (it needs to be > 0 for controls to render properly).
    6470            setIntrinsicSize(IntSize(cDefaultWidth, 1));
     71        }
    6572        else
    6673            setIntrinsicSize(IntSize(cDefaultWidth, cDefaultHeight));
  • trunk/WebCore/rendering/RenderVideo.h

    r53146 r54048  
    4141class RenderVideo : public RenderMedia {
    4242public:
    43     RenderVideo(HTMLMediaElement*);
     43    RenderVideo(HTMLVideoElement*);
    4444    virtual ~RenderVideo();
    4545
Note: See TracChangeset for help on using the changeset viewer.