Changeset 45612 in webkit
- Timestamp:
- Jul 7, 2009, 4:45:45 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r45611 r45612 1 2009-07-07 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt and Darin Adler. 4 5 - test for https://bugs.webkit.org/show_bug.cgi?id=26963 6 <rdar://problem/7030998> Reproducible crash at 7 FontCache::getFontData() when a custom font is used in a pseudo-style 8 9 * fast/css/pseudo-cache-stale.html: Added. 10 * platform/mac/fast/css/pseudo-cache-stale-expected.checksum: Added. 11 * platform/mac/fast/css/pseudo-cache-stale-expected.png: Added. 12 * platform/mac/fast/css/pseudo-cache-stale-expected.txt: Added. 13 1 14 2009-07-07 Dirk Pranke <dpranke@chromium.org> 2 15 -
trunk/WebCore/ChangeLog
r45608 r45612 1 2009-07-07 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt and Darin Adler. 4 5 - fix https://bugs.webkit.org/show_bug.cgi?id=26963 6 <rdar://problem/7030998> Reproducible crash at 7 FontCache::getFontData() when a custom font is used in a pseudo-style 8 9 Test: fast/css/pseudo-cache-stale.html 10 11 * dom/Element.cpp: 12 (WebCore::Element::pseudoStyleCacheIsInvalid): Added. Given the old 13 style and the new style, goes over cached pseudo-styles in the old 14 style and re-resolves the same style types off the new style. If any of 15 the new pseudo-styles is different from the currently cached 16 corresponding style, returns true. Otherwise, returns false. 17 (WebCore::Element::recalcStyle): Validate the pseudo-style cache before 18 deciding to keep the existing style. 19 * dom/Element.h: 20 * rendering/RenderObject.cpp: 21 (WebCore::RenderObject::uncachedFirstLineStyle): Added this version that 22 returns an uncached first-line style based off the given style. 23 (WebCore::RenderObject::getUncachedPseudoStyle): Added the 'ownStyle' 24 parameter. 25 * rendering/RenderObject.h: 26 * rendering/style/RenderStyle.cpp: 27 (WebCore::RenderStyle::getPseudoStyleCache): Added. Returns the cached 28 pseudo-styles in the passed-in vector. 29 * rendering/style/RenderStyle.h: 30 1 31 2009-07-07 Dan Bernstein <mitz@apple.com> 2 32 -
trunk/WebCore/dom/Element.cpp
r44966 r45612 762 762 } 763 763 764 bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle) 765 { 766 ASSERT(currentStyle = renderStyle()); 767 768 if (!renderer() || !currentStyle) 769 return false; 770 771 RenderStyle::PseudoStyleCache pseudoStyleCache; 772 currentStyle->getPseudoStyleCache(pseudoStyleCache); 773 size_t cacheSize = pseudoStyleCache.size(); 774 for (size_t i = 0; i < cacheSize; ++i) { 775 RefPtr<RenderStyle> newPseudoStyle; 776 PseudoId pseudoId = pseudoStyleCache[i]->styleType(); 777 if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) 778 newPseudoStyle = renderer()->uncachedFirstLineStyle(newStyle); 779 else 780 newPseudoStyle = renderer()->getUncachedPseudoStyle(pseudoId, newStyle, newStyle); 781 782 if (*newPseudoStyle != *pseudoStyleCache[i]) { 783 if (pseudoId < FIRST_INTERNAL_PSEUDOID) 784 newStyle->setHasPseudoStyle(pseudoId); 785 newStyle->addCachedPseudoStyle(newPseudoStyle); 786 return true; 787 } 788 } 789 return false; 790 } 791 764 792 void Element::recalcStyle(StyleChange change) 765 793 { … … 812 840 } 813 841 814 if (ch != NoChange ) {842 if (ch != NoChange || pseudoStyleCacheIsInvalid(currentStyle, newStyle.get())) { 815 843 setRenderStyle(newStyle); 816 844 } else if (needsStyleRecalc() && (styleChangeType() != AnimationStyleChange) && (document()->usesSiblingRules() || document()->usesDescendantRules())) { -
trunk/WebCore/dom/Element.h
r44966 r45612 171 171 #endif 172 172 173 bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle); 174 173 175 String innerText() const; 174 176 String outerText() const; -
trunk/WebCore/rendering/RenderObject.cpp
r45245 r45612 1981 1981 } 1982 1982 1983 PassRefPtr<RenderStyle> RenderObject::uncachedFirstLineStyle(RenderStyle* style) const 1984 { 1985 if (!document()->usesFirstLineRules()) 1986 return 0; 1987 1988 ASSERT(!isText()); 1989 1990 RefPtr<RenderStyle> result; 1991 1992 if (isBlockFlow()) { 1993 if (RenderBlock* firstLineBlock = this->firstLineBlock()) 1994 result = firstLineBlock->getUncachedPseudoStyle(FIRST_LINE, style, firstLineBlock == this ? style : 0); 1995 } else if (!isAnonymous() && isRenderInline()) { 1996 RenderStyle* parentStyle = parent()->firstLineStyle(); 1997 if (parentStyle != parent()->style()) 1998 result = getUncachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle, style); 1999 } 2000 2001 return result.release(); 2002 } 2003 1983 2004 RenderStyle* RenderObject::firstLineStyleSlowCase() const 1984 2005 { … … 2017 2038 } 2018 2039 2019 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(PseudoId pseudo, RenderStyle* parentStyle ) const2020 { 2021 if (pseudo < FIRST_INTERNAL_PSEUDOID && ! style()->hasPseudoStyle(pseudo))2040 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(PseudoId pseudo, RenderStyle* parentStyle, RenderStyle* ownStyle) const 2041 { 2042 if (pseudo < FIRST_INTERNAL_PSEUDOID && !ownStyle && !style()->hasPseudoStyle(pseudo)) 2022 2043 return 0; 2023 2044 2024 if (!parentStyle) 2045 if (!parentStyle) { 2046 ASSERT(!ownStyle); 2025 2047 parentStyle = style(); 2048 } 2026 2049 2027 2050 Node* n = node(); -
trunk/WebCore/rendering/RenderObject.h
r45199 r45612 383 383 // any pseudo classes (and therefore has no concept of changing state). 384 384 RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const; 385 PassRefPtr<RenderStyle> getUncachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0 ) const;385 PassRefPtr<RenderStyle> getUncachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const; 386 386 387 387 virtual void updateDragState(bool dragOn); … … 554 554 RenderStyle* firstLineStyle() const { return document()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); } 555 555 RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); } 556 556 557 // Used only by Element::pseudoStyleCacheIsInvalid to get a first line style based off of a 558 // given new style, without accessing the cache. 559 PassRefPtr<RenderStyle> uncachedFirstLineStyle(RenderStyle*) const; 560 557 561 // Anonymous blocks that are part of of a continuation chain will return their inline continuation's outline style instead. 558 562 // This is typically only relevant when repainting. -
trunk/WebCore/rendering/style/RenderStyle.cpp
r44671 r45612 224 224 m_cachedPseudoStyle = pseudo; 225 225 return m_cachedPseudoStyle.get(); 226 } 227 228 void RenderStyle::getPseudoStyleCache(PseudoStyleCache& cache) const 229 { 230 ASSERT(cache.isEmpty()); 231 for (RenderStyle* pseudoStyle = m_cachedPseudoStyle.get(); pseudoStyle; pseudoStyle = pseudoStyle->m_cachedPseudoStyle.get()) 232 cache.append(pseudoStyle); 226 233 } 227 234 -
trunk/WebCore/rendering/style/RenderStyle.h
r44673 r45612 307 307 RenderStyle* getCachedPseudoStyle(PseudoId) const; 308 308 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>); 309 310 typedef Vector<RenderStyle*, 10> PseudoStyleCache; 311 void getPseudoStyleCache(PseudoStyleCache&) const; 309 312 310 313 bool affectedByHoverRules() const { return noninherited_flags._affectedByHover; }
Note:
See TracChangeset
for help on using the changeset viewer.