| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 return ownerElement->containingShadowRoot()->shadowHost(); | 107 return ownerElement->containingShadowRoot()->shadowHost(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 static bool ruleAdditionMightRequireDocumentStyleRecalc(StyleRuleBase* rule) | 110 static bool ruleAdditionMightRequireDocumentStyleRecalc(StyleRuleBase* rule) |
| 111 { | 111 { |
| 112 // This funciton is conservative. We only return false when we know that | 112 // This funciton is conservative. We only return false when we know that |
| 113 // the added @rule can't require style recalcs. | 113 // the added @rule can't require style recalcs. |
| 114 switch (rule->type()) { | 114 switch (rule->type()) { |
| 115 case StyleRule::Import: // Whatever we import should do its own analysis, we
don't need to invalidate the document here! | 115 case StyleRule::Import: // Whatever we import should do its own analysis, we
don't need to invalidate the document here! |
| 116 case StyleRule::Keyframes: // Keyframes never cause style invalidations and
are handled during sheet insertion. | |
| 117 case StyleRule::Page: // Page rules apply only during printing, we force a f
ull-recalc before printing. | 116 case StyleRule::Page: // Page rules apply only during printing, we force a f
ull-recalc before printing. |
| 118 return false; | 117 return false; |
| 119 | 118 |
| 120 case StyleRule::Media: // If the media rule doesn't apply, we could avoid re
calc. | 119 case StyleRule::Media: // If the media rule doesn't apply, we could avoid re
calc. |
| 121 case StyleRule::FontFace: // If the fonts aren't in use, we could avoid reca
lc. | 120 case StyleRule::FontFace: // If the fonts aren't in use, we could avoid reca
lc. |
| 122 case StyleRule::Supports: // If we evaluated the supports-clause we could av
oid recalc. | 121 case StyleRule::Supports: // If we evaluated the supports-clause we could av
oid recalc. |
| 123 case StyleRule::Viewport: // If the viewport doesn't match, we could avoid r
ecalcing. | 122 case StyleRule::Viewport: // If the viewport doesn't match, we could avoid r
ecalcing. |
| 123 case StyleRule::Keyframes: // If the animation doesn't match an element, we
could avoid recalc. |
| 124 // FIXME: Unclear if any of the rest need to cause style recalc: | 124 // FIXME: Unclear if any of the rest need to cause style recalc: |
| 125 case StyleRule::Filter: | 125 case StyleRule::Filter: |
| 126 return true; | 126 return true; |
| 127 | 127 |
| 128 // These should all be impossible to reach: | 128 // These should all be impossible to reach: |
| 129 case StyleRule::Keyframe: | 129 case StyleRule::Keyframe: |
| 130 case StyleRule::Style: | 130 case StyleRule::Style: |
| 131 break; | 131 break; |
| 132 } | 132 } |
| 133 ASSERT_NOT_REACHED(); | 133 ASSERT_NOT_REACHED(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 element->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo
rTracing::create(StyleChangeReason::StyleSheetChange)); | 209 element->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo
rTracing::create(StyleChangeReason::StyleSheetChange)); |
| 210 // The whole subtree is now invalidated, we can skip to the next sib
ling. | 210 // The whole subtree is now invalidated, we can skip to the next sib
ling. |
| 211 element = ElementTraversal::nextSkippingChildren(*element); | 211 element = ElementTraversal::nextSkippingChildren(*element); |
| 212 continue; | 212 continue; |
| 213 } | 213 } |
| 214 element = ElementTraversal::next(*element); | 214 element = ElementTraversal::next(*element); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 } | 218 } |
| OLD | NEW |