Fix for 3601920, CSS "tabs" not switching properly on zen garden design. Improve...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Sep 2004 22:09:52 +0000 (22:09 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Sep 2004 22:09:52 +0000 (22:09 +0000)
for layer changes of z-index that necessitate an invalidation.

        Reviewed by kocienda

        * khtml/rendering/render_object.cpp:
        (RenderObject::setStyle):
        * khtml/rendering/render_style.cpp:
        (RenderStyle::diff):
        * khtml/rendering/render_style.h:
        (khtml::RenderStyle::):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7675 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/render_object.cpp
WebCore/khtml/rendering/render_style.cpp
WebCore/khtml/rendering/render_style.h

index 70c33a3083e81a2a5134c3d720da651d92a5288c..8a2d4bcafa38bf75ce51c229d2f7d32f205df10a 100644 (file)
@@ -1,3 +1,17 @@
+2004-09-23  David Hyatt  <hyatt@apple.com>
+
+       Fix for 3601920, CSS "tabs" not switching properly on zen garden design.  Improve the repainting to account
+       for layer changes of z-index that necessitate an invalidation.
+       
+        Reviewed by kocienda
+
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::setStyle):
+        * khtml/rendering/render_style.cpp:
+        (RenderStyle::diff):
+        * khtml/rendering/render_style.h:
+        (khtml::RenderStyle::):
+
 2004-09-24  Chris Blumenberg  <cblu@apple.com>
 
        Made markup copying 5 times faster. Unfortunately, this still doesn't fix:
index 96037c4cbd38e917837a404148f095dd664d6e53..487ed2636860d623be540da09723d68b4a58d9c9 100644 (file)
@@ -1498,17 +1498,33 @@ void RenderObject::setStyle(RenderStyle *style)
 
         d = m_style->diff(style);
 
+        // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint.
+        if (d == RenderStyle::RepaintLayer && !layer())
+            d = RenderStyle::Repaint;
+        
         // The background of the root element or the body element could propagate up to
         // the canvas.  Just dirty the entire canvas when our style changes substantially.
-        if (d >= RenderStyle::Visible && element() &&
+        if (d >= RenderStyle::Repaint && element() &&
             (element()->id() == ID_HTML || element()->id() == ID_BODY))
             canvas()->repaint();
-        else if (m_parent && d == RenderStyle::Visible && !isText())
+        else if (m_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.
-            repaint();
+            if (d == RenderStyle::RepaintLayer)
+                layer()->repaintIncludingDescendants();
+            else if (d == RenderStyle::Repaint)
+                repaint();
+        }
 
-        if (m_style->position() != style->position() && layer())
+        // When a layout hint happens, we go ahead and do a repaint of the layer, since the layer could
+        // end up being destroyed.
+        if (d == RenderStyle::Layout && layer() &&
+            (m_style->position() != style->position() ||
+             m_style->zIndex() != style->zIndex() ||
+             m_style->hasAutoZIndex() != style->hasAutoZIndex() ||
+             !(m_style->clip() == style->clip()) ||
+             m_style->hasClip() != style->hasClip() ||
+             m_style->opacity() != style->opacity()))
             layer()->repaintIncludingDescendants();
 
         if (isFloating() && (m_style->floating() != style->floating()))
@@ -1561,9 +1577,11 @@ void RenderObject::setStyle(RenderStyle *style)
     
     // No need to ever schedule repaints from a style change of a text run, since
     // we already did this for the parent of the text run.
-    if (d >= RenderStyle::Position && m_parent)
+    if (d == RenderStyle::Layout && m_parent)
         setNeedsLayoutAndMinMaxRecalc();
-    else if (d == RenderStyle::Visible && !isText() && m_parent)
+    else if (m_parent && !isText() && (d == RenderStyle::RepaintLayer || d == RenderStyle::Repaint))
+        // Do a repaint with the new style now, e.g., for example if we go from
+        // not having an outline to having an outline.
         repaint();
 }
 
index 2aa8847ff5e149dccc527eedcf446e44381446cc..2904784e358d99bfa896a68a87733b8a6167cce6 100644 (file)
@@ -542,7 +542,13 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
 // inherited attributes
 //     DataRef<StyleInheritedData> inherited;
 
-    if ( *box.get() != *other->box.get() ||
+    if ( box->width != other->box->width ||
+         box->min_width != other->box->min_width ||
+         box->max_width != other->box->max_width ||
+         box->height != other->box->height ||
+         box->min_height != other->box->min_height ||
+         box->max_height != other->box->max_height ||
+         box->vertical_align != other->box->vertical_align ||
          !(surround->margin == other->surround->margin) ||
          !(surround->padding == other->surround->padding) ||
          css3NonInheritedData->marginTopCollapse != other->css3NonInheritedData->marginTopCollapse ||
@@ -569,7 +575,7 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
          visual->counter_increment != other->visual->counter_increment ||
          visual->counter_reset != other->visual->counter_reset ||
          css3NonInheritedData->textOverflow != other->css3NonInheritedData->textOverflow)
-        return CbLayout;
+        return Layout;
    
     // changes causing Layout changes:
 
@@ -588,7 +594,7 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
             !(inherited_flags._empty_cells == other->inherited_flags._empty_cells) ||
             !(inherited_flags._caption_side == other->inherited_flags._caption_side) ||
             !(noninherited_flags._table_layout == other->noninherited_flags._table_layout))
