Skip to content

Commit 025a0be

Browse files
author
David Hyatt
committed
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::): Canonical link: https://commits.webkit.org/6701@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent c0671ac commit 025a0be

4 files changed

Lines changed: 78 additions & 28 deletions

File tree

WebCore/ChangeLog-2005-08-23

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2004-09-23 David Hyatt <hyatt@apple.com>
2+
3+
Fix for 3601920, CSS "tabs" not switching properly on zen garden design. Improve the repainting to account
4+
for layer changes of z-index that necessitate an invalidation.
5+
6+
Reviewed by kocienda
7+
8+
* khtml/rendering/render_object.cpp:
9+
(RenderObject::setStyle):
10+
* khtml/rendering/render_style.cpp:
11+
(RenderStyle::diff):
12+
* khtml/rendering/render_style.h:
13+
(khtml::RenderStyle::):
14+
115
2004-09-24 Chris Blumenberg <cblu@apple.com>
216

317
Made markup copying 5 times faster. Unfortunately, this still doesn't fix:

WebCore/khtml/rendering/render_object.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,17 +1498,33 @@ void RenderObject::setStyle(RenderStyle *style)
14981498

14991499
d = m_style->diff(style);
15001500

1501+
// If we have no layer(), just treat a RepaintLayer hint as a normal Repaint.
1502+
if (d == RenderStyle::RepaintLayer && !layer())
1503+
d = RenderStyle::Repaint;
1504+
15011505
// The background of the root element or the body element could propagate up to
15021506
// the canvas. Just dirty the entire canvas when our style changes substantially.
1503-
if (d >= RenderStyle::Visible && element() &&
1507+
if (d >= RenderStyle::Repaint && element() &&
15041508
(element()->id() == ID_HTML || element()->id() == ID_BODY))
15051509
canvas()->repaint();
1506-
else if (m_parent && d == RenderStyle::Visible && !isText())
1510+
else if (m_parent && !isText()) {
15071511
// Do a repaint with the old style first, e.g., for example if we go from
15081512
// having an outline to not having an outline.
1509-
repaint();
1513+
if (d == RenderStyle::RepaintLayer)
1514+
layer()->repaintIncludingDescendants();
1515+
else if (d == RenderStyle::Repaint)
1516+
repaint();
1517+
}
15101518

1511-
if (m_style->position() != style->position() && layer())
1519+
// When a layout hint happens, we go ahead and do a repaint of the layer, since the layer could
1520+
// end up being destroyed.
1521+
if (d == RenderStyle::Layout && layer() &&
1522+
(m_style->position() != style->position() ||
1523+
m_style->zIndex() != style->zIndex() ||
1524+
m_style->hasAutoZIndex() != style->hasAutoZIndex() ||
1525+
!(m_style->clip() == style->clip()) ||
1526+
m_style->hasClip() != style->hasClip() ||
1527+
m_style->opacity() != style->opacity()))
15121528
layer()->repaintIncludingDescendants();
15131529

15141530
if (isFloating() && (m_style->floating() != style->floating()))
@@ -1561,9 +1577,11 @@ void RenderObject::setStyle(RenderStyle *style)
15611577

15621578
// No need to ever schedule repaints from a style change of a text run, since
15631579
// we already did this for the parent of the text run.
1564-
if (d >= RenderStyle::Position && m_parent)
1580+
if (d == RenderStyle::Layout && m_parent)
15651581
setNeedsLayoutAndMinMaxRecalc();
1566-
else if (d == RenderStyle::Visible && !isText() && m_parent)
1582+
else if (m_parent && !isText() && (d == RenderStyle::RepaintLayer || d == RenderStyle::Repaint))
1583+
// Do a repaint with the new style now, e.g., for example if we go from
1584+
// not having an outline to having an outline.
15671585
repaint();
15681586
}
15691587

WebCore/khtml/rendering/render_style.cpp

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,13 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
542542
// inherited attributes
543543
// DataRef<StyleInheritedData> inherited;
544544

545-
if ( *box.get() != *other->box.get() ||
545+
if ( box->width != other->box->width ||
546+
box->min_width != other->box->min_width ||
547+
box->max_width != other->box->max_width ||
548+
box->height != other->box->height ||
549+
box->min_height != other->box->min_height ||
550+
box->max_height != other->box->max_height ||
551+
box->vertical_align != other->box->vertical_align ||
546552
!(surround->margin == other->surround->margin) ||
547553
!(surround->padding == other->surround->padding) ||
548554
css3NonInheritedData->marginTopCollapse != other->css3NonInheritedData->marginTopCollapse ||
@@ -569,7 +575,7 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
569575
visual->counter_increment != other->visual->counter_increment ||
570576
visual->counter_reset != other->visual->counter_reset ||
571577
css3NonInheritedData->textOverflow != other->css3NonInheritedData->textOverflow)
572-
return CbLayout;
578+
return Layout;
573579

574580
// changes causing Layout changes:
575581

@@ -588,7 +594,7 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
588594
!(inherited_flags._empty_cells == other->inherited_flags._empty_cells) ||
589595
!(inherited_flags._caption_side == other->inherited_flags._caption_side) ||
590596
!(noninherited_flags._table_layout == other->noninherited_flags._table_layout))
591-
return CbLayout;
597+
return Layout;
592598
}
593599

