Changeset 107261 in webkit
- Timestamp:
- Feb 9, 2012, 10:56:40 AM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
css/CSSStyleSelector.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r107259 r107261 1 2012-02-09 Andreas Kling <awesomekling@apple.com> 2 3 Avoid unnecessary work when evaluating style sharing candidates. 4 <http://webkit.org/b/78220> 5 6 Reviewed by Antti Koivisto. 7 8 Do the cheap checks (bitfields, pointers) before calling virtuals and doing hash lookups. 9 Remove comparison of attributes that are reflected in the attribute styles (cellpadding, 10 lang and xml:lang.) Moved comparison of "type" and "readonly" attributes into the more 11 specific canShareStyleWithControl() since they are only relevant for input elements. 12 Don't bother calling isFormControlElement() on both elements since we already know they 13 have the same tagQName(). 14 15 Altogether this knocks off 8-9ms worth of samples per cycle of the "Moz" page cycler test. 16 17 * css/CSSStyleSelector.cpp: 18 (WebCore::CSSStyleSelector::canShareStyleWithControl): 19 (WebCore::CSSStyleSelector::canShareStyleWithElement): 20 (WebCore::isCommonAttributeSelectorAttribute): 21 1 22 2012-02-09 Mike Lawther <mikelawther@chromium.org> 2 23 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r107212 r107261 1191 1191 } 1192 1192 1193 if (element->fastGetAttribute(typeAttr) != m_element->fastGetAttribute(typeAttr)) 1194 return false; 1195 1196 if (element->fastGetAttribute(readonlyAttr) != m_element->fastGetAttribute(readonlyAttr)) 1197 return false; 1198 1199 1193 1200 return true; 1194 1201 } … … 1236 1243 if (!!element->attributeStyle() != !!m_styledElement->attributeStyle()) 1237 1244 return false; 1238 StylePropertySet* additionalAttributeStyleA = element->additionalAttributeStyle();1239 StylePropertySet* additionalAttributeStyleB = m_styledElement->additionalAttributeStyle();1240 if (!additionalAttributeStyleA != !additionalAttributeStyleB)1241 return false;1242 1245 if (element->isLink() != m_element->isLink()) 1243 1246 return false; … … 1250 1253 if (element->focused() != m_element->focused()) 1251 1254 return false; 1252 if (element->shadowPseudoId() != m_element->shadowPseudoId())1253 return false;1254 1255 if (element == element->document()->cssTarget()) 1255 1256 return false; 1256 1257 if (m_element == m_element->document()->cssTarget()) 1257 1258 return false; 1258 if ( element->getAttribute(typeAttr) != m_element->getAttribute(typeAttr))1259 if (style->transitions() || style->animations()) 1259 1260 return false; 1260 if (element-> fastGetAttribute(XMLNames::langAttr) != m_element->fastGetAttribute(XMLNames::langAttr))1261 if (element->isLink() && m_elementLinkState != style->insideLink()) 1261 1262 return false; 1262 if (element-> fastGetAttribute(langAttr) != m_element->fastGetAttribute(langAttr))1263 if (element->shadowPseudoId() != m_element->shadowPseudoId()) 1263 1264 return false; 1264 if (element->fastGetAttribute(readonlyAttr) != m_element->fastGetAttribute(readonlyAttr))1265 return false;1266 if (element->fastGetAttribute(cellpaddingAttr) != m_element->fastGetAttribute(cellpaddingAttr))1267 return false;1268 1269 1265 if (element->hasID() && m_features.idsInRules.contains(element->idForStyleResolution().impl())) 1270 1266 return false; 1271 1272 #if ENABLE(STYLE_SCOPED) 1273 if (element->hasScopedHTMLStyleChild()) 1274 return false; 1275 #endif 1276 1277 bool isControl = element->isFormControlElement(); 1278 1279 if (isControl != m_element->isFormControlElement()) 1280 return false; 1281 1282 if (isControl && !canShareStyleWithControl(element)) 1283 return false; 1284 1285 if (style->transitions() || style->animations()) 1267 if (m_element->isFormControlElement() && !canShareStyleWithControl(element)) 1286 1268 return false; 1287 1269 … … 1304 1286 return false; 1305 1287 1288 StylePropertySet* additionalAttributeStyleA = element->additionalAttributeStyle(); 1289 StylePropertySet* additionalAttributeStyleB = m_styledElement->additionalAttributeStyle(); 1290 if (!additionalAttributeStyleA != !additionalAttributeStyleB) 1291 return false; 1292 1306 1293 if (element->attributeStyle() && !attributeStylesEqual(element->attributeStyle(), m_styledElement->attributeStyle())) 1307 1294 return false; … … 1310 1297 return false; 1311 1298 1312 if (element->isLink() && m_elementLinkState != style->insideLink()) 1299 #if ENABLE(STYLE_SCOPED) 1300 if (element->hasScopedHTMLStyleChild()) 1313 1301 return false; 1302 #endif 1314 1303 1315 1304 return true; … … 2174 2163 static inline bool isCommonAttributeSelectorAttribute(const QualifiedName& attribute) 2175 2164 { 2176 // These are explicitly tested for equality in canShareStyleWith Element.2165 // These are explicitly tested for equality in canShareStyleWithControl. 2177 2166 return attribute == typeAttr || attribute == readonlyAttr; 2178 2167 }
Note:
See TracChangeset
for help on using the changeset viewer.