perf(ivy): remove extra SafeStyle detection code (#32775)

PR Close #32775
This commit is contained in:
Matias Niemelä 2019-09-19 12:59:12 -07:00 committed by Andrew Kushnir
parent 5651fa3a95
commit 52552b0520
2 changed files with 3 additions and 16 deletions

View File

@ -10,7 +10,7 @@ import {RElement} from '../interfaces/renderer';
import {ApplyStylingFn, LStylingData, TStylingConfig, TStylingContext, TStylingContextIndex} from '../interfaces/styling'; import {ApplyStylingFn, LStylingData, TStylingConfig, TStylingContext, TStylingContextIndex} from '../interfaces/styling';
import {getCurrentStyleSanitizer} from '../state'; import {getCurrentStyleSanitizer} from '../state';
import {attachDebugObject} from '../util/debug_utils'; import {attachDebugObject} from '../util/debug_utils';
import {allowDirectStyling as _allowDirectStyling, getDefaultValue, getGuardMask, getProp, getPropValuesStartPosition, getValuesCount, hasConfig, isContextLocked, isMapBased, isSanitizationRequired} from '../util/styling_utils'; import {allowDirectStyling as _allowDirectStyling, getDefaultValue, getGuardMask, getProp, getPropValuesStartPosition, getValuesCount, hasConfig, isContextLocked, isSanitizationRequired} from '../util/styling_utils';
import {applyStylingViaContext} from './bindings'; import {applyStylingViaContext} from './bindings';
import {activateStylingMapFeature} from './map_based_bindings'; import {activateStylingMapFeature} from './map_based_bindings';

View File

@ -166,27 +166,14 @@ export function getPropValuesStartPosition(context: TStylingContext) {
return startPosition; return startPosition;
} }
export function isMapBased(prop: string) {
return prop === MAP_BASED_ENTRY_PROP_NAME;
}
export function hasValueChanged( export function hasValueChanged(
a: NO_CHANGE | StylingMapArray | number | String | string | null | boolean | undefined | {}, a: NO_CHANGE | StylingMapArray | number | String | string | null | boolean | undefined | {},
b: NO_CHANGE | StylingMapArray | number | String | string | null | boolean | undefined | b: NO_CHANGE | StylingMapArray | number | String | string | null | boolean | undefined |
{}): boolean { {}): boolean {
if (b === NO_CHANGE) return false; if (b === NO_CHANGE) return false;
let compareValueA = Array.isArray(a) ? a[StylingMapArrayIndex.RawValuePosition] : a; const compareValueA = Array.isArray(a) ? a[StylingMapArrayIndex.RawValuePosition] : a;
let compareValueB = Array.isArray(b) ? b[StylingMapArrayIndex.RawValuePosition] : b; const compareValueB = Array.isArray(b) ? b[StylingMapArrayIndex.RawValuePosition] : b;
// these are special cases for String based values (which are created as artifacts
// when sanitization is bypassed on a particular value)
if (compareValueA instanceof String) {
compareValueA = compareValueA.toString();
}
if (compareValueB instanceof String) {
compareValueB = compareValueB.toString();
}
return !Object.is(compareValueA, compareValueB); return !Object.is(compareValueA, compareValueB);
} }