Skip to content

Commit

Permalink
refactor: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 20, 2022
1 parent b4c2e77 commit 3995e1f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 65 deletions.
104 changes: 53 additions & 51 deletions crates/swc_atoms/words.txt
@@ -1,4 +1,7 @@
*
*
-infinity
-moz-activehyperlinktext
-moz-animation
-moz-animation-delay
-moz-animation-direction
Expand All @@ -9,6 +12,8 @@
-moz-animation-play-state
-moz-animation-timing-function
-moz-any
-moz-any
-moz-any
-moz-appearance
-moz-backface-visibility
-moz-background-origin
Expand All @@ -29,7 +34,14 @@
-moz-box-pack
-moz-box-shadow
-moz-box-sizing
-moz-buttondefault
-moz-buttonhoverface
-moz-buttonhovertext
-moz-calc
-moz-calc
-moz-calc
-moz-cellhighlight
-moz-cellhighlighttext
-moz-column-count
-moz-column-fill
-moz-column-gap
Expand All @@ -40,14 +52,48 @@
-moz-column-span
-moz-column-width
-moz-columns
-moz-combobox
-moz-comboboxtext
-moz-default-background-color
-moz-default-color
-moz-dialog
-moz-dialogtext
-moz-document
-moz-document
-moz-document
-moz-dragtargetzone
-moz-eventreerow
-moz-font-feature-settings
-moz-font-language-override
-moz-font-variant-ligatures
-moz-html-cellhighlight
-moz-html-cellhighlighttext
-moz-hyperlinktext
-moz-hyphens
-moz-keyframes
-moz-keyframes
-moz-keyframes
-moz-mac-accentdarkestshadow
-moz-mac-accentdarkshadow
-moz-mac-accentface
-moz-mac-accentlightesthighlight
-moz-mac-accentlightshadow
-moz-mac-accentregularhighlight
-moz-mac-accentregularshadow
-moz-mac-chrome-active
-moz-mac-chrome-inactive
-moz-mac-focusring
-moz-mac-menuselect
-moz-mac-menushadow
-moz-mac-menutextselect
-moz-margin-end
-moz-margin-start
-moz-menubarhovertext
-moz-menubartext
-moz-menuhover
-moz-menuhovertext
-moz-nativehyperlinktext
-moz-oddtreerow
-moz-padding-end
-moz-padding-start
-moz-perspective
Expand All @@ -67,6 +113,11 @@
-moz-transition-duration
-moz-transition-timing-function
-moz-user-select
-moz-visitedhyperlinktext
-moz-win-accentcolor
-moz-win-accentcolortext
-moz-win-communicationstext
-moz-win-mediatext
-ms-appearance
-ms-flex
-ms-flex-align
Expand All @@ -85,57 +136,6 @@
-ms-high-contrast-adjust
-ms-hyphens
-ms-interpolation-mode
-moz-any
-moz-calc
-moz-document
-moz-keyframes
*
-infinity
-moz-activehyperlinktext
-moz-any
-moz-buttondefault
-moz-buttonhoverface
-moz-buttonhovertext
-moz-calc
-moz-cellhighlight
-moz-cellhighlighttext
-moz-combobox
-moz-comboboxtext
-moz-default-background-color
-moz-default-color
-moz-dialog
-moz-dialogtext
-moz-document
-moz-dragtargetzone
-moz-eventreerow
-moz-html-cellhighlight
-moz-html-cellhighlighttext
-moz-hyperlinktext
-moz-keyframes
-moz-mac-accentdarkestshadow
-moz-mac-accentdarkshadow
-moz-mac-accentface
-moz-mac-accentlightesthighlight
-moz-mac-accentlightshadow
-moz-mac-accentregularhighlight
-moz-mac-accentregularshadow
-moz-mac-chrome-active
-moz-mac-chrome-inactive
-moz-mac-focusring
-moz-mac-menuselect
-moz-mac-menushadow
-moz-mac-menutextselect
-moz-menubarhovertext
-moz-menubartext
-moz-menuhover
-moz-menuhovertext
-moz-nativehyperlinktext
-moz-oddtreerow
-moz-visitedhyperlinktext
-moz-win-accentcolor
-moz-win-accentcolortext
-moz-win-communicationstext
-moz-win-mediatext
-ms-keyframes
-ms-region-fragment
-ms-scroll-chaining
Expand Down Expand Up @@ -1929,6 +1929,8 @@ overflow-block
overflow-clip-margin
overflow-inline
overflow-wrap
overflow-x
overflow-y
overline
override
overscroll-behavior
Expand Down
34 changes: 20 additions & 14 deletions crates/swc_css_prefixer/src/prefixer.rs
Expand Up @@ -2379,7 +2379,6 @@ impl VisitMut for Prefixer {
}

js_word!("opacity") if should_prefix("opacity", self.env, true) => {
"opacity" if should_prefix("opacity", self.env, false) => {
let old_value = match n.value.get(0) {
Some(ComponentValue::Percentage(percentage)) => Some(percentage.value.value),
_ => None,
Expand Down Expand Up @@ -3389,33 +3388,41 @@ impl VisitMut for Prefixer {

js_word!("overflow-wrap") => {
add_declaration!(js_word!("word-wrap"), None);
"overflow-wrap" => {
add_declaration!("word-wrap", None);
"overflow" if should_prefix("overflow", self.env, false) && n.value.len() == 2 => {
}

js_word!("overflow")
if should_prefix("overflow", self.env, false) && n.value.len() == 2 =>
{
if let (
Some(left @ ComponentValue::Ident(box first)),
Some(right @ ComponentValue::Ident(box second)),
) = (n.value.get(0), n.value.get(1))
{
if first.value.eq_ignore_ascii_case(&second.value) {
add_declaration!("overflow", Some(Box::new(|| { vec![left.clone()] })));
add_declaration!(
js_word!("overflow"),
Some(Box::new(|| { vec![left.clone()] }))
);
} else {
add_declaration!("overflow-x", Some(Box::new(|| { vec![left.clone()] })));
add_declaration!("overflow-y", Some(Box::new(|| { vec![right.clone()] })));
add_declaration!(
js_word!("overflow-x"),
Some(Box::new(|| { vec![left.clone()] }))
);
add_declaration!(
js_word!("overflow-y"),
Some(Box::new(|| { vec![right.clone()] }))
);
}
}
}

js_word!("tab-size") => {
add_declaration!(Prefix::Moz, js_word!("-moz-tab-size"), None);
add_declaration!(Prefix::O, js_word!("-o-tab-size"), None);
"overflow-wrap" => {
add_declaration!("word-wrap", None);
}

"tab-size" => {
add_declaration!(Prefix::Moz, "-moz-tab-size", None);
add_declaration!(Prefix::O, "-o-tab-size", None);
js_word!("overflow-wrap") => {
add_declaration!(js_word!("word-wrap"), None);
}

js_word!("hyphens") => {
Expand Down Expand Up @@ -3612,8 +3619,7 @@ impl VisitMut for Prefixer {
add_declaration!(Prefix::Moz, js_word!("-moz-border-radius-bottomleft"), None);
}

js_word!("src") if should_prefix("font-face-format-ident", self.env, true) => {
"src" if should_prefix("font-face-format-ident", self.env, false) => {
js_word!("src") if should_prefix("font-face-format-ident", self.env, false) => {
let mut new_declaration = n.clone();

font_face_format_old_syntax(&mut new_declaration);
Expand Down

0 comments on commit 3995e1f

Please sign in to comment.