diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 9a7df784d0842456ee5151890ca2ba3017fd7efa..cc4815b006f83d16cd8d654e5555b41a4b4ffa9b 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,15 @@ +2006-06-07 Mitz Pettel + + Reviewed by Hyatt. + + - pixel test for http://bugzilla.opendarwin.org/show_bug.cgi?id=4334 + REGRESSION: Flickering when css-hover should change opacity on floating elements + + * fast/block/float/nopaint-after-layer-destruction-expected.checksum: Added. + * fast/block/float/nopaint-after-layer-destruction-expected.png: Added. + * fast/block/float/nopaint-after-layer-destruction-expected.txt: Added. + * fast/block/float/nopaint-after-layer-destruction.html: Added. + 2006-06-06 Mitz Pettel Reviewed by Hyatt. diff --git a/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.checksum b/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.checksum new file mode 100644 index 0000000000000000000000000000000000000000..a42291fcb602298260e961d914e8c941bf54a5bf --- /dev/null +++ b/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.checksum @@ -0,0 +1,2 @@ +aa772cd531e0c23cd2bf793e07a00add +\ No newline at end of file diff --git a/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.png b/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.png new file mode 100644 index 0000000000000000000000000000000000000000..1a39a8bdd777bc264cd6e8c95daaf1d39c023b2a Binary files /dev/null and b/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.png differ diff --git a/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.txt b/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..d35e17667e6810ca9ec329c71de051a3bf84587d --- /dev/null +++ b/LayoutTests/fast/block/float/nopaint-after-layer-destruction-expected.txt @@ -0,0 +1,23 @@ +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 784x584 + RenderBlock {P} at (0,0) size 784x36 + RenderText {#text} at (0,0) size 139x18 + text run at (0,0) width 139: "This is a pixel test for " + RenderInline {I} at (0,0) size 763x36 + RenderInline {A} at (0,0) size 348x18 [color=#0000EE] + RenderText {#text} at (139,0) size 348x18 + text run at (139,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=4334" + RenderText {#text} at (487,0) size 763x36 + text run at (487,0) width 4: " " + text run at (491,0) width 272: "REGRESSION: Flickering when css-hover" + text run at (0,18) width 273: "should change opacity on floating elements" + RenderText {#text} at (273,18) size 4x18 + text run at (273,18) width 4: "." + RenderBlock {P} at (0,52) size 784x18 + RenderText {#text} at (0,0) size 278x18 + text run at (0,0) width 278: "There should be a solid green square below." + RenderBlock {HR} at (0,86) size 784x2 [border: (1px inset #000000)] + RenderBlock (floating) {DIV} at (0,96) size 100x100 [bgcolor=#008000] diff --git a/LayoutTests/fast/block/float/nopaint-after-layer-destruction.html b/LayoutTests/fast/block/float/nopaint-after-layer-destruction.html new file mode 100644 index 0000000000000000000000000000000000000000..48736a1d0f70c5e403b13298382a276988344eea --- /dev/null +++ b/LayoutTests/fast/block/float/nopaint-after-layer-destruction.html @@ -0,0 +1,20 @@ + + + + + +

+ This is a pixel test for http://bugzilla.opendarwin.org/show_bug.cgi?id=4334 + REGRESSION: Flickering when css-hover should change opacity on floating elements. +

+

+ There should be a solid green square below. +

