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

Side by Side Diff: Source/core/rendering/RenderVideo.cpp

Issue 38313002: Remove <video> width and height attributes from intrisic size logic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: learn to indent Created 7 years, 2 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
« no previous file with comments | « LayoutTests/media/video-intrinsic-width-height-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 MediaPlayer* player = mediaElement()->player(); 100 MediaPlayer* player = mediaElement()->player();
101 if (player && video->readyState() >= HTMLVideoElement::HAVE_METADATA) { 101 if (player && video->readyState() >= HTMLVideoElement::HAVE_METADATA) {
102 LayoutSize size = player->naturalSize(); 102 LayoutSize size = player->naturalSize();
103 if (!size.isEmpty()) 103 if (!size.isEmpty())
104 return size; 104 return size;
105 } 105 }
106 106
107 if (video->shouldDisplayPosterImage() && !m_cachedImageSize.isEmpty() && !im ageResource()->errorOccurred()) 107 if (video->shouldDisplayPosterImage() && !m_cachedImageSize.isEmpty() && !im ageResource()->errorOccurred())
108 return m_cachedImageSize; 108 return m_cachedImageSize;
109 109
110 // When the natural size of the video is unavailable, we use the provided
111 // width and height attributes of the video element as the intrinsic size un til
112 // better values become available.
113 if (video->hasAttribute(widthAttr) && video->hasAttribute(heightAttr))
114 return LayoutSize(video->width(), video->height());
115
116 // <video> in standalone media documents should not use the default 300x150 110 // <video> in standalone media documents should not use the default 300x150
117 // size since they also have audio-only files. By setting the intrinsic 111 // size since they also have audio-only files. By setting the intrinsic
118 // size to 300x1 the video will resize itself in these cases, and audio will 112 // size to 300x1 the video will resize itself in these cases, and audio will
119 // have the correct height (it needs to be > 0 for controls to render proper ly). 113 // have the correct height (it needs to be > 0 for controls to render proper ly).
120 if (video->ownerDocument() && video->ownerDocument()->isMediaDocument()) 114 if (video->ownerDocument() && video->ownerDocument()->isMediaDocument())
121 return LayoutSize(defaultSize().width(), 1); 115 return LayoutSize(defaultSize().width(), 1);
122 116
123 return defaultSize(); 117 return defaultSize();
124 } 118 }
125 119
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 269 }
276 270
277 LayoutUnit RenderVideo::offsetHeight() const 271 LayoutUnit RenderVideo::offsetHeight() const
278 { 272 {
279 if (const RenderBlock* block = rendererPlaceholder(this)) 273 if (const RenderBlock* block = rendererPlaceholder(this))
280 return block->offsetHeight(); 274 return block->offsetHeight();
281 return RenderMedia::offsetHeight(); 275 return RenderMedia::offsetHeight();
282 } 276 }
283 277
284 } // namespace WebCore 278 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/media/video-intrinsic-width-height-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698