Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: cherry-pick 1a31e2110440 from chromium (#33856)
* chore: cherry-pick 1a31e2110440 from chromium * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Electron Bot <electron@github.com>
- Loading branch information
1 parent
1f669c3
commit 742aab7
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
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,62 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Anders Hartvoll Ruud <andruud@chromium.org> | ||
Date: Tue, 5 Apr 2022 20:44:33 +0000 | ||
Subject: Disallow CSS-wide keywords for StylePropertyMap.set | ||
|
||
We don't support this properly, and the spec does not handle CSS-keywords | ||
either. Disallow it until we can add proper support for this. | ||
|
||
(cherry picked from commit 02e4b18febb37de8baea718bc2f62cfb5fe56e23) | ||
|
||
Fixed: 1292905 | ||
Bug: 1310761 | ||
Change-Id: Ieb3d20edfea72c2ccb0928536fdfd86d10aad1a9 | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3551609 | ||
Reviewed-by: Rune Lillesveen <futhark@chromium.org> | ||
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> | ||
Cr-Original-Commit-Position: refs/heads/main@{#986411} | ||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3572186 | ||
Commit-Queue: Srinivas Sista <srinivassista@chromium.org> | ||
Auto-Submit: Srinivas Sista <srinivassista@chromium.org> | ||
Commit-Queue: Rune Lillesveen <futhark@chromium.org> | ||
Cr-Commit-Position: refs/branch-heads/4896@{#1041} | ||
Cr-Branched-From: 1f63ff4bc27570761b35ffbc7f938f6586f7bee8-refs/heads/main@{#972766} | ||
|
||
diff --git a/third_party/blink/renderer/build/scripts/core/css/templates/cssom_keywords.cc.tmpl b/third_party/blink/renderer/build/scripts/core/css/templates/cssom_keywords.cc.tmpl | ||
index 87caef2cf5cf56b7bf72752410648ef1d7bb9f9a..59c505707216362d3a3b662a6a531398b8f5009e 100644 | ||
--- a/third_party/blink/renderer/build/scripts/core/css/templates/cssom_keywords.cc.tmpl | ||
+++ b/third_party/blink/renderer/build/scripts/core/css/templates/cssom_keywords.cc.tmpl | ||
@@ -21,8 +21,10 @@ bool CSSOMKeywords::ValidKeywordForProperty(CSSPropertyID id, | ||
return false; | ||
} | ||
|
||
- if (css_parsing_utils::IsCSSWideKeyword(valueID)) | ||
- return true; | ||
+ if (css_parsing_utils::IsCSSWideKeyword(valueID)) { | ||
+ // TODO(crbug.com/1310761): Support CSS-wide keywords in custom props. | ||
+ return id != CSSPropertyID::kVariable; | ||
+ } | ||
|
||
switch (id) { | ||
{% for property in properties if property.keywordIDs and 'Keyword' in property.typedom_types %} | ||
diff --git a/third_party/blink/web_tests/external/wpt/css/css-typed-om/set-css-wide-in-custom-property-crash.html b/third_party/blink/web_tests/external/wpt/css/css-typed-om/set-css-wide-in-custom-property-crash.html | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..bc977c9889889bd8a35eccc48ac28e25871b1ec9 | ||
--- /dev/null | ||
+++ b/third_party/blink/web_tests/external/wpt/css/css-typed-om/set-css-wide-in-custom-property-crash.html | ||
@@ -0,0 +1,15 @@ | ||
+<!DOCTYPE html> | ||
+<title>Don't crash when setting a CSS-wide keyword on a custom property</title> | ||
+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> | ||
+<link rel="help" href="https://crbug.com/1310761<"> | ||
+<div id="target"> | ||
+ Don't crash | ||
+</div> | ||
+<script> | ||
+ for (let keyword of ['initial', 'inherit', 'unset', 'revert', 'revert-layer']) { | ||
+ try { | ||
+ target.attributeStyleMap.set('--x', new CSSKeywordValue(keyword)); | ||
+ } catch (e) { | ||
+ } | ||
+ } | ||
+</script> |