DescriptionAvoid parsing css text if there are identical inline style blocks.
(1) StyleEngine has two hashmaps, one is a mapping from css text to StyleSheetContents and the other is a mapping from StyleSheetContents to css text. When destroying StyleSheetContents, using the above mapping to remove css text.
The hashmaps are only for non-quirks document. Because non-quirks document cannot share styles with quirks document.
(2) made StyleSheetContents::checkLoaded to invoke new clients' sheetLoaded. To do so,
(2-1) moved m_loadCompleted flag from StyleSheetContents to CSSStyleSheet,
(2-2) added more "protect" to StyleSheetContents::checkLoaded to avoid CSSStyleSheet (i.e. client) and ownerNode being deleted by scripts, and
(2-3) modified StyleSheetContents::loadCompleted() to see whether all clients completed loading.
(3) LinkStyle::setCSSStyleSheet should use StyleSheetContents' checkLoaded. Because now checkLoaded invokes only new clients' sheetLoaded. We don't need to directly invoke LinkStyle::sheetLoaded (this breaks m_loadCompleted flag and causes assertion failure).
BUG=308781
TEST=all existing tests covers, so the tests should pass.
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165139
Patch Set 1 #
Total comments: 6
Patch Set 2 : Added StyleSheetContentsCache class #
Total comments: 8
Patch Set 3 : #
Total comments: 9
Patch Set 4 : Share StyleSheetContents directly #Patch Set 5 : Rebased #
Total comments: 13
Patch Set 6 : #
Total comments: 6
Patch Set 7 : Remove clearSheetCache #Patch Set 8 : #
Total comments: 2
Patch Set 9 : Patch for landing #
Messages
Total messages: 27 (0 generated)
|