Commit 49d70337 authored by hyatt@apple.com's avatar hyatt@apple.com

WebCore:

2009-05-13  David Hyatt  <hyatt@apple.com>

        Reviewed by Beth Dakin and Darin Adler.

        Fix for <rdar://problem/6869687> REGRESSION (r41203): Facebook friend suggestions disappear on update.
        
        Make sure that renderers are marked for layout if a style change causes them to switch from having a self-painting layer
        to a non-self-painting layer (and vice versa).
        
        Move misplaced layer repainting code that was in RenderBox up into RenderBoxModelObject so that inlines with layers
        repaint properly on opacity changes, etc.

        Added fast/repaint/opacity-change-on-overflow-float.html.

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::styleWillChange):
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::styleWillChange):
        (WebCore::RenderBoxModelObject::styleDidChange):
        * rendering/RenderBoxModelObject.h:

LayoutTests:

2009-05-13  David Hyatt  <hyatt@apple.com>

        Reviewed by Beth Dakin and Darin Adler.

        Add a repaint test for <rdar://problem/6869687> REGRESSION (r41203): Facebook friend suggestions disappear on update.

        * fast/repaint/opacity-change-on-overflow-float.html: Added.
        * platform/mac/fast/repaint/opacity-change-on-overflow-float-expected.checksum: Added.
        * platform/mac/fast/repaint/opacity-change-on-overflow-float-expected.png: Added.
        * platform/mac/fast/repaint/opacity-change-on-overflow-float-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43657 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c87c90e4
