Merge pull request #965 from NativeScript/feature/perf-optimizations

Don't apply default values on syncNative
This commit is contained in:
Alexander Vakrilov
2015-10-21 15:31:13 +03:00
2 changed files with 6 additions and 1 deletions

View File

@ -249,6 +249,10 @@ export class View extends viewCommon.View {
trace.write("calling _onContextChanged on view " + this._domId, trace.categories.VisualTreeEvents); trace.write("calling _onContextChanged on view " + this._domId, trace.categories.VisualTreeEvents);
this._createUI(); this._createUI();
// Ensure layout params
if (this._nativeView && !(this._nativeView.getLayoutParams() instanceof org.nativescript.widgets.CommonLayoutParams)) {
this._nativeView.setLayoutParams(new org.nativescript.widgets.CommonLayoutParams());
}
utils.copyFrom(this._options, this); utils.copyFrom(this._options, this);
delete this._options; delete this._options;

View File

@ -593,7 +593,8 @@ export class Style extends DependencyObservable implements styling.Style {
// TODO: Potential performance bottle-neck // TODO: Potential performance bottle-neck
styleProperty.eachProperty(function (p: styleProperty.Property) { styleProperty.eachProperty(function (p: styleProperty.Property) {
var value = that._getValue(p); var value = that._getValue(p);
if (types.isDefined(value)) { var valueSource = that._getValueSource(p);
if (valueSource !== ValueSource.Default && types.isDefined(value)) {
that._applyProperty(p, value); that._applyProperty(p, value);
} }
}); });