Avoid 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. Review URL: https://codereview.chromium.org/28553005 git-svn-id: svn://svn.chromium.org/blink/trunk@165139 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
Please register or sign in to comment