[webkit-changes] cvs commit: WebCore/khtml/css cssstyleselector.cpp

David hyatt at opensource.apple.com
Thu Oct 27 02:30:41 PDT 2005


hyatt       05/10/27 02:30:40

  Modified:    .        ChangeLog
               khtml/css cssstyleselector.cpp
  Log:
  	Fix form controls so that they can take advantage of
  	the style sharing optimization.  Special-case the "type"
  	attribute to accomplish this.
  
  	Also add checks for missing pseudo-classes that the sharing
  	code now needs to check once form controls start sharing
  	style.  These include enabled, checked and indeterminate.
  
  	Finally, :target should have been checked all along and was
  	broken by the original style sharing landing.  Add it to the list
  	of things checked as well.
  
  	It's impossible to write a :target test.  Other areas more than
  	covered by existing test cases.
  
          Reviewed by mjs
  
          * khtml/css/cssstyleselector.cpp:
          (khtml::CSSStyleSelector::canShareStyleWithElement):
          (khtml::CSSStyleSelector::checkOneSelector):
  
  Revision  Changes    Path
  1.301     +23 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.300
  retrieving revision 1.301
  diff -u -r1.300 -r1.301
  --- ChangeLog	27 Oct 2005 09:00:29 -0000	1.300
  +++ ChangeLog	27 Oct 2005 09:30:32 -0000	1.301
  @@ -1,5 +1,28 @@
   2005-10-27  David Hyatt  <hyatt at apple.com>
   
  +	Fix form controls so that they can take advantage of
  +	the style sharing optimization.  Special-case the "type"
  +	attribute to accomplish this.
  +
  +	Also add checks for missing pseudo-classes that the sharing
  +	code now needs to check once form controls start sharing
  +	style.  These include enabled, checked and indeterminate.
  +
  +	Finally, :target should have been checked all along and was
  +	broken by the original style sharing landing.  Add it to the list
  +	of things checked as well.
  +
  +	It's impossible to write a :target test.  Other areas more than
  +	covered by existing test cases.
  +	
  +        Reviewed by mjs
  +
  +        * khtml/css/cssstyleselector.cpp:
  +        (khtml::CSSStyleSelector::canShareStyleWithElement):
  +        (khtml::CSSStyleSelector::checkOneSelector):
  +
  +2005-10-27  David Hyatt  <hyatt at apple.com>
  +
   	Fix for bug 5517, percentage height relative block inside a percentage height absolute
   	block did not stretch properly to fill the absolute block.
   
  
  
  
  1.217     +8 -3      WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.216
  retrieving revision 1.217
  diff -u -r1.216 -r1.217
  --- cssstyleselector.cpp	26 Oct 2005 22:13:29 -0000	1.216
  +++ cssstyleselector.cpp	27 Oct 2005 09:30:38 -0000	1.217
  @@ -643,7 +643,12 @@
               !s->renderer()->style()->affectedByAttributeSelectors() &&
               (s->hovered() == element->hovered()) &&
               (s->active() == element->active()) &&
  -            (s->focused() == element->focused())) {
  +            (s->focused() == element->focused()) &&
  +            (s->isEnabled() == element->isEnabled()) &&
  +            (s->isIndeterminate() == element->isIndeterminate()) &&
  +            (s->isChecked() == element->isChecked()) &&
  +            (s != s->getDocument()->getCSSTarget() && element != element->getDocument()->getCSSTarget()) &&
  +            (s->getAttribute(typeAttr) == element->getAttribute(typeAttr))) {
               bool classesMatch = true;
               if (s->hasClass()) {
                   const AtomicString& class1 = element->getAttribute(classAttr);
  @@ -1159,8 +1164,8 @@
           }
           else if (sel->match == CSSSelector::Id)
               return e->hasID() && e->getIDAttribute() == sel->value;
  -        else if (style && (e != element || !styledElement || !styledElement->isMappedAttribute(sel->attr)))
  -            style->setAffectedByAttributeSelectors();
  +        else if (style && (e != element || !styledElement || (!styledElement->isMappedAttribute(sel->attr) && sel->attr != typeAttr)))
  +            style->setAffectedByAttributeSelectors(); // Special-case the "type" attribute so input form controls can share style.
   
           const AtomicString& value = e->getAttribute(sel->attr);
           if (value.isNull()) return false; // attribute is not set
  
  
  



More information about the webkit-changes mailing list