[iOS] Captions are clipped in documents using pagination

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

Reviewed by Beth Dakin.

MediaControlTextTrackContainerElement::createTextTrackRepresentationImage() is called
to paint captions into a layer used for fullscreen video. It did the painting using
a subtree paint, but starting at the root RenderView's layer. This is problematic,
because the caption painting is subject to clipping for columns, and any enclosing
overflow:hidden container.

Fix this by starting the paint at the MediaControlTextTrackContainerElement's
renderer's layer. By doing this we don't have to worry about an offset, so no
translation is required.

Also make sure we update layer before grabbing the renderer (in case layout
destroys it).

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f322964e
2013-07-24 Simon Fraser <simon.fraser@apple.com>
[iOS] Captions are clipped in documents using pagination
https://bugs.webkit.org/show_bug.cgi?id=119072
Reviewed by Beth Dakin.
MediaControlTextTrackContainerElement::createTextTrackRepresentationImage() is called
to paint captions into a layer used for fullscreen video. It did the painting using
a subtree paint, but starting at the root RenderView's layer. This is problematic,
because the caption painting is subject to clipping for columns, and any enclosing
overflow:hidden container.
Fix this by starting the paint at the MediaControlTextTrackContainerElement's
renderer's layer. By doing this we don't have to worry about an offset, so no
translation is required.
Also make sure we update layer before grabbing the renderer (in case layout
destroys it).
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
2013-07-24 Simon Fraser <simon.fraser@apple.com>
REGRESSION (r152335): Mac Pro title occluded in MobileSafari; can't scroll page
......@@ -1397,34 +1397,31 @@ PassRefPtr<Image> MediaControlTextTrackContainerElement::createTextTrackRepresen
if (!hasChildNodes())
return 0;
RenderObject* renderer = this->renderer();
if (!renderer)
return 0;
Frame* frame = document()->frame();
if (!frame)
return 0;
document()->updateLayout();
LayoutRect topLevelRect;
IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
RenderObject* renderer = this->renderer();
if (!renderer)
return 0;
if (!renderer->hasLayer())
return 0;
RenderLayer* layer = toRenderLayerModelObject(renderer)->layer();
float deviceScaleFactor = 1;
if (Page* page = document()->page())
deviceScaleFactor = page->deviceScaleFactor();
IntRect paintingRect = IntRect(IntPoint(), layer->size());
OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB));
if (!buffer)
return 0;
// Translate the renderer painting rect into graphics context coordinates.
FloatSize translation(-paintingRect.x(), -paintingRect.y());
buffer->context()->translate(translation);
RenderLayer* layer = frame->contentRenderer()->layer();
layer->paint(buffer->context(), paintingRect, PaintBehaviorFlattenCompositingLayers, renderer, 0, RenderLayer::PaintLayerPaintingCompositingAllPhases);
layer->paint(buffer->context(), paintingRect, PaintBehaviorFlattenCompositingLayers, 0, 0, RenderLayer::PaintLayerPaintingCompositingAllPhases);
return buffer->copyImage();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment