This commit is contained in:
ysk2014 2020-10-13 12:11:33 +08:00
parent d7f681a60b
commit aedf3f4cba
2 changed files with 17 additions and 11 deletions

View File

@ -202,7 +202,7 @@ export class CSSParsedDeclaration {
this.paddingLeft = parse(paddingLeft, declaration.paddingLeft); this.paddingLeft = parse(paddingLeft, declaration.paddingLeft);
this.position = parse(position, declaration.position); this.position = parse(position, declaration.position);
this.textAlign = parse(textAlign, declaration.textAlign); this.textAlign = parse(textAlign, declaration.textAlign);
this.textFillColor = parse(textFillColor, declaration.textFillColor) this.textFillColor = parse(textFillColor, declaration.textFillColor);
this.textDecorationColor = parse(textDecorationColor, declaration.textDecorationColor || declaration.color); this.textDecorationColor = parse(textDecorationColor, declaration.textDecorationColor || declaration.color);
this.textDecorationLine = parse(textDecorationLine, declaration.textDecorationLine); this.textDecorationLine = parse(textDecorationLine, declaration.textDecorationLine);
this.textShadow = parse(textShadow, declaration.textShadow); this.textShadow = parse(textShadow, declaration.textShadow);

View File

@ -1,12 +1,18 @@
import {CSSParsedDeclaration} from '../css/index'; import {CSSParsedDeclaration} from '../css/index';
import {isLinearGradient, isRadialGradient} from '../css/types/image'; import {isLinearGradient, isRadialGradient} from '../css/types/image';
import {BACKGROUND_CLIP} from '../css/property-descriptors/background-clip'; import {BACKGROUND_CLIP} from '../css/property-descriptors/background-clip';
export const isFontColorGradient = (styles: CSSParsedDeclaration) => { export const isFontColorGradient = (styles: CSSParsedDeclaration) => {
if (styles.backgroundImage.length === 1 && (isLinearGradient(styles.backgroundImage[0]) || isRadialGradient(styles.backgroundImage[0]))) { if (
return (styles.textFillColor === 0 || styles.color === 0) && styles.backgroundClip.length === 1 && styles.backgroundClip[0] === BACKGROUND_CLIP.TEXT; styles.backgroundImage.length === 1 &&
(isLinearGradient(styles.backgroundImage[0]) || isRadialGradient(styles.backgroundImage[0]))
) {
return (
(styles.textFillColor === 0 || styles.color === 0) &&
styles.backgroundClip.length === 1 &&
styles.backgroundClip[0] === BACKGROUND_CLIP.TEXT
);
} else { } else {
return false; return false;
} }
} };