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

David hyatt at opensource.apple.com
Tue Jul 19 16:44:08 PDT 2005


hyatt       05/07/19 16:44:08

  Modified:    .        ChangeLog
               khtml/html htmltokenizer.cpp
               khtml/xml dom_elementimpl.h dom_atomicstring.h
               khtml/rendering render_block.cpp
  Log:
  	Fix performance regressions from attribute QName landing.
  
          Reviewed by mjs
  
          * khtml/html/htmltokenizer.cpp:
          (khtml::Token::addAttribute):
          (khtml::HTMLTokenizer::write):
  
  	Make sure attributes have a faster constructor that can avoid the copy of QualifiedNames.
  
  	Make sure to grab the part from the document outside the loop, so that it is not fetched
  	over and over again for every character in the source.
  
          * khtml/rendering/render_block.cpp:
          (khtml::RenderBlock::paintObject):
  
  	Only call paintCaret if the block is actually editable.
  
          * khtml/xml/dom_atomicstring.h:
          (DOM::operator!=):
          * khtml/xml/dom_elementimpl.h:
          (DOM::AttributeImpl::AttributeImpl):
          (DOM::AttributeImpl::~AttributeImpl):
          (DOM::MappedAttributeImpl::MappedAttributeImpl):
  
  	Add != comparison operator with a char* to speed up the / check for attribute invalidity.
  
  Revision  Changes    Path
  1.4444    +29 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4443
  retrieving revision 1.4444
  diff -u -r1.4443 -r1.4444
  --- ChangeLog	19 Jul 2005 22:41:42 -0000	1.4443
  +++ ChangeLog	19 Jul 2005 23:44:03 -0000	1.4444
  @@ -1,3 +1,32 @@
  +2005-07-19  David Hyatt  <hyatt at apple.com>
  +
  +	Fix performance regressions from attribute QName landing.
  +	
  +        Reviewed by mjs
  +
  +        * khtml/html/htmltokenizer.cpp:
  +        (khtml::Token::addAttribute):
  +        (khtml::HTMLTokenizer::write):
  +
  +	Make sure attributes have a faster constructor that can avoid the copy of QualifiedNames.
  +
  +	Make sure to grab the part from the document outside the loop, so that it is not fetched
  +	over and over again for every character in the source.
  +	
  +        * khtml/rendering/render_block.cpp:
  +        (khtml::RenderBlock::paintObject):
  +
  +	Only call paintCaret if the block is actually editable.
  +	
  +        * khtml/xml/dom_atomicstring.h:
  +        (DOM::operator!=):
  +        * khtml/xml/dom_elementimpl.h:
  +        (DOM::AttributeImpl::AttributeImpl):
  +        (DOM::AttributeImpl::~AttributeImpl):
  +        (DOM::MappedAttributeImpl::MappedAttributeImpl):
  +
  +	Add != comparison operator with a char* to speed up the / check for attribute invalidity.
  +	
   2005-07-19  Vicki Murley  <vicki at apple.com>
   
           Reviewed by Maciej.
  
  
  
  1.100     +5 -6      WebCore/khtml/html/htmltokenizer.cpp
  
  Index: htmltokenizer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.cpp,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- htmltokenizer.cpp	18 Jul 2005 21:52:27 -0000	1.99
  +++ htmltokenizer.cpp	19 Jul 2005 23:44:07 -0000	1.100
  @@ -237,11 +237,9 @@
   void Token::addAttribute(DocumentImpl* doc, const AtomicString& attrName, const AtomicString& v)
   {
       AttributeImpl* a = 0;
  -    if (!attrName.isEmpty() && attrName.string() != "/")
  -        a = new MappedAttributeImpl(QualifiedName(nullAtom, attrName, nullAtom), v);
  -
  -    if (a) {
  -        if(!attrs) {
  +    if (!attrName.isEmpty() && attrName != "/") {
  +        a = new MappedAttributeImpl(attrName, v);
  +        if (!attrs) {
               attrs = new NamedMappedAttrMapImpl(0);
               attrs->ref();
           }
  @@ -1556,7 +1554,8 @@
       startTime.start();
       KWQUIEventTime eventTime;
   
  -    while (!src.isEmpty() && (!parser->doc()->part() || !parser->doc()->part()->isScheduledLocationChangePending())) {
  +    KHTMLPart* part = parser->doc()->part();
  +    while (!src.isEmpty() && (!part || !part->isScheduledLocationChangePending())) {
           if (!continueProcessing(processedCount, startTime, eventTime))
               break;
   
  
  
  
  1.48      +14 -2     WebCore/khtml/xml/dom_elementimpl.h
  
  Index: dom_elementimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.h,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- dom_elementimpl.h	19 Jul 2005 22:41:47 -0000	1.47
  +++ dom_elementimpl.h	19 Jul 2005 23:44:07 -0000	1.48
  @@ -67,8 +67,13 @@
       // null value is forbidden !
       AttributeImpl(const QualifiedName& name, const AtomicString& value)
           : m_name(name), m_value(value), m_impl(0)
  -        { };
  -    virtual ~AttributeImpl() {};
  +    {}
  +    
  +    AttributeImpl(const AtomicString& name, const AtomicString& value)
  +        : m_name(nullAtom, name, nullAtom), m_value(value), m_impl(0)
  +    {}
  +
  +    virtual ~AttributeImpl() {}
       
       MAIN_THREAD_ALLOCATED;
   
  @@ -356,6 +361,13 @@
               decl->ref();
       }
   
  +    MappedAttributeImpl(const AtomicString& name, const AtomicString& value, CSSMappedAttributeDeclarationImpl* decl = 0)
  +    : AttributeImpl(name, value), m_styleDecl(decl)
  +    {
  +        if (decl)
  +            decl->ref();
  +    }
  +
       ~MappedAttributeImpl();
   
       virtual AttributeImpl* clone(bool preserveDecl=true) const;
  
  
  
  1.6       +4 -0      WebCore/khtml/xml/dom_atomicstring.h
  
  Index: dom_atomicstring.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_atomicstring.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- dom_atomicstring.h	9 Jul 2005 20:19:21 -0000	1.5
  +++ dom_atomicstring.h	19 Jul 2005 23:44:07 -0000	1.6
  @@ -63,6 +63,7 @@
       friend bool operator!=(const AtomicString &, const AtomicString &);
       
       friend bool operator==(const AtomicString &, const char *);
  +    friend bool operator!=(const AtomicString &, const char *);
       
       static void remove(DOMStringImpl *);
       
  @@ -107,6 +108,9 @@
   inline bool operator==(const AtomicString &a, const char *b)
   { return AtomicString::equal(a, b); }
   
  +inline bool operator!=(const AtomicString &a, const char *b)
  +{ return !AtomicString::equal(a, b); }
  +
   // List of property names, passed to a macro so we can do set them up various
   // ways without repeating the list.
   
  
  
  
  1.189     +1 -1      WebCore/khtml/rendering/render_block.cpp
  
  Index: render_block.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
  retrieving revision 1.188
  retrieving revision 1.189
  diff -u -r1.188 -r1.189
  --- render_block.cpp	18 Jul 2005 21:52:31 -0000	1.188
  +++ render_block.cpp	19 Jul 2005 23:44:07 -0000	1.189
  @@ -1322,7 +1322,7 @@
       // 6. paint caret.
       // If the caret's node's render object's containing block is this block, and the paint action is PaintActionForeground,
       // then paint the caret.
  -    if (!inlineFlow && paintAction == PaintActionForeground) {        
  +    if (!inlineFlow && paintAction == PaintActionForeground && element() && element()->isContentEditable()) {        
           paintCaret(i, CursorCaret);
           paintCaret(i, DragCaret);
       }
  
  
  



More information about the webkit-changes mailing list