2009-06-12 Simon Fraser <simon.fraser@apple.com>

        Reviewed by Dan Bernstein

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

        Fix crash when a renderer for an anonymous node is composited
        by null-checking renderer()->node().

        Test: compositing/generated-content.html

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::createGraphicsLayer):
        (WebCore::RenderLayerBacking::rendererHasBackground):
        (WebCore::RenderLayerBacking::rendererBackgroundColor):
        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
        (WebCore::RenderLayerBacking::paintIntoLayer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 282482eb
2009-06-12 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dan Bernstein
https://bugs.webkit.org/show_bug.cgi?id=26095
Testcase for creating accelerated compositing layers for anonymous content.
* compositing/generated-content.html: Added.
* platform/mac/compositing/generated-content-expected.txt: Added.
2009-06-12 Gustavo Noronha Silva <gns@gnome.org>
Reviewed by Jan Alonzo.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>Generated Content and Transforms</title>
<style type="text/css" media="screen">
.box {
width: 200px;
height: 200px;
border: 1px solid black;
}
.box:after {
content: 'Generated';
display: block;
width: 100%;
height: 100%;
-webkit-transform: translate3d(0, 0, 0);
}
</style>
</head>
<body>
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=26095">https://bugs.webkit.org/show_bug.cgi?id=26095</a></p>
<p>Tests that a 3D transform on a generated node does not crash.</p>
<div class="box"></div>
</body>
</html>
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x294
RenderBlock {HTML} at (0,0) size 800x294
RenderBody {BODY} at (8,16) size 784x270
RenderBlock {P} at (0,0) size 784x18
RenderInline {A} at (0,0) size 305x18 [color=#0000EE]
RenderText {#text} at (0,0) size 305x18
text run at (0,0) width 305: "https://bugs.webkit.org/show_bug.cgi?id=26095"
RenderBlock {P} at (0,34) size 784x18
RenderText {#text} at (0,0) size 388x18
text run at (0,0) width 388: "Tests that a 3D transform on a generated node does not crash."
RenderBlock {DIV} at (0,68) size 202x202 [border: (1px solid #000000)]
layer at (9,85) size 200x200
RenderBlock (generated) at (1,1) size 200x200
RenderText at (0,0) size 65x18
text run at (0,0) width 65: "Generated"
......@@ -7,6 +7,24 @@
* platform/image-decoders/skia/ImageDecoder.h:
(WebCore::RGBA32Buffer::copyRowNTimes): Fix typo that broke Skia GIF decoding.
2009-06-12 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dan Bernstein
https://bugs.webkit.org/show_bug.cgi?id=26095
Fix crash when a renderer for an anonymous node is composited
by null-checking renderer()->node().
Test: compositing/generated-content.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createGraphicsLayer):
(WebCore::RenderLayerBacking::rendererHasBackground):
(WebCore::RenderLayerBacking::rendererBackgroundColor):
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
(WebCore::RenderLayerBacking::paintIntoLayer):
2009-06-12 Simon Fraser <simon.fraser@apple.com>
Fix build when ACCELERATED_COMPOSITING is defined.
......@@ -75,14 +75,17 @@ void RenderLayerBacking::createGraphicsLayer()
m_graphicsLayer = GraphicsLayer::createGraphicsLayer(this);
#ifndef NDEBUG
if (renderer()->node()->isDocumentNode())
m_graphicsLayer->setName("Document Node");
else {
if (renderer()->node()->isHTMLElement() && renderer()->node()->hasID())
m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->id());
else
m_graphicsLayer->setName(renderer()->renderName());
}
if (renderer()->node()) {
if (renderer()->node()->isDocumentNode())
m_graphicsLayer->setName("Document Node");
else {
if (renderer()->node()->isHTMLElement() && renderer()->node()->hasID())
m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->id());
else
m_graphicsLayer->setName(renderer()->renderName());
}
} else
m_graphicsLayer->setName("Anonymous Node");
#endif // NDEBUG
updateLayerOpacity();
......@@ -410,7 +413,7 @@ static bool hasBoxDecorationsWithBackgroundImage(const RenderStyle* style)
bool RenderLayerBacking::rendererHasBackground() const
{
// FIXME: share more code here
if (renderer()->node()->isDocumentNode()) {
if (renderer()->node() && renderer()->node()->isDocumentNode()) {
RenderObject* htmlObject = renderer()->firstChild();
if (!htmlObject)
return false;
......@@ -433,7 +436,7 @@ bool RenderLayerBacking::rendererHasBackground() const
const Color& RenderLayerBacking::rendererBackgroundColor() const
{
// FIXME: share more code here
if (renderer()->node()->isDocumentNode()) {
if (renderer()->node() && renderer()->node()->isDocumentNode()) {
RenderObject* htmlObject = renderer()->firstChild();
RenderStyle* style = htmlObject->style();
if (style->hasBackground())
......@@ -469,7 +472,7 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
if (!renderObject->firstChild())
return true;
if (renderObject->node()->isDocumentNode()) {
if (renderObject->node() && renderObject->node()->isDocumentNode()) {
// Look to see if the root object has a non-simple backgound
RenderObject* rootObject = renderObject->document()->documentElement()->renderer();
if (!rootObject)
......@@ -753,7 +756,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
IntRect paintBox = clipRectToApply;
// FIXME: do we need this code?
if (renderer()->node()->isDocumentNode() && renderer()->document()->isHTMLDocument()) {
if (renderer()->node() && renderer()->node()->isDocumentNode() && renderer()->document()->isHTMLDocument()) {
RenderBox* box = toRenderBox(renderer());
int w = box->width();
int h = box->height();
......
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