Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion packages/core/debugger/dom-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,37 @@ import { PercentLength } from '../ui/styling/length-shared';
import { getSetProperties, getComputedCssValues } from '../ui/core/properties';
const ELEMENT_NODE_TYPE = 1;
const ROOT_NODE_TYPE = 9;
const propertyBlacklist = ['effectivePaddingLeft', 'effectivePaddingBottom', 'effectivePaddingRight', 'effectivePaddingTop', 'effectiveBorderTopWidth', 'effectiveBorderRightWidth', 'effectiveBorderBottomWidth', 'effectiveBorderLeftWidth', 'effectiveMinWidth', 'effectiveMinHeight', 'effectiveWidth', 'effectiveHeight', 'effectiveMarginLeft', 'effectiveMarginTop', 'effectiveMarginRight', 'effectiveMarginBottom', 'effectiveRowGap', 'effectiveColumnGap', 'nodeName', 'nodeType', 'decodeWidth', 'decodeHeight', 'ng-reflect-items', 'domNode', 'touchListenerIsSet', 'bindingContext', 'nativeView'];
const propertyBlacklist = [
'effectivePaddingLeft',
'effectivePaddingBottom',
'effectivePaddingRight',
'effectivePaddingTop',
'effectiveBorderTopWidth',
'effectiveBorderRightWidth',
'effectiveBorderBottomWidth',
'effectiveBorderLeftWidth',
'effectiveMinWidth',
'effectiveMinHeight',
'effectiveMaxWidth',
'effectiveMaxHeight',
'effectiveWidth',
'effectiveHeight',
'effectiveMarginLeft',
'effectiveMarginTop',
'effectiveMarginRight',
'effectiveMarginBottom',
'effectiveRowGap',
'effectiveColumnGap',
'nodeName',
'nodeType',
'decodeWidth',
'decodeHeight',
'ng-reflect-items',
'domNode',
'touchListenerIsSet',
'bindingContext',
'nativeView',
];

function lazy<T>(action: () => T): () => T {
let _value: T;
Expand Down
23 changes: 12 additions & 11 deletions packages/core/ui/core/view-base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ export abstract class ViewBase extends Observable {
private _style: Style;
private _isLoaded: boolean;

/**
* if _setupAsRootView is called it means it is not supposed to be
* added to a parent. However parent can be set before for the purpose
* of CSS variables/classes. That variable ensures that _addViewToNativeVisualTree
* is not called in _setupAsRootView
*/
private _isRootView = false;

private _effectivePaddingTop: number = null;
private _effectivePaddingRight: number = null;
private _effectivePaddingBottom: number = null;
Expand Down Expand Up @@ -1147,17 +1155,10 @@ export abstract class ViewBase extends Observable {
// }
}

/**
* if _setupAsRootView is called it means it is not supposed to be
* added to a parent. However parent can be set before for the purpose
* of CSS variables/classes. That variable ensures that _addViewToNativeVisualTree
* is not called in _setupAsRootView
*/
mIsRootView = false;
_setupAsRootView(context: any): void {
this.mIsRootView = true;
this._isRootView = true;
this._setupUI(context);
this.mIsRootView = false;
this._isRootView = false;
}

/**
Expand All @@ -1170,7 +1171,7 @@ export abstract class ViewBase extends Observable {
// this check is unnecessary as this function should never be called when this._context === context as it means the view was somehow detached,
// which is only possible by setting reusable = true. Adding it either way for feature flag safety
if (this.reusable) {
if (!this.mIsRootView && this.parent && !this._isAddedToNativeVisualTree) {
if (!this._isRootView && this.parent && !this._isAddedToNativeVisualTree) {
const nativeIndex = this.parent._childIndexToNativeChildIndex(atIndex);
this._isAddedToNativeVisualTree = this.parent._addViewToNativeVisualTree(this, nativeIndex);
}
Expand Down Expand Up @@ -1228,7 +1229,7 @@ export abstract class ViewBase extends Observable {

this.setNativeView(nativeView);

if (!this.mIsRootView && this.parent) {
if (!this._isRootView && this.parent) {
const nativeIndex = this.parent._childIndexToNativeChildIndex(atIndex);
this._isAddedToNativeVisualTree = this.parent._addViewToNativeVisualTree(this, nativeIndex);
}
Expand Down
Loading