2009-05-13 David Hyatt <hyatt@apple.com>
Reviewed by Beth Dakin and Darin Adler.
Add a repaint test for <rdar://problem/6869687> REGRESSION (r41203): Facebook friend suggestions disappear on update.
* fast/repaint/opacity-change-on-overflow-float.html: Added.
* platform/mac/fast/repaint/opacity-change-on-overflow-float-expected.checksum: Added.
* platform/mac/fast/repaint/opacity-change-on-overflow-float-expected.png: Added.
* platform/mac/fast/repaint/opacity-change-on-overflow-float-expected.txt: Added.
2009-05-13 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Disable new tests. We are not going to be adding more new test
<html>
<head>
<style>
div {
width: 100px;
height:100px;
overflow:hidden;
float:left;
}
.green {
background-color:green
}
.red {
background-color:red
}
</style>
<script src="repaint.js" type="text/javascript"></script>
<script>
function repaintTest()
{
document.getElementsByClassName("green")[0].style.opacity = 1;
}
</script>
</head>
<body onload="runRepaintTest()">
<p>Repaint test for <rdar://problem/6869687> REGRESSION (r41203): Facebook friend suggestions disappear on update. Make sure when a layer switches
from being self-painting to non-self-painting that a layout happens to fix up the floating objects lists. You should see a 100x100 green square below.
If you see any red, the test has failed.
</p>
<div class="red">
<div class="green" style="opacity:0.5">
</div>
</div>
064c062f9aa68f1a93823d4ba2221cde
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x576
RenderBlock {P} at (0,0) size 784x54
RenderText {#text} at (0,0) size 100x18
text run at (0,0) width 100: "Repaint test for "
RenderInline {RDAR://PROBLEM/6869687} at (0,0) size 763x54
RenderText {#text} at (100,0) size 763x54
text run at (100,0) width 486: "REGRESSION (r41203): Facebook friend suggestions disappear on update. "
text run at (586,0) width 151: "Make sure when a layer"
text run at (0,18) width 689: "switches from being self-painting to non-self-painting that a layout happens to fix up the floating objects lists. "
text run at (689,18) width 74: "You should"
text run at (0,36) width 459: "see a 100x100 green square below. If you see any red, the test has failed."
layer at (8,78) size 100x100
RenderBlock (floating) {DIV} at (0,70) size 100x100 [bgcolor=#FF0000]
layer at (8,78) size 100x100
RenderBlock (floating) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
2009-05-13 David Hyatt <hyatt@apple.com>
Reviewed by Beth Dakin and Darin Adler.
Fix for <rdar://problem/6869687> REGRESSION (r41203): Facebook friend suggestions disappear on update.
Make sure that renderers are marked for layout if a style change causes them to switch from having a self-painting layer
to a non-self-painting layer (and vice versa).
Move misplaced layer repainting code that was in RenderBox up into RenderBoxModelObject so that inlines with layers
repaint properly on opacity changes, etc.
Added fast/repaint/opacity-change-on-overflow-float.html.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleWillChange):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::styleWillChange):
(WebCore::RenderBoxModelObject::styleDidChange):
* rendering/RenderBoxModelObject.h:
2009-05-13 Dimitri Glazkov <dglazkov@chromium.org>
Not reviewed, build fix.
......@@ -132,44 +132,15 @@ void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyl
if (diff >= StyleDifferenceRepaint && node() &&
(node()->hasTagName(htmlTag) || node()->hasTagName(bodyTag)))
view()->repaint();
else if (parent() && !isText()) {
// Do a repaint with the old style first, e.g., for example if we go from
// having an outline to not having an outline.
if (diff == StyleDifferenceRepaintLayer) {
layer()->repaintIncludingDescendants();
if (!(style()->clip() == newStyle->clip()))
layer()->clearClipRectsIncludingDescendants();
} else if (diff == StyleDifferenceRepaint || newStyle->outlineSize() < style()->outlineSize())
repaint();
}
if (diff == StyleDifferenceLayout) {
// When a layout hint happens, we go ahead and do a repaint of the layer, since the layer could
// end up being destroyed.
if (hasLayer()) {
if (style()->position() != newStyle->position() ||
style()->zIndex() != newStyle->zIndex() ||
style()->hasAutoZIndex() != newStyle->hasAutoZIndex() ||
!(style()->clip() == newStyle->clip()) ||
style()->hasClip() != newStyle->hasClip() ||
style()->opacity() != newStyle->opacity() ||
style()->transform() != newStyle->transform())
layer()->repaintIncludingDescendants();
} else if (newStyle->hasTransform() || newStyle->opacity() < 1) {
// If we don't have a layer yet, but we are going to get one because of transform or opacity,
// then we need to repaint the old position of the object.
repaint();
}
// When a layout hint happens and an object's position style changes, we have to do a layout
// to dirty the render tree using the old position value now.
if (parent() && style()->position() != newStyle->position()) {
markContainingBlocksForLayout();
if (style()->position() == StaticPosition)
repaint();
if (isFloating() && !isPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition))
removeFloatingOrPositionedChildFromBlockLists();
}
// When a layout hint happens and an object's position style changes, we have to do a layout
// to dirty the render tree using the old position value now.
if (diff == StyleDifferenceLayout && parent() && style()->position() != newStyle->position()) {
markContainingBlocksForLayout();
if (style()->position() == StaticPosition)
repaint();
if (isFloating() && !isPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition))
removeFloatingOrPositionedChildFromBlockLists();
}
}
......
......@@ -41,6 +41,8 @@ namespace WebCore {
using namespace HTMLNames;
bool RenderBoxModelObject::s_wasFloating = false;
bool RenderBoxModelObject::s_hadLayer = false;
bool RenderBoxModelObject::s_layerWasSelfPainting = false;
RenderBoxModelObject::RenderBoxModelObject(Node* node)
: RenderObject(node)
......@@ -81,10 +83,43 @@ bool RenderBoxModelObject::hasSelfPaintingLayer() const
void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
{
s_wasFloating = isFloating();
s_hadLayer = hasLayer();
if (s_hadLayer)
s_layerWasSelfPainting = layer()->isSelfPaintingLayer();
// If our z-index changes value or our visibility changes,
// we need to dirty our stacking context's z-order list.
if (style() && newStyle) {
if (parent()) {
// Do a repaint with the old style first, e.g., for example if we go from
// having an outline to not having an outline.
if (diff == StyleDifferenceRepaintLayer) {
layer()->repaintIncludingDescendants();
if (!(style()->clip() == newStyle->clip()))
layer()->clearClipRectsIncludingDescendants();
} else if (diff == StyleDifferenceRepaint || newStyle->outlineSize() < style()->outlineSize())
repaint();
}
if (diff == StyleDifferenceLayout) {
// When a layout hint happens, we go ahead and do a repaint of the layer, since the layer could
// end up being destroyed.
if (hasLayer()) {
if (style()->position() != newStyle->position() ||
style()->zIndex() != newStyle->zIndex() ||
style()->hasAutoZIndex() != newStyle->hasAutoZIndex() ||
!(style()->clip() == newStyle->clip()) ||
style()->hasClip() != newStyle->hasClip() ||
style()->opacity() != newStyle->opacity() ||
style()->transform() != newStyle->transform())
layer()->repaintIncludingDescendants();
} else if (newStyle->hasTransform() || newStyle->opacity() < 1) {
// If we don't have a layer yet, but we are going to get one because of transform or opacity,
// then we need to repaint the old position of the object.
repaint();
}
}
if (hasLayer() && (style()->hasAutoZIndex() != newStyle->hasAutoZIndex() ||
style()->zIndex() != newStyle->zIndex() ||
style()->visibility() != newStyle->visibility())) {
......@@ -120,8 +155,11 @@ void RenderBoxModelObject::styleDidChange(StyleDifference diff, const RenderStyl
setChildNeedsLayout(true);
}
if (m_layer)
m_layer->styleChanged(diff, oldStyle);
if (layer()) {
layer()->styleChanged(diff, oldStyle);
if (s_hadLayer && layer()->isSelfPaintingLayer() != s_layerWasSelfPainting)
setChildNeedsLayout(true);
}
}
void RenderBoxModelObject::updateBoxModelInfoFromStyle()
......
......@@ -111,6 +111,8 @@ private:
// Used to store state between styleWillChange and styleDidChange
static bool s_wasFloating;
static bool s_hadLayer;
static bool s_layerWasSelfPainting;
};
inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* o)
......
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