[Webkit-unassigned] [Bug 73444] CSS background of <video> is ignored when poster is set

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 26 06:50:44 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=73444


Deepak Sherveghar <bpwv64 at motorola.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bpwv64 at motorola.com




--- Comment #1 from Deepak Sherveghar <bpwv64 at motorola.com>  2012-04-26 06:50:44 PST ---
Sample test case with poster image: (css background not painted)
----------------------------------------------------------------
<video height="200" width="480" controls="" style="background:#F00;" preload="none" poster="poster.jpg">
<source type="video/ogg" src="movie.ogg"></source>
</video>

Sample test case without poster image: (css background painted)
-------------------------------------------------------------------
<video height="200" width="480" controls="" style="background:#F00;" preload="none">
<source type="video/ogg" src="movie.ogg"></source>
</video>

As of https://bugs.webkit.org/show_bug.cgi?id=65030, we no longer paint backgrounds if they are fully obscured by an object's foreground.

while painting background's in RenderBox::paintBackground(), we check if background is obscured before painting it. 
eg: if (!backgroundIsObscured())
        paintFillLayers(...);

#0  WebCore::RenderImage::backgroundIsObscured () at Source/WebCore/rendering/RenderImage.cpp:433
#1  WebCore::RenderBox::paintBackground () at Source/WebCore/rendering/RenderBox.cpp:1021
#2  WebCore::RenderBox::paintBoxDecorations (...) at Source/WebCore/rendering/RenderBox.cpp:1004
#3  WebCore::RenderBlock::paintObject (...) at Source/WebCore/rendering/RenderBlock.cpp:2870
#4  WebCore::RenderBlock::paint () at Source/WebCore/rendering/RenderBlock.cpp:2640
#5  WebCore::RenderLayer::paintLayerContents () at Source/WebCore/rendering/RenderLayer.cpp:2901  

When a poster is not set, htmlvideoelement's renderer doesnt set the image resource (since there is no poster). When backgroundIsObscured() is called, it returns
false since no image resource is set.
ie:  if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())
        return false;
and hence the css background is painted.

When a poster is set, htmlvideoelement's renderer does set the image resource during attach

ie: void HTMLVideoElement::attach()
    { ....
        if (renderer())
             toRenderImage(renderer())->imageResource()->setCachedImage(m_imageLoader->image()); 
      ....
    }

#0  WebCore::RenderImageResource::setCachedImage () at Source/WebCore/rendering/RenderImageResource.cpp:64
#1  WebCore::HTMLVideoElement::attach () at Source/WebCore/html/HTMLVideoElement.cpp:85
#2  WebCore::executeTask () at Source/WebCore/html/parser/HTMLConstructionSite.cpp:101
#3  WebCore::HTMLConstructionSite::executeQueuedTasks () at Source/WebCore/html/parser/HTMLConstructionSite.cpp:140

Now since the image resource is set, no condition is satisfied and backgroundIsObscured() returns true.
and hence the css background is not painted.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list