-        return CbLayout;
+        return Layout;
     }
 
 // only for lists:
@@ -630,18 +636,33 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
         borderRightWidth() != other->borderRightWidth())
         return Layout;
 
+#if APPLE_CHANGES
+    // If regions change trigger a relayout to re-calc regions.
+    if (!(css3NonInheritedData->m_dashboardRegions == other->css3NonInheritedData->m_dashboardRegions))
+        return Layout;
+#endif
+
     // Make sure these left/top/right/bottom checks stay below all layout checks and above
     // all visible checks.
-    if (other->position() != STATIC && !(surround->offset == other->surround->offset)) {
-     // FIXME: would like to do this at some point, but will need a new hint that indicates
-     // descendants need to be repainted too.
-     //   if (other->position() == RELATIVE)
-     //       return Visible;
-     //   else
-            return Layout;
+    if (other->position() != STATIC) {
+        if (!(surround->offset == other->surround->offset)) {
+            // FIXME: We will need to do a bit of work in RenderObject/Box::setStyle before we
+            // can stop doing a layout when relative positioned objects move.  In particular, we'll need
+            // to update scrolling positions and figure out how to do a repaint properly of the updated layer.
+            //if (other->position() == RELATIVE)
+            //    return RepaintLayer;
+            //else
+                return Layout;
+        }
+        else if (box->z_index != other->box->z_index || box->z_auto != other->box->z_auto ||
+                 !(visual->clip == other->visual->clip) || visual->hasClip != other->visual->hasClip)
+            return RepaintLayer;
     }
 
-    // Visible:
+    if (css3NonInheritedData->opacity != other->css3NonInheritedData->opacity)
+        return RepaintLayer;
+
+    // Repaint:
 //     EVisibility _visibility : 2;
 //     EOverflow _overflow : 4 ;
 //     EBackgroundRepeat _bg_repeat : 2;
@@ -657,23 +678,14 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
         !(inherited_flags._should_correct_text_color == other->inherited_flags._should_correct_text_color) ||
         !(surround->border == other->surround->border) ||
         *background.get() != *other->background.get() ||
-        !(visual->clip == other->visual->clip) ||
-        visual->hasClip != other->visual->hasClip ||
         visual->textDecoration != other->visual->textDecoration ||
-        css3NonInheritedData->opacity != other->css3NonInheritedData->opacity ||
         !css3InheritedData->shadowDataEquivalent(*other->css3InheritedData.get()) ||
         css3InheritedData->userModify != other->css3InheritedData->userModify ||
         css3NonInheritedData->userSelect != other->css3NonInheritedData->userSelect ||
         css3NonInheritedData->userDrag != other->css3NonInheritedData->userDrag ||
         !(visual->palette == other->visual->palette)
        )
-        return Visible;
-
-#if APPLE_CHANGES
-// If regions change trigger a relayout to re-calc regions.
-    if (!(css3NonInheritedData->m_dashboardRegions == other->css3NonInheritedData->m_dashboardRegions))
-        return Layout;
-#endif
+        return Repaint;
 
     return Equal;
 }
index 8b75a9ab2308f5ad680fdec23b520ce8a2e9e3a0..caf44f376218f95bfea2ae0f8ef8fe95661dfb49 100644 (file)
@@ -1040,6 +1040,7 @@ public:
     Length clipRight() const { return visual->clip.right; }
     Length clipTop() const { return visual->clip.top; }
     Length clipBottom() const { return visual->clip.bottom; }
+    LengthBox clip() const { return visual->clip; }
     bool hasClip() const { return visual->hasClip; }
     
     EUnicodeBidi unicodeBidi() const { return noninherited_flags._unicodeBidi; }
@@ -1360,7 +1361,12 @@ public:
 
     bool inheritedNotEqual( RenderStyle *other ) const;
 
-    enum Diff { Equal, NonVisible = Equal, Visible, Position, Layout, CbLayout };
+    // The difference between two styles.  The following values are used:
+    // (1) Equal - The two styles are identical
+    // (2) Repaint - The object just needs to be repainted.
+    // (3) RepaintLayer - The layer and its descendant layers needs to be repainted.
+    // (4) Layout - A layout is required.
+    enum Diff { Equal, Repaint, RepaintLayer, Layout };
     Diff diff( const RenderStyle *other ) const;
 
     bool isDisplayReplacedType() {