Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 change.styleResolverUpdateType = updateType; | 193 change.styleResolverUpdateType = updateType; |
| 194 } else { | 194 } else { |
| 195 if (styleSheetContentsHasFontFaceRule(addedSheets)) { | 195 if (styleSheetContentsHasFontFaceRule(addedSheets)) { |
| 196 change.styleResolverUpdateType = ResetStyleResolverAndFontSelect or; | 196 change.styleResolverUpdateType = ResetStyleResolverAndFontSelect or; |
| 197 return; | 197 return; |
| 198 } | 198 } |
| 199 // FIXME: since currently all stylesheets are re-added after resetin g styleresolver, | 199 // FIXME: since currently all stylesheets are re-added after resetin g styleresolver, |
| 200 // fontSelector should be always reset. After creating RuleSet for e ach StyleSheetContents, | 200 // fontSelector should be always reset. After creating RuleSet for e ach StyleSheetContents, |
| 201 // we can avoid appending all stylesheetcontents in reset case. | 201 // we can avoid appending all stylesheetcontents in reset case. |
| 202 // So we can remove "styleSheetContentsHasFontFaceRule(newSheets)". | 202 // So we can remove "styleSheetContentsHasFontFaceRule(newSheets)". |
| 203 if (cssStyleSheetHasFontFaceRule(newCollection.activeAuthorStyleShee ts())) | 203 change.styleResolverUpdateType = cssStyleSheetHasFontFaceRule(newCol lection.activeAuthorStyleSheets() ? ResetStyleResolverAndFontSelector : Reset; |
| 204 change.styleResolverUpdateType = ResetStyleResolverAndFontSelect or; | |
|
esprehn
2013/11/22 05:13:35
Just add an else, the ternary makes this a bit har
tasak
2013/11/22 06:16:40
I strongly agree. Done. I missed ")".
| |
| 205 change.styleResolverUpdateType = Reset; | |
| 206 } | 204 } |
| 207 } | 205 } |
| 208 | 206 |
| 209 // FIXME: If styleResolverUpdateType is still Reconstruct, we could return e arly here | 207 // FIXME: If styleResolverUpdateType is still Reconstruct, we could return e arly here |
| 210 // as destroying the StyleResolver will recalc the whole document anyway? | 208 // as destroying the StyleResolver will recalc the whole document anyway? |
| 211 | 209 |
| 212 // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs. | 210 // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs. |
| 213 if (!document()->body() || document()->hasNodesWithPlaceholderStyle()) | 211 if (!document()->body() || document()->hasNodesWithPlaceholderStyle()) |
| 214 return; | 212 return; |
| 215 StyleInvalidationAnalysis invalidationAnalysis(addedSheets); | 213 StyleInvalidationAnalysis invalidationAnalysis(addedSheets); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 242 } | 240 } |
| 243 return false; | 241 return false; |
| 244 } | 242 } |
| 245 | 243 |
| 246 void StyleSheetCollection::updateUsesRemUnits() | 244 void StyleSheetCollection::updateUsesRemUnits() |
| 247 { | 245 { |
| 248 m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets); | 246 m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets); |
| 249 } | 247 } |
| 250 | 248 |
| 251 } | 249 } |
| OLD | NEW |