diff --git a/apps/App_Resources/Android/AndroidManifest.xml b/apps/App_Resources/Android/AndroidManifest.xml
new file mode 100644
index 000000000..8d827dc8d
--- /dev/null
+++ b/apps/App_Resources/Android/AndroidManifest.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/App_Resources/iOS/Info.plist b/apps/App_Resources/iOS/Info.plist
new file mode 100644
index 000000000..0a8e1eb1f
--- /dev/null
+++ b/apps/App_Resources/iOS/Info.plist
@@ -0,0 +1,66 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleDisplayName
+ ${PRODUCT_NAME}
+ CFBundleExecutable
+ ${EXECUTABLE_NAME}
+ CFBundleIconFile
+ icon.png
+ CFBundleIcons
+
+ CFBundlePrimaryIcon
+
+ CFBundleIconFiles
+
+ icon-40
+ icon-60
+ icon-72
+ icon-76
+ Icon-Small
+ Icon-Small-50
+
+ UIPrerenderedIcon
+
+
+
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ ${PRODUCT_NAME}
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.0
+ LSRequiresIPhoneOS
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIRequiresFullScreen
+
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+
+
diff --git a/apps/css-perf-test/app.ts b/apps/css-perf-test/app.ts
new file mode 100644
index 000000000..3ba20a676
--- /dev/null
+++ b/apps/css-perf-test/app.ts
@@ -0,0 +1,12 @@
+import application = require("application");
+
+global.time = function(): number {
+ if (global.android) {
+ return java.lang.System.nanoTime() / 1000000; // 1 ms = 1000000 ns
+ }
+ else {
+ return CACurrentMediaTime() * 1000;
+ }
+}
+
+application.start({ moduleName: "css-perf-test/root" });
\ No newline at end of file
diff --git a/apps/css-perf-test/main-page.css b/apps/css-perf-test/main-page.css
new file mode 100644
index 000000000..115f58fbc
--- /dev/null
+++ b/apps/css-perf-test/main-page.css
@@ -0,0 +1,29 @@
+.title {
+ font-size: 20;
+ margin: 3;
+}
+
+.author {
+ font-size: 14;
+ horizontal-align: left;
+ vertical-align: bottom;
+ margin: 3;
+}
+
+.comments {
+ color: #10C2B0;
+ font-size: 14;
+ vertical-align: bottom;
+ margin: 3;
+}
+
+.thumbnail {
+ width: 72;
+ height: 72;
+ margin: 3;
+ vertical-align: top;
+}
+
+TabView {
+ background-color: white;
+}
\ No newline at end of file
diff --git a/apps/css-perf-test/main-page.ts b/apps/css-perf-test/main-page.ts
new file mode 100644
index 000000000..0833dcc32
--- /dev/null
+++ b/apps/css-perf-test/main-page.ts
@@ -0,0 +1,7 @@
+import {EventData as ObservableEventData} from "data/observable";
+
+export function navigatedTo(args: ObservableEventData) {
+ setTimeout(() => {
+ console.log(`Time: ${global.time() - global.startTime} ms`);
+ });
+}
\ No newline at end of file
diff --git a/apps/css-perf-test/main-page.xml b/apps/css-perf-test/main-page.xml
new file mode 100644
index 000000000..a66a5ffcd
--- /dev/null
+++ b/apps/css-perf-test/main-page.xml
@@ -0,0 +1,307 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/css-perf-test/main-page2.css b/apps/css-perf-test/main-page2.css
new file mode 100644
index 000000000..115f58fbc
--- /dev/null
+++ b/apps/css-perf-test/main-page2.css
@@ -0,0 +1,29 @@
+.title {
+ font-size: 20;
+ margin: 3;
+}
+
+.author {
+ font-size: 14;
+ horizontal-align: left;
+ vertical-align: bottom;
+ margin: 3;
+}
+
+.comments {
+ color: #10C2B0;
+ font-size: 14;
+ vertical-align: bottom;
+ margin: 3;
+}
+
+.thumbnail {
+ width: 72;
+ height: 72;
+ margin: 3;
+ vertical-align: top;
+}
+
+TabView {
+ background-color: white;
+}
\ No newline at end of file
diff --git a/apps/css-perf-test/res/logo.png b/apps/css-perf-test/res/logo.png
new file mode 100644
index 000000000..de99da231
Binary files /dev/null and b/apps/css-perf-test/res/logo.png differ
diff --git a/apps/css-perf-test/root.ts b/apps/css-perf-test/root.ts
new file mode 100644
index 000000000..b67d9911a
--- /dev/null
+++ b/apps/css-perf-test/root.ts
@@ -0,0 +1,7 @@
+import {Page} from "ui/page";
+
+export function onTap(args: any) {
+ global.startTime = global.time();
+ let page = args.object.page;
+ page.frame.navigate("css-perf-test/main-page");
+}
\ No newline at end of file
diff --git a/apps/css-perf-test/root.xml b/apps/css-perf-test/root.xml
new file mode 100644
index 000000000..6088b5d07
--- /dev/null
+++ b/apps/css-perf-test/root.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/apps/package.json b/apps/package.json
new file mode 100644
index 000000000..aa69f69da
--- /dev/null
+++ b/apps/package.json
@@ -0,0 +1,7 @@
+{ "name" : "Apps",
+ "main" : "css-perf-test/app.js",
+ "android": {
+ "v8Flags":"--expose_gc",
+ "profilerOutputDir": "/sdcard"
+ }
+}
\ No newline at end of file
diff --git a/tests/app/ui/helper.ts b/tests/app/ui/helper.ts
index 4f621ecd0..dc935d79a 100644
--- a/tests/app/ui/helper.ts
+++ b/tests/app/ui/helper.ts
@@ -138,6 +138,16 @@ export function getCurrentPage(): page.Page {
return frame.topmost().currentPage;
}
+export function getClearCurrentPage(): page.Page {
+ let page = frame.topmost().currentPage;
+ page.style._resetValue(styling.properties.backgroundColorProperty);
+ page.style._resetValue(styling.properties.colorProperty);
+ page._resetValue(button.Button.bindingContextProperty);
+ page._resetValue(button.Button.cssClassProperty);
+ page._resetValue(button.Button.idProperty);
+ return page;
+}
+
export function waitUntilNavigatedFrom(oldPage: page.Page) {
TKUnit.waitUntilReady(() => getCurrentPage() && getCurrentPage() !== oldPage);
}
diff --git a/tests/app/ui/styling/style-tests.ts b/tests/app/ui/styling/style-tests.ts
index 23bcfd1f5..beebbb364 100644
--- a/tests/app/ui/styling/style-tests.ts
+++ b/tests/app/ui/styling/style-tests.ts
@@ -143,8 +143,9 @@ export function test_setting_css() {
// Basic selector tests
export function test_type_selector() {
- let page = helper.getCurrentPage();
- page.color = null;
+ let page = helper.getClearCurrentPage();
+ page.style._resetValue(styling.properties.colorProperty);
+
let btn: buttonModule.Button;
let label: labelModule.Label;
@@ -169,8 +170,7 @@ export function test_type_selector() {
}
export function test_class_selector() {
- let page = helper.getCurrentPage();
- page.style._resetValue(styling.properties.colorProperty);
+ let page = helper.getClearCurrentPage();
let btnWithClass: buttonModule.Button;
let btnWithNoClass: buttonModule.Button;
@@ -195,7 +195,7 @@ export function test_class_selector() {
}
export function test_multiple_class_selector() {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
let btnWithClasses: buttonModule.Button;
page.css = ".style1 { color: red; } .style2 { background-color: blue } ";
@@ -213,7 +213,7 @@ export function test_multiple_class_selector() {
}
export function test_id_selector() {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
page.style._resetValue(styling.properties.colorProperty);
let btnWithId: buttonModule.Button;
let btnWithNoId: buttonModule.Button;
@@ -240,7 +240,7 @@ export function test_id_selector() {
// State selector tests
export function test_state_selector() {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
page.style._resetValue(styling.properties.colorProperty);
let btn: buttonModule.Button;
var testStack = new stackModule.StackLayout();
@@ -255,7 +255,7 @@ export function test_state_selector() {
}
export function test_type_and_state_selector() {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
page.style._resetValue(styling.properties.colorProperty);
var btn: buttonModule.Button;
@@ -273,7 +273,7 @@ export function test_type_and_state_selector() {
}
export function test_class_and_state_selector() {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
page.style._resetValue(styling.properties.colorProperty);
let btn = new buttonModule.Button();
@@ -288,7 +288,7 @@ export function test_class_and_state_selector() {
}
export function test_class_and_state_selector_with_multiple_classes() {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
page.style._resetValue(styling.properties.colorProperty);
let btn = new buttonModule.Button();
@@ -304,7 +304,7 @@ export function test_class_and_state_selector_with_multiple_classes() {
}
export function test_id_and_state_selector() {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
page.style._resetValue(styling.properties.colorProperty);
let btn = new buttonModule.Button();
@@ -320,7 +320,7 @@ export function test_id_and_state_selector() {
}
export function test_restore_original_values_when_state_is_changed() {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
page.style._resetValue(styling.properties.colorProperty);
let btn = new buttonModule.Button();
@@ -398,7 +398,7 @@ export var test_composite_selector_type_class_state = function () {
}
export var test_style_is_applied_when_control_is_added_after_load = function () {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
let btn = new buttonModule.Button();
let testStack = new stackModule.StackLayout();
page.content = testStack;
@@ -569,7 +569,7 @@ export function test_selector_priorities_6() {
}
function testSelectorsPrioritiesTemplate(css: string) {
- let page = helper.getCurrentPage();
+ let page = helper.getClearCurrentPage();
page.style._resetValue(styling.properties.colorProperty);
let btn: buttonModule.Button;
let btnWithClass: buttonModule.Button;
diff --git a/tests/package.json b/tests/package.json
index 5ff8662c8..7f48effc3 100644
--- a/tests/package.json
+++ b/tests/package.json
@@ -6,10 +6,10 @@
"nativescript": {
"id": "org.nativescript.tests",
"tns-ios": {
- "version": "2.0.0"
+ "version": "2.1.0"
},
"tns-android": {
- "version": "2.0.0"
+ "version": "2.1.1"
}
},
"dependencies": {
@@ -22,4 +22,4 @@
"filewalker": "0.1.2",
"lazy": "1.0.11"
}
-}
+}
\ No newline at end of file
diff --git a/tns-core-modules/ui/core/dependency-observable.d.ts b/tns-core-modules/ui/core/dependency-observable.d.ts
index d61745e1f..9d23b976c 100644
--- a/tns-core-modules/ui/core/dependency-observable.d.ts
+++ b/tns-core-modules/ui/core/dependency-observable.d.ts
@@ -244,6 +244,7 @@ declare module "ui/core/dependency-observable" {
* Iterates all the properties which have a PropertyEntry registered for this instance.
*/
_eachSetProperty(callback: (property: Property) => boolean): void;
+ _eachSetPropertyValue(callback: (property: Property, value: any) => void): void;
//@endprivate
}
diff --git a/tns-core-modules/ui/core/dependency-observable.ts b/tns-core-modules/ui/core/dependency-observable.ts
index c454e3440..0974bc004 100644
--- a/tns-core-modules/ui/core/dependency-observable.ts
+++ b/tns-core-modules/ui/core/dependency-observable.ts
@@ -303,13 +303,21 @@ export class DependencyObservable extends Observable implements definition.Depen
public _eachSetProperty(callback: (property: Property) => boolean) {
for (let i = 0, keys = Object.keys(this._propertyEntries); i < keys.length; i++) {
let key = keys[i];
- let entry = this._propertyEntries[key];
+ let entry: PropertyEntry = this._propertyEntries[key];
if (!callback(entry.property)) {
break;
}
}
}
+ public _eachSetPropertyValue(callback: (property: Property, value: any) => void): void {
+ for (let i = 0, keys = Object.keys(this._propertyEntries); i < keys.length; i++) {
+ let key = keys[i];
+ let entry: PropertyEntry = this._propertyEntries[key];
+ callback(entry.property, entry.effectiveValue);
+ }
+ }
+
public toString(): string {
return this.typeName;
}
diff --git a/tns-core-modules/ui/core/view-common.ts b/tns-core-modules/ui/core/view-common.ts
index adc9731bb..3e39b0480 100644
--- a/tns-core-modules/ui/core/view-common.ts
+++ b/tns-core-modules/ui/core/view-common.ts
@@ -974,10 +974,8 @@ export class View extends ProxyObject implements definition.View {
public _addViewCore(view: View, atIndex?: number) {
this._propagateInheritableProperties(view);
- view.style._inheritStyleProperties();
-
if (!view._isAddedToNativeVisualTree) {
- var nativeIndex = this._childIndexToNativeChildIndex(atIndex);
+ let nativeIndex = this._childIndexToNativeChildIndex(atIndex);
view._isAddedToNativeVisualTree = this._addViewToNativeVisualTree(view, nativeIndex);
}
@@ -989,6 +987,7 @@ export class View extends ProxyObject implements definition.View {
public _propagateInheritableProperties(view: View) {
view._inheritProperties(this);
+ view.style._inheritStyleProperties(this);
}
public _inheritProperties(parentView: View) {
diff --git a/tns-core-modules/ui/image/image.ios.ts b/tns-core-modules/ui/image/image.ios.ts
index 97965598e..aa9927256 100644
--- a/tns-core-modules/ui/image/image.ios.ts
+++ b/tns-core-modules/ui/image/image.ios.ts
@@ -1,4 +1,4 @@
-import imageCommon = require("./image-common");
+import imageCommon = require("./image-common");
import dependencyObservable = require("ui/core/dependency-observable");
import proxy = require("ui/core/proxy");
import enums = require("ui/enums");
diff --git a/tns-core-modules/ui/styling/style.d.ts b/tns-core-modules/ui/styling/style.d.ts
index dcbc3b192..ee896313a 100644
--- a/tns-core-modules/ui/styling/style.d.ts
+++ b/tns-core-modules/ui/styling/style.d.ts
@@ -87,8 +87,8 @@ declare module "ui/styling/style" {
public _endUpdate();
public _resetCssValues(): void;
public _syncNativeProperties(): void;
- public _inheritStyleProperty(property: Property): void;
- public _inheritStyleProperties(): void;
+ // public _inheritStyleProperty(property: Property): void;
+ public _inheritStyleProperties(parent: View): void;
public _boundsChanged(): void;
public _updateTextDecoration(): void;
public _updateTextTransform(): void;
diff --git a/tns-core-modules/ui/styling/style.ts b/tns-core-modules/ui/styling/style.ts
index 44ccc1376..c82e9a88b 100644
--- a/tns-core-modules/ui/styling/style.ts
+++ b/tns-core-modules/ui/styling/style.ts
@@ -1,4 +1,4 @@
-import application = require("application");
+import application = require("application");
import styling = require("ui/styling");
import types = require("utils/types");
import trace = require("trace");
@@ -351,7 +351,7 @@ function onBackgroundSizePropertyChanged(data: PropertyChangeData) {
}
function onBorderWidthPropertyChanged(data: PropertyChangeData) {
- if (platform.isAndroid){
+ if (platform.isAndroid) {
var style =