Changeset 20980 in webkit


Ignore:
Timestamp:
Apr 20, 2007 5:24:43 PM (17 years ago)
Author:
hyatt
Message:

Bug 13424, firstLineStyle and verticalPositionHint together take
33% of the time on the new tag nesting PLT. Don't waste time even
looking for first-line styles if no stylesheet used them.

Reviewed by beth

  • css/CSSGrammar.y:
  • dom/Document.cpp: (WebCore::Document::Document):
  • dom/Document.h: (WebCore::Document::usesFirstLineRules): (WebCore::Document::setUsesFirstLineRules):
  • rendering/RenderObject.cpp: (WebCore::RenderObject::verticalPositionHint): (WebCore::RenderObject::firstLineStyle):
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r20975 r20980  
     12007-04-20  David Hyatt  <hyatt@apple.com>
     2
     3        Bug 13424, firstLineStyle and verticalPositionHint together take
     4        33% of the time on the new tag nesting PLT.  Don't waste time even
     5        looking for first-line styles if no stylesheet used them.
     6
     7        Reviewed by beth
     8
     9        * css/CSSGrammar.y:
     10        * dom/Document.cpp:
     11        (WebCore::Document::Document):
     12        * dom/Document.h:
     13        (WebCore::Document::usesFirstLineRules):
     14        (WebCore::Document::setUsesFirstLineRules):
     15        * rendering/RenderObject.cpp:
     16        (WebCore::RenderObject::verticalPositionHint):
     17        (WebCore::RenderObject::firstLineStyle):
     18
    1192007-04-20  Peter Kasting  <pkasting@google.com>
    220
  • trunk/WebCore/css/CSSGrammar.y

    r20496 r20980  
    852852            if (doc)
    853853                doc->setUsesSiblingRules(true);
     854        } else if (type == CSSSelector::PseudoFirstLine) {
     855            CSSParser* p = static_cast<CSSParser*>(parser);
     856            if (Document* doc = p->document())
     857                doc->setUsesFirstLineRules(true);
    854858        }
    855859    }
     
    859863        $3.lower();
    860864        $$->m_value = atomicString($3);
    861         if ($$->pseudoType() == CSSSelector::PseudoUnknown)
     865        CSSSelector::PseudoType type = $$->pseudoType();
     866        if (type == CSSSelector::PseudoUnknown)
    862867            $$ = 0;
     868        else if (type == CSSSelector::PseudoFirstLine) {
     869            CSSParser* p = static_cast<CSSParser*>(parser);
     870            if (Document* doc = p->document())
     871                doc->setUsesFirstLineRules(true);
     872        }
    863873    }
    864874    // used by :lang
  • trunk/WebCore/dom/Document.cpp

    r20950 r20980  
    326326    m_usesDescendantRules = false;
    327327    m_usesSiblingRules = false;
     328    m_usesFirstLineRules = false;
    328329
    329330    m_styleSelector = new CSSStyleSelector(this, m_usersheet, m_styleSheets.get(), !inCompatMode());
  • trunk/WebCore/dom/Document.h

    r20802 r20980  
    281281    bool usesSiblingRules() const { return m_usesSiblingRules; }
    282282    void setUsesSiblingRules(bool b) { m_usesSiblingRules = b; }
     283    bool usesFirstLineRules() const { return m_usesFirstLineRules; }
     284    void setUsesFirstLineRules(bool b) { m_usesFirstLineRules = b; }
    283285
    284286    // Machinery for saving and restoring state when you leave and then go back to a page.
     
    704706    bool m_usesDescendantRules;
    705707    bool m_usesSiblingRules;
    706    
     708    bool m_usesFirstLineRules;
     709
    707710    String m_title;
    708711    bool m_titleSetExplicitly;
  • trunk/WebCore/rendering/RenderObject.cpp

    r20794 r20980  
    26142614short RenderObject::verticalPositionHint(bool firstLine) const
    26152615{
     2616    if (firstLine) // We're only really a first-line style if the document actually uses first-line rules.
     2617        firstLine = document()->usesFirstLineRules();
    26162618    short vpos = m_verticalPosition;
    26172619    if (m_verticalPosition == PositionUndefined || firstLine) {
     
    27782780RenderStyle* RenderObject::firstLineStyle() const
    27792781{
     2782    if (!document()->usesFirstLineRules())
     2783        return m_style;
     2784
    27802785    RenderStyle* s = m_style;
    27812786    const RenderObject* obj = isText() ? parent() : this;
Note: See TracChangeset for help on using the changeset viewer.