[webkit-changes] cvs commit: WebCore/khtml/rendering render_button.cpp

David hyatt at opensource.apple.com
Sat Oct 29 22:26:27 PDT 2005


hyatt       05/10/29 22:26:27

  Modified:    .        ChangeLog
               khtml/css cssstyleselector.cpp cssstyleselector.h
               khtml/rendering render_button.cpp
  Log:
          Fix the performance regression caused by doing too much copying of background/border values.  This patch attempts to rectify things by doing the following:
  
  	(1) Don't initialize the border/background cached values on every single style resolution.
  	(2) Only cache the border/background values just after user agent styles have been resolved if the user agent set an appearance.
  	(3) Only check for appearance disabling if you had a UA appearance originally (and then continue to have an appearance after author/user styles have been resolved too)
  	(4) Make sure to patch the pseudoStyleForElement method too.  With the removal of the initialization code for the values running over and over again, I needed to make sure to patch this function to match styleForElement.
  
  	Reviewed by sullivan
  
          * khtml/css/cssstyleselector.cpp:
          (khtml::CSSStyleSelector::initForStyleResolve):
          (khtml::CSSStyleSelector::styleForElement):
          (khtml::CSSStyleSelector::pseudoStyleForElement):
          (khtml::CSSStyleSelector::adjustRenderStyle):
          * khtml/css/cssstyleselector.h:
  
  Revision  Changes    Path
  1.315     +17 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.314
  retrieving revision 1.315
  diff -u -r1.314 -r1.315
  --- ChangeLog	28 Oct 2005 17:35:39 -0000	1.314
  +++ ChangeLog	30 Oct 2005 05:26:22 -0000	1.315
  @@ -1,3 +1,20 @@
  +2005-10-29  David Hyatt  <hyatt at apple.com>
  +        Fix the performance regression caused by doing too much copying of background/border values.  This patch attempts to rectify things by doing the following:
  +
  +	(1) Don't initialize the border/background cached values on every single style resolution.
  +	(2) Only cache the border/background values just after user agent styles have been resolved if the user agent set an appearance.
  +	(3) Only check for appearance disabling if you had a UA appearance originally (and then continue to have an appearance after author/user styles have been resolved too)
  +	(4) Make sure to patch the pseudoStyleForElement method too.  With the removal of the initialization code for the values running over and over again, I needed to make sure to patch this function to match styleForElement.
  +        
  +	Reviewed by sullivan
  +
  +        * khtml/css/cssstyleselector.cpp:
  +        (khtml::CSSStyleSelector::initForStyleResolve):
  +        (khtml::CSSStyleSelector::styleForElement):
  +        (khtml::CSSStyleSelector::pseudoStyleForElement):
  +        (khtml::CSSStyleSelector::adjustRenderStyle):
  +        * khtml/css/cssstyleselector.h:
  +
   2005-10-28  Beth Dakin  <bdakin at apple.com>
   
           Reviewed by John
  
  
  
  1.219     +20 -12    WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.218
  retrieving revision 1.219
  diff -u -r1.218 -r1.219
  --- cssstyleselector.cpp	28 Oct 2005 07:03:25 -0000	1.218
  +++ cssstyleselector.cpp	30 Oct 2005 05:26:25 -0000	1.219
  @@ -522,11 +522,6 @@
       m_tmpRuleCount = 0;
       
       fontDirty = false;
  -    
  -    // Clear out our cached border/background data.
  -    m_borderData = BorderData();
  -    m_backgroundData = BackgroundLayer();
  -    m_backgroundColor = QColor();
   }
   
   // modified version of the one in kurl.cpp
  @@ -823,10 +818,13 @@
       applyDeclarations(false, false, firstUARule, lastUARule);
       
       // Cache our border and background so that we can examine them later.
  -    m_borderData = style->border();
  -    m_backgroundData = *style->backgroundLayers();
  -    m_backgroundColor = style->backgroundColor();
  -
  +    m_hasUAAppearance = style->hasAppearance();
  +    if (m_hasUAAppearance) {
  +        m_borderData = style->border();
  +        m_backgroundData = *style->backgroundLayers();
  +        m_backgroundColor = style->backgroundColor();
  +    }
  +    
       // Now do the author and user normal priority properties and all the !important properties.
       applyDeclarations(false, false, lastUARule+1, m_matchedDeclCount-1);
       applyDeclarations(false, true, firstAuthorRule, lastAuthorRule);
  @@ -897,7 +895,17 @@
       }
       
       // Now do the normal priority properties.
  -    applyDeclarations(false, false, 0, m_matchedDeclCount-1);
  +    applyDeclarations(false, false, firstUARule, lastUARule);
  +    
  +    // Cache our border and background so that we can examine them later.
  +    m_hasUAAppearance = style->hasAppearance();
  +    if (m_hasUAAppearance) {
  +        m_borderData = style->border();
  +        m_backgroundData = *style->backgroundLayers();
  +        m_backgroundColor = style->backgroundColor();
  +    }
  +    
  +    applyDeclarations(false, false, lastUARule+1, m_matchedDeclCount-1);
       applyDeclarations(false, true, firstAuthorRule, lastAuthorRule);
       applyDeclarations(false, true, firstUserRule, lastUserRule);
       applyDeclarations(false, true, firstUARule, lastUARule);
  @@ -1012,9 +1020,9 @@
       // Cull out any useless layers and also repeat patterns into additional layers.
       style->adjustBackgroundLayers();
   
  -    // Let the theme get a crack at changing the style if an appearance has been set.
  +    // Let the theme also have a crack at adjusting the style.
       if (style->hasAppearance()) {
  -        if (theme()->isControlStyled(style, m_borderData, m_backgroundData, m_backgroundColor))
  +        if (m_hasUAAppearance && theme()->isControlStyled(style, m_borderData, m_backgroundData, m_backgroundColor))
               style->setAppearance(NoAppearance);
           else
               theme()->adjustStyle(this, style, e);
  
  
  
  1.42      +1 -0      WebCore/khtml/css/cssstyleselector.h
  
  Index: cssstyleselector.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.h,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- cssstyleselector.h	28 Oct 2005 07:03:25 -0000	1.41
  +++ cssstyleselector.h	30 Oct 2005 05:26:26 -0000	1.42
  @@ -176,6 +176,7 @@
           CSSRuleSet* m_userStyle;
           DOM::CSSStyleSheetImpl* m_userSheet;
           
  +        bool m_hasUAAppearance;
           BorderData m_borderData;
           BackgroundLayer m_backgroundData;
           QColor m_backgroundColor;
  
  
  
  1.6       +1 -0      WebCore/khtml/rendering/render_button.cpp
  
  Index: render_button.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_button.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- render_button.cpp	26 Oct 2005 06:08:03 -0000	1.5
  +++ render_button.cpp	30 Oct 2005 05:26:26 -0000	1.6
  @@ -70,6 +70,7 @@
           m_buttonText->setStyle(style);
       if (m_inner)
           m_inner->style()->setBoxFlex(1.0f);
  +    setReplaced(isInline());
   }
   
   void RenderButton::updateFromElement()
  
  
  



More information about the webkit-changes mailing list