594600
// only for lists:
@@ -630,18 +636,33 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
630636
borderRightWidth() != other->borderRightWidth())
631637
return Layout;
632638

639+
#if APPLE_CHANGES
640+
// If regions change trigger a relayout to re-calc regions.
641+
if (!(css3NonInheritedData->m_dashboardRegions == other->css3NonInheritedData->m_dashboardRegions))
642+
return Layout;
643+
#endif
644+
633645
// Make sure these left/top/right/bottom checks stay below all layout checks and above
634646
// all visible checks.
635-
if (other->position() != STATIC && !(surround->offset == other->surround->offset)) {
636-
// FIXME: would like to do this at some point, but will need a new hint that indicates
637-
// descendants need to be repainted too.
638-
// if (other->position() == RELATIVE)
639-
// return Visible;
640-
// else
641-
return Layout;
647+
if (other->position() != STATIC) {
648+
if (!(surround->offset == other->surround->offset)) {
649+
// FIXME: We will need to do a bit of work in RenderObject/Box::setStyle before we
650+
// can stop doing a layout when relative positioned objects move. In particular, we'll need
651+
// to update scrolling positions and figure out how to do a repaint properly of the updated layer.
652+
//if (other->position() == RELATIVE)
653+
// return RepaintLayer;
654+
//else
655+
return Layout;
656+
}
657+
else if (box->z_index != other->box->z_index || box->z_auto != other->box->z_auto ||
658+
!(visual->clip == other->visual->clip) || visual->hasClip != other->visual->hasClip)
659+
return RepaintLayer;
642660
}
643661

644-
// Visible:
662+
if (css3NonInheritedData->opacity != other->css3NonInheritedData->opacity)
663+
return RepaintLayer;
664+
665+
// Repaint:
645666
// EVisibility _visibility : 2;
646667
// EOverflow _overflow : 4 ;
647668
// EBackgroundRepeat _bg_repeat : 2;
@@ -657,23 +678,14 @@ RenderStyle::Diff RenderStyle::diff( const RenderStyle *other ) const
657678
!(inherited_flags._should_correct_text_color == other->inherited_flags._should_correct_text_color) ||
658679
!(surround->border == other->surround->border) ||
659680
*background.get() != *other->background.get() ||
660-
!(visual->clip == other->visual->clip) ||
661-
visual->hasClip != other->visual->hasClip ||
662681
visual->textDecoration != other->visual->textDecoration ||
663-
css3NonInheritedData->opacity != other->css3NonInheritedData->opacity ||
664682
!css3InheritedData->shadowDataEquivalent(*other->css3InheritedData.get()) ||
665683
css3InheritedData->userModify != other->css3InheritedData->userModify ||
666684
css3NonInheritedData->userSelect != other->css3NonInheritedData->userSelect ||
667685
css3NonInheritedData->userDrag != other->css3NonInheritedData->userDrag ||
668686
!(visual->palette == other->visual->palette)
669687
)
670-
return Visible;
671-
672-
#if APPLE_CHANGES
673-
// If regions change trigger a relayout to re-calc regions.
674-
if (!(css3NonInheritedData->m_dashboardRegions == other->css3NonInheritedData->m_dashboardRegions))
675-
return Layout;
676-
#endif
688+
return Repaint;
677689

678690
return Equal;
679691
}

WebCore/khtml/rendering/render_style.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,7 @@ class RenderStyle
10401040
Length clipRight() const { return visual->clip.right; }
10411041
Length clipTop() const { return visual->clip.top; }
10421042
Length clipBottom() const { return visual->clip.bottom; }
1043+
LengthBox clip() const { return visual->clip; }
10431044
bool hasClip() const { return visual->hasClip; }
10441045

10451046
EUnicodeBidi unicodeBidi() const { return noninherited_flags._unicodeBidi; }
@@ -1360,7 +1361,12 @@ class RenderStyle
13601361

13611362
bool inheritedNotEqual( RenderStyle *other ) const;
13621363

1363-
enum Diff { Equal, NonVisible = Equal, Visible, Position, Layout, CbLayout };
1364+
// The difference between two styles. The following values are used:
1365+
// (1) Equal - The two styles are identical
1366+
// (2) Repaint - The object just needs to be repainted.
1367+
// (3) RepaintLayer - The layer and its descendant layers needs to be repainted.
1368+
// (4) Layout - A layout is required.
1369+
enum Diff { Equal, Repaint, RepaintLayer, Layout };
13641370
Diff diff( const RenderStyle *other ) const;
13651371

13661372
bool isDisplayReplacedType() {

0 commit comments

Comments
 (0)