forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when referencing a registered non-inherited custom property
This patch fixes a crash that occurs when a registered non-inherited custom property is referenced on an element which doesn't explicitly have any registered non-inherited custom properties set. The code was missing a null-check for the non-inherited custom properties object. Note that elsewhere in the file this is not needed as the object is guaranteed to exist when we are resolving such properties. BUG=671484 Review-Url: https://codereview.chromium.org/2552163002 Cr-Commit-Position: refs/heads/master@{#436880}
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
third_party/WebKit/LayoutTests/custom-properties/registered-property-initial.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE HTML> | ||
<script src="../resources/testharness.js"></script> | ||
<script src="../resources/testharnessreport.js"></script> | ||
<style> | ||
#target { | ||
background: var(--inherited-color); | ||
color: var(--non-inherited-color); | ||
} | ||
</style> | ||
<div id=target></div> | ||
<script> | ||
CSS.registerProperty({name: '--inherited-color', syntax: '<color>', initialValue: 'pink', inherits: true}); | ||
CSS.registerProperty({name: '--non-inherited-color', syntax: '<color>', initialValue: 'purple'}); | ||
|
||
test(function() { | ||
computedStyle = getComputedStyle(target); | ||
assert_equals(computedStyle.getPropertyValue('--inherited-color'), 'pink'); | ||
assert_equals(computedStyle.getPropertyValue('--non-inherited-color'), 'purple'); | ||
|
||
assert_equals(computedStyle.backgroundColor, 'rgb(255, 192, 203)'); | ||
assert_equals(computedStyle.color, 'rgb(128, 0, 128)'); | ||
}, "Initial values of registered properties can be referenced when no custom properties are explicitly set."); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters