Frame test

This commit is contained in:
vakrilov
2017-01-10 14:08:20 +02:00
parent f6b305fcb2
commit f634f29df0
6 changed files with 59 additions and 26 deletions

View File

@@ -69,7 +69,7 @@ export function getViewById(view: ViewBaseDefinition, id: string): ViewBaseDefin
}
return true;
}
};
eachDescendant(view, descendantsCallback);
return retVal;
@@ -87,7 +87,7 @@ export function eachDescendant(view: ViewBaseDefinition, callback: (child: ViewB
child.eachChild(localCallback);
}
return continueIteration;
}
};
view.eachChild(localCallback);
}
@@ -95,7 +95,6 @@ export function eachDescendant(view: ViewBaseDefinition, callback: (child: ViewB
let viewIdCounter = 0;
export class ViewBase extends Observable implements ViewBaseDefinition {
private _updatingJSPropertiesDict = {};
private _style: Style;
private _isLoaded: boolean;
private _registeredAnimations: Array<KeyframeAnimation>;
@@ -225,7 +224,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
next.changeMap.forEach((changes, view) => {
if (changes.attributes) {
changes.attributes.forEach(attribute => {
view.addEventListener(attribute + "Change", this._invalidateCssHandler)
view.addEventListener(attribute + "Change", this._invalidateCssHandler);
});
}
if (changes.pseudoClasses) {
@@ -244,13 +243,13 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
previous.changeMap.forEach((changes, view) => {
if (changes.attributes) {
changes.attributes.forEach(attribute => {
view.removeEventListener("onPropertyChanged:" + attribute, this._invalidateCssHandler)
view.removeEventListener("onPropertyChanged:" + attribute, this._invalidateCssHandler);
});
}
if (changes.pseudoClasses) {
changes.pseudoClasses.forEach(pseudoClass => {
let eventName = ":" + pseudoClass;
view.removeEventListener(eventName, this._invalidateCssHandler)
view.removeEventListener(eventName, this._invalidateCssHandler);
if (view[eventName]) {
view[eventName](-1);
}

View File

@@ -685,7 +685,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
let style = child.style;
let horizontalMargins = child.effectiveMarginLeft + child.effectiveMarginRight;
let verticalMargins = child.effectiveMarginTop + child.effectiveMarginRight;
let verticalMargins = child.effectiveMarginTop + child.effectiveMarginBottom;
let childWidthMeasureSpec = ViewCommon.getMeasureSpec(width, widthMode, horizontalMargins, child.effectiveWidth, style.horizontalAlignment === HorizontalAlignment.STRETCH);
let childHeightMeasureSpec = ViewCommon.getMeasureSpec(height, heightMode, verticalMargins, child.effectiveHeight, style.verticalAlignment === VerticalAlignment.STRETCH);

View File

@@ -183,7 +183,7 @@ export class Page extends PageBase {
return {
color: (<any>window).getStatusBarColor(),
systemUiVisibility: decorView.getSystemUiVisibility()
}
};
}
return null;

View File

@@ -1,7 +1,7 @@
import {
PageBase, View, layout,
actionBarHiddenProperty, statusBarStyleProperty,
traceEnabled, traceWrite, traceCategories
traceEnabled, traceWrite, traceCategories, PercentLength
} from "./page-common";
import { ios as iosApp } from "application";
import { device } from "platform";
@@ -476,6 +476,23 @@ export class Page extends PageBase {
}
}
public _updateEffectiveLayoutValues(parent: View): void {
super._updateEffectiveLayoutValues(parent);
// Patch vertical margins to respect status bar height
if (!this.backgroundSpanUnderStatusBar) {
const style = this.style;
let parentHeightMeasureSpec = parent._currentHeightMeasureSpec;
let parentHeightMeasureSize = layout.getMeasureSpecSize(parentHeightMeasureSpec) - uiUtils.ios.getStatusBarHeight();
let parentHeightMeasureMode = layout.getMeasureSpecMode(parentHeightMeasureSpec);
let parentAvailableHeight = parentHeightMeasureMode === layout.UNSPECIFIED ? -1 : parentHeightMeasureSize;
this.effectiveMarginTop = PercentLength.toDevicePixels(style.marginTop, 0, parentAvailableHeight);
this.effectiveMarginBottom = PercentLength.toDevicePixels(style.marginBottom, 0, parentAvailableHeight);
}
}
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number) {
let width = layout.getMeasureSpecSize(widthMeasureSpec);
let widthMode = layout.getMeasureSpecMode(widthMeasureSpec);