Skip to content

Commit

Permalink
fixup! refactor(ivy): remove TStylingContext locking in favor of firs…
Browse files Browse the repository at this point in the history
…tUpdatePass flag
  • Loading branch information
matsko committed Nov 5, 2019
1 parent 6ec6224 commit 9be823a
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/core/src/render3/instructions/styling.ts
Expand Up @@ -154,10 +154,9 @@ function stylingProp(
let updated = false;

const lView = getLView();
const firstUpdatePass = lView[TVIEW].firstUpdatePass;
const tNode = getTNode(elementIndex, lView);
const tView = lView[TVIEW];
const native = getNativeByTNode(tNode, lView) as RElement;
const firstUpdatePass = tView.firstUpdatePass;
const context = isClassBased ? getClassesContext(tNode) : getStylesContext(tNode);
const sanitizer = isClassBased ? null : getCurrentStyleSanitizer();

Expand Down Expand Up @@ -237,7 +236,7 @@ export function ɵɵstyleMap(styles: {[styleName: string]: any} | NO_CHANGE | nu
const index = getSelectedIndex();
const lView = getLView();
const tNode = getTNode(index, lView);
const tView = lView[TVIEW];
const firstUpdatePass = lView[TVIEW].firstUpdatePass;
const context = getStylesContext(tNode);
const hasDirectiveInput = hasStyleInput(tNode);

Expand All @@ -251,13 +250,12 @@ export function ɵɵstyleMap(styles: {[styleName: string]: any} | NO_CHANGE | nu
// there should not be a situation where a directive host bindings function
// evaluates the inputs (this should only happen in the template function)
if (!isHostStyling() && hasDirectiveInput && styles !== NO_CHANGE) {
updateDirectiveInputValue(
context, lView, tNode, bindingIndex, styles, false, tView.firstUpdatePass);
updateDirectiveInputValue(context, lView, tNode, bindingIndex, styles, false, firstUpdatePass);
styles = NO_CHANGE;
}

stylingMap(
context, tNode, tView.firstUpdatePass, lView, bindingIndex, styles, false, hasDirectiveInput);
context, tNode, firstUpdatePass, lView, bindingIndex, styles, false, hasDirectiveInput);
}

/**
Expand Down Expand Up @@ -292,7 +290,7 @@ export function classMapInternal(
elementIndex: number, classes: {[className: string]: any} | NO_CHANGE | string | null): void {
const lView = getLView();
const tNode = getTNode(elementIndex, lView);
const tView = lView[TVIEW];
const firstUpdatePass = lView[TVIEW].firstUpdatePass;
const context = getClassesContext(tNode);
const hasDirectiveInput = hasClassInput(tNode);

Expand All @@ -306,13 +304,12 @@ export function classMapInternal(
// there should not be a situation where a directive host bindings function
// evaluates the inputs (this should only happen in the template function)
if (!isHostStyling() && hasDirectiveInput && classes !== NO_CHANGE) {
updateDirectiveInputValue(
context, lView, tNode, bindingIndex, classes, true, tView.firstUpdatePass);
updateDirectiveInputValue(context, lView, tNode, bindingIndex, classes, true, firstUpdatePass);
classes = NO_CHANGE;
}

stylingMap(
context, tNode, tView.firstUpdatePass, lView, bindingIndex, classes, true, hasDirectiveInput);
context, tNode, firstUpdatePass, lView, bindingIndex, classes, true, hasDirectiveInput);
}

/**
Expand Down

0 comments on commit 9be823a

Please sign in to comment.