Changeset 107551 in webkit
- Timestamp:
- Feb 13, 2012 2:09:49 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r107548 r107551 1 2012-02-13 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 Moved comparison of "type" and "readonly" attributes into the more specific 11 canShareStyleWithControl() since they are only relevant for input elements. Don't bother 12 calling isFormControlElement() on both elements as they already have the same tagQName(). 13 14 Altogether this knocks off ~8ms worth of samples per cycle of the "Moz" page cycler test. 15 16 * css/CSSStyleSelector.cpp: 17 (WebCore::CSSStyleSelector::canShareStyleWithControl): 18 (WebCore::CSSStyleSelector::canShareStyleWithElement): 19 (WebCore::isCommonAttributeSelectorAttribute): 20 1 21 2012-02-13 Arko Saha <arko@motorola.com> 2 22 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r107526 r107551 1190 1190 } 1191 1191 1192 if (element->fastGetAttribute(typeAttr) != m_element->fastGetAttribute(typeAttr)) 1193 return false; 1194 1195 if (element->fastGetAttribute(readonlyAttr) != m_element->fastGetAttribute(readonlyAttr)) 1196 return false; 1197 1198 1192 1199 return true; 1193 1200 } … … 1235 1242 if (!!element->attributeStyle() != !!m_styledElement->attributeStyle()) 1236 1243 return false; 1237 StylePropertySet* additionalAttributeStyleA = element->additionalAttributeStyle();1238 StylePropertySet* additionalAttributeStyleB = m_styledElement->additionalAttributeStyle();1239 if (!additionalAttributeStyleA != !additionalAttributeStyleB)1240 return false;1241 1244 if (element->isLink() != m_element->isLink()) 1242 1245 return false; … … 1249 1252 if (element->focused() != m_element->focused()) 1250 1253 return false; 1251 if (element->shadowPseudoId() != m_element->shadowPseudoId())1252 return false;1253 1254 if (element == element->document()->cssTarget()) 1254 1255 return false; 1255 1256 if (m_element == m_element->document()->cssTarget()) 1256 1257 return false; 1257 if ( element->getAttribute(typeAttr) != m_element->getAttribute(typeAttr))1258 if (style->transitions() || style->animations()) 1258 1259 return false; 1259 if (element-> fastGetAttribute(XMLNames::langAttr) != m_element->fastGetAttribute(XMLNames::langAttr))1260 if (element->isLink() && m_elementLinkState != style->insideLink()) 1260 1261 return false; 1261 if (element-> fastGetAttribute(langAttr) != m_element->fastGetAttribute(langAttr))1262 if (element->shadowPseudoId() != m_element->shadowPseudoId()) 1262 1263 return false; 1263 if (element->fastGetAttribute(readonlyAttr) != m_element->fastGetAttribute(readonlyAttr))1264 return false;1265 if (element->fastGetAttribute(cellpaddingAttr) != m_element->fastGetAttribute(cellpaddingAttr))1266 return false;1267 1268 1264 if (element->hasID() && m_features.idsInRules.contains(element->idForStyleResolution().impl())) 1269 1265 return false; 1270 1271 #if ENABLE(STYLE_SCOPED) 1272 if (element->hasScopedHTMLStyleChild()) 1273 return false; 1274 #endif 1275 1276 bool isControl = element->isFormControlElement(); 1277 1278 if (isControl != m_element->isFormControlElement()) 1279 return false; 1280 1281 if (isControl && !canShareStyleWithControl(element)) 1282 return false; 1283 1284 if (style->transitions() || style->animations()) 1266 if (m_element->isFormControlElement() && !canShareStyleWithControl(element)) 1285 1267 return false; 1286 1268 … … 1303 1285 return false; 1304 1286 1287 StylePropertySet* additionalAttributeStyleA = element->additionalAttributeStyle(); 1288 StylePropertySet* additionalAttributeStyleB = m_styledElement->additionalAttributeStyle(); 1289 if (!additionalAttributeStyleA != !additionalAttributeStyleB) 1290 return false; 1291 1292 if (element->fastGetAttribute(XMLNames::langAttr) != m_element->fastGetAttribute(XMLNames::langAttr)) 1293 return false; 1294 if (element->fastGetAttribute(langAttr) != m_element->fastGetAttribute(langAttr)) 1295 return false; 1296 1305 1297 if (element->attributeStyle() && !attributeStylesEqual(element->attributeStyle(), m_styledElement->attributeStyle())) 1306 1298 return false; … … 1309 1301 return false; 1310 1302 1311 if (element->isLink() && m_elementLinkState != style->insideLink()) 1303 #if ENABLE(STYLE_SCOPED) 1304 if (element->hasScopedHTMLStyleChild()) 1312 1305 return false; 1306 #endif 1313 1307 1314 1308 return true; … … 2173 2167 static inline bool isCommonAttributeSelectorAttribute(const QualifiedName& attribute) 2174 2168 { 2175 // These are explicitly tested for equality in canShareStyleWith Element.2169 // These are explicitly tested for equality in canShareStyleWithControl. 2176 2170 return attribute == typeAttr || attribute == readonlyAttr; 2177 2171 }
Note: See TracChangeset
for help on using the changeset viewer.