+
+
+ + + diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 47c4c9656ddbd7c1926e2ded38e958935b1a837a..588758d8ac9eb5781328d4c4d2141dbcfd40f3bc 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2006-06-07 Mitz Pettel + + Reviewed by Hyatt (concept) and Darin (some coding details). + + - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4334 + REGRESSION: Flickering when css-hover should change opacity on floating elements + + Pixel test: fast/block/float/nopaint-after-layer-destruction.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::setPaintsFloatingObject): Added. Changes the noPaint flag + in the block's FloatingObject for the given float and calls setChildNeedsLayout. + * rendering/RenderBlock.h: + * rendering/RenderBox.cpp: + (WebCore::blockThatPaintsFloat): Added this helper function. + (WebCore::RenderBox::setStyle): Added. Calls to setPaintsFloatingObject when a float + gains or loses its layer. + 2006-06-06 Mitz Pettel Reviewed by Hyatt. diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 77c63d3def4b96c71a07159bd8d863737f8d7e00..f4a0b444a17770a1a64402a26776d8af678a69af 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -1852,6 +1852,22 @@ void RenderBlock::removeFloatingObject(RenderObject *o) } } +void RenderBlock::setPaintsFloatingObject(RenderObject* o, bool b) +{ + if (!m_floatingObjects) + return; + + DeprecatedPtrListIterator it(*m_floatingObjects); + while (it.current()) { + if (it.current()->node == o) { + it.current()->noPaint = !b; + setChildNeedsLayout(true); + return; + } + ++it; + } +} + void RenderBlock::positionNewFloats() { if(!m_floatingObjects) return; diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h index a6fb8f36c60cfcd1e27228879f2cee9070a80113..1d19755a1692a856b73e043d4ae5a38fb4f05fa6 100644 --- a/WebCore/rendering/RenderBlock.h +++ b/WebCore/rendering/RenderBlock.h @@ -158,6 +158,7 @@ public: void insertFloatingObject(RenderObject *o); void removeFloatingObject(RenderObject *o); + void setPaintsFloatingObject(RenderObject*, bool); // called from lineWidth, to position the floats added in the last line. void positionNewFloats(); diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 94b9bc3bd57d265394a766de1709ad7f57eff056..b1280f441ba4b01db28d92e0f8b7f28bac712c47 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -69,8 +69,22 @@ RenderBox::RenderBox(WebCore::Node* node) m_inlineBoxWrapper = 0; } +static RenderBlock* blockThatPaintsFloat(RenderObject* f) +{ + RenderBlock* lastBlock = 0; + for (RenderObject* o = f->parent(); o; o = o->parent()) { + if (lastBlock && o->layer()) + break; + if (o->isRenderBlock()) + lastBlock = static_cast(o); + } + return lastBlock; +} + void RenderBox::setStyle(RenderStyle *_style) { + bool wasFloating = isFloating(); + RenderObject::setStyle(_style); // The root always paints its background/border. @@ -79,20 +93,19 @@ void RenderBox::setStyle(RenderStyle *_style) setInline(_style->isDisplayInlineType()); - switch(_style->position()) - { - case AbsolutePosition: - case FixedPosition: - setPositioned(true); - break; - default: - setPositioned(false); + switch (_style->position()) { + case AbsolutePosition: + case FixedPosition: + setPositioned(true); + break; + default: + setPositioned(false); - if (_style->isFloating()) - setFloating(true); + if (_style->isFloating()) + setFloating(true); - if (_style->position() == RelativePosition) - setRelPositioned(true); + if (_style->position() == RelativePosition) + setRelPositioned(true); } // We also handle and , whose overflow applies to the viewport. @@ -102,17 +115,24 @@ void RenderBox::setStyle(RenderStyle *_style) if (requiresLayer()) { if (!m_layer) { + if (wasFloating && isFloating()) { + if (RenderBlock* b = blockThatPaintsFloat(this)) + b->setPaintsFloatingObject(this, false); + } m_layer = new (renderArena()) RenderLayer(this); m_layer->insertOnlyThisLayer(); if (parent() && containingBlock()) m_layer->updateLayerPositions(); } - } - else if (m_layer && !isRoot() && !isRenderView()) { + } else if (m_layer && !isRoot() && !isRenderView()) { assert(m_layer->parent()); - RenderLayer *layer = m_layer; + RenderLayer* layer = m_layer; m_layer = 0; layer->removeOnlyThisLayer(); + if (wasFloating && isFloating()) { + if (RenderBlock* b = blockThatPaintsFloat(this)) + b->setPaintsFloatingObject(this, true); + } } if (m_layer)