OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <div id="outer"> |
| 5 <div id="inner"> |
| 6 <div id="innermost"> |
| 7 </div> |
| 8 </div> |
| 9 </div> |
| 10 <script> |
| 11 test(function(t) |
| 12 { |
| 13 if (!window.internals) |
| 14 assert_unreached('This test requires window.internals.'); |
| 15 |
| 16 outer.style.fontSize = "16px"; |
| 17 innermost.style.fontSize = "1em"; |
| 18 |
| 19 inner.offsetTop; // Force recalc. |
| 20 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0); |
| 21 |
| 22 assert_equals(getComputedStyle(outer).fontSize, "16px"); |
| 23 assert_equals(getComputedStyle(inner).fontSize, "16px"); |
| 24 assert_equals(getComputedStyle(innermost).fontSize, "16px"); |
| 25 |
| 26 inner.offsetTop; // Force recalc. |
| 27 outer.style.fontSize = '10px'; |
| 28 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3); |
| 29 |
| 30 assert_equals(getComputedStyle(outer).fontSize, "10px"); |
| 31 assert_equals(getComputedStyle(inner).fontSize, "10px"); |
| 32 assert_equals(getComputedStyle(innermost).fontSize, "10px"); |
| 33 |
| 34 inner.offsetTop; // Force recalc. |
| 35 inner.style.fontSize = '16px'; |
| 36 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2); |
| 37 |
| 38 assert_equals(getComputedStyle(outer).fontSize, "10px"); |
| 39 assert_equals(getComputedStyle(inner).fontSize, "16px"); |
| 40 assert_equals(getComputedStyle(innermost).fontSize, "16px"); |
| 41 }, "Changing font-size (a non-independent inherited property) in a way that resu
lts in an identical ComputedStyle still triggers a style recalc for its children
."); |
| 42 |
| 43 test(function(t) |
| 44 { |
| 45 if (!window.internals) |
| 46 assert_unreached('This test requires window.internals.'); |
| 47 |
| 48 outer.style.fontWeight = "normal"; |
| 49 innermost.style.fontWeight = "lighter"; |
| 50 |
| 51 inner.offsetTop; // Force recalc. |
| 52 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0); |
| 53 |
| 54 assert_equals(getComputedStyle(outer).fontWeight, "normal"); |
| 55 assert_equals(getComputedStyle(inner).fontWeight, "normal"); |
| 56 assert_equals(getComputedStyle(innermost).fontWeight, "100"); |
| 57 |
| 58 inner.offsetTop; // Force recalc. |
| 59 inner.style.fontWeight = 'bolder'; |
| 60 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2); |
| 61 |
| 62 assert_equals(getComputedStyle(outer).fontWeight, "normal"); |
| 63 assert_equals(getComputedStyle(inner).fontWeight, "bold"); |
| 64 assert_equals(getComputedStyle(innermost).fontWeight, "normal"); |
| 65 |
| 66 inner.offsetTop; // Force recalc. |
| 67 outer.style.fontWeight = 'bold'; |
| 68 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3); |
| 69 |
| 70 assert_equals(getComputedStyle(outer).fontWeight, "bold"); |
| 71 assert_equals(getComputedStyle(inner).fontWeight, "900"); |
| 72 assert_equals(getComputedStyle(innermost).fontWeight, "bold"); |
| 73 }, "Changing font-weight (a non-independent inherited property) in a way that re
sults in an identical ComputedStyle still triggers a style recalc for its childr
en."); |
| 74 </script> |
OLD | NEW |