Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2729373003: Bit-mask incorrectly removed first-line pseudo bit. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 } 1801 }
1802 1802
1803 if (context.clearInvalidation) 1803 if (context.clearInvalidation)
1804 document().styleEngine().styleInvalidator().clearInvalidation(*this); 1804 document().styleEngine().styleInvalidator().clearInvalidation(*this);
1805 1805
1806 setNeedsResizeObserverUpdate(); 1806 setNeedsResizeObserverUpdate();
1807 1807
1808 DCHECK(needsAttach()); 1808 DCHECK(needsAttach());
1809 } 1809 }
1810 1810
1811 bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, 1811 void Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle,
1812 ComputedStyle* newStyle) { 1812 ComputedStyle* newStyle) {
1813 // TODO(rune@opera.com): This method does not take into account pseudo style
1814 // which is only present for the newStyle. Also the first-line part should
1815 // probably be moved to where we handle visual invalidation diff for setStyle.
1816 // setHasPseudoStyle() calls are probably unnecessary.
1813 DCHECK_EQ(currentStyle, computedStyle()); 1817 DCHECK_EQ(currentStyle, computedStyle());
1814 DCHECK(layoutObject()); 1818 DCHECK(layoutObject());
1815 1819
1816 if (!currentStyle) 1820 if (!currentStyle)
1817 return false; 1821 return;
1818 1822
1819 const PseudoStyleCache* pseudoStyleCache = currentStyle->cachedPseudoStyles(); 1823 const PseudoStyleCache* pseudoStyleCache = currentStyle->cachedPseudoStyles();
1820 if (!pseudoStyleCache) 1824 if (!pseudoStyleCache)
1821 return false; 1825 return;
1822 1826
1823 size_t cacheSize = pseudoStyleCache->size(); 1827 size_t cacheSize = pseudoStyleCache->size();
1824 for (size_t i = 0; i < cacheSize; ++i) { 1828 for (size_t i = 0; i < cacheSize; ++i) {
1825 RefPtr<ComputedStyle> newPseudoStyle; 1829 RefPtr<ComputedStyle> newPseudoStyle;
1826 RefPtr<ComputedStyle> oldPseudoStyle = pseudoStyleCache->at(i); 1830 RefPtr<ComputedStyle> oldPseudoStyle = pseudoStyleCache->at(i);
1827 PseudoId pseudoId = oldPseudoStyle->styleType(); 1831 PseudoId pseudoId = oldPseudoStyle->styleType();
1828 if (pseudoId == PseudoIdFirstLine || pseudoId == PseudoIdFirstLineInherited) 1832 if (pseudoId == PseudoIdFirstLine || pseudoId == PseudoIdFirstLineInherited)
1829 newPseudoStyle = layoutObject()->uncachedFirstLineStyle(newStyle); 1833 newPseudoStyle = layoutObject()->uncachedFirstLineStyle(newStyle);
1830 else 1834 else
1831 newPseudoStyle = layoutObject()->getUncachedPseudoStyle( 1835 newPseudoStyle = layoutObject()->getUncachedPseudoStyle(
1832 PseudoStyleRequest(pseudoId), newStyle, newStyle); 1836 PseudoStyleRequest(pseudoId), newStyle, newStyle);
1833 if (!newPseudoStyle) 1837 if (!newPseudoStyle)
1834 return true; 1838 continue;
1835 if (*oldPseudoStyle != *newPseudoStyle || 1839 if (*oldPseudoStyle != *newPseudoStyle ||
1836 oldPseudoStyle->font().loadingCustomFonts() != 1840 oldPseudoStyle->font().loadingCustomFonts() !=
1837 newPseudoStyle->font().loadingCustomFonts()) { 1841 newPseudoStyle->font().loadingCustomFonts()) {
1838 if (pseudoId < FirstInternalPseudoId) 1842 if (pseudoId < FirstInternalPseudoId)
1839 newStyle->setHasPseudoStyle(pseudoId); 1843 newStyle->setHasPseudoStyle(pseudoId);
1840 newStyle->addCachedPseudoStyle(newPseudoStyle); 1844 newStyle->addCachedPseudoStyle(newPseudoStyle);
1841 if (pseudoId == PseudoIdFirstLine || 1845 if (pseudoId == PseudoIdFirstLine ||
1842 pseudoId == PseudoIdFirstLineInherited) 1846 pseudoId == PseudoIdFirstLineInherited) {
1843 layoutObject()->firstLineStyleDidChange(*oldPseudoStyle, 1847 layoutObject()->firstLineStyleDidChange(*oldPseudoStyle,
1844 *newPseudoStyle); 1848 *newPseudoStyle);
1845 return true; 1849 }
1846 } 1850 }
1847 } 1851 }
1848 return false;
1849 } 1852 }
1850 1853
1851 PassRefPtr<ComputedStyle> Element::styleForLayoutObject() { 1854 PassRefPtr<ComputedStyle> Element::styleForLayoutObject() {
1852 DCHECK(document().inStyleRecalc()); 1855 DCHECK(document().inStyleRecalc());
1853 1856
1854 RefPtr<ComputedStyle> style; 1857 RefPtr<ComputedStyle> style;
1855 1858
1856 // FIXME: Instead of clearing updates that may have been added from calls to 1859 // FIXME: Instead of clearing updates that may have been added from calls to
1857 // styleForElement outside recalcStyle, we should just never set them if we're 1860 // styleForElement outside recalcStyle, we should just never set them if we're
1858 // not inside recalcStyle. 1861 // not inside recalcStyle.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 setNeedsReattachLayoutTree(); 2028 setNeedsReattachLayoutTree();
2026 return rebuildLayoutTree(); 2029 return rebuildLayoutTree();
2027 } 2030 }
2028 2031
2029 DCHECK(oldStyle); 2032 DCHECK(oldStyle);
2030 2033
2031 if (localChange != NoChange) 2034 if (localChange != NoChange)
2032 updateCallbackSelectors(oldStyle.get(), newStyle.get()); 2035 updateCallbackSelectors(oldStyle.get(), newStyle.get());
2033 2036
2034 if (LayoutObject* layoutObject = this->layoutObject()) { 2037 if (LayoutObject* layoutObject = this->layoutObject()) {
2035 if (localChange != NoChange || 2038 if (localChange != NoChange) {
2036 pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get())) { 2039 pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get());
2037 layoutObject->setStyle(newStyle.get()); 2040 layoutObject->setStyle(newStyle.get());
2038 } else { 2041 } else {
2039 // Although no change occurred, we use the new style so that the cousin 2042 // Although no change occurred, we use the new style so that the cousin
2040 // style sharing code won't get fooled into believing this style is the 2043 // style sharing code won't get fooled into believing this style is the
2041 // same. 2044 // same.
2042 // FIXME: We may be able to remove this hack, see discussion in 2045 // FIXME: We may be able to remove this hack, see discussion in
2043 // https://codereview.chromium.org/30453002/ 2046 // https://codereview.chromium.org/30453002/
2044 layoutObject->setStyleInternal(newStyle.get()); 2047 layoutObject->setStyleInternal(newStyle.get());
2045 } 2048 }
2046 } else if (localChange != NoChange && 2049 } else if (localChange != NoChange &&
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after
4201 } 4204 }
4202 4205
4203 DEFINE_TRACE_WRAPPERS(Element) { 4206 DEFINE_TRACE_WRAPPERS(Element) {
4204 if (hasRareData()) { 4207 if (hasRareData()) {
4205 visitor->traceWrappers(elementRareData()); 4208 visitor->traceWrappers(elementRareData());
4206 } 4209 }
4207 ContainerNode::traceWrappers(visitor); 4210 ContainerNode::traceWrappers(visitor);
4208 } 4211 }
4209 4212
4210 } // namespace blink 4213 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698