@@ -55,7 +55,7 @@
type="button"
value="History"
style="border-width: 3px; margin-left: 10px; border-color: #90ee90; width: 146px; height: 50px"
- onclick="openHistroy"
+ onclick="openHistory"
/>
+
diff --git a/examples/calculator/src/main/js/default/pages/index/index.js b/frameworks/examples/calculator/src/main/js/default/pages/index/index.js
similarity index 73%
rename from examples/calculator/src/main/js/default/pages/index/index.js
rename to frameworks/examples/calculator/src/main/js/default/pages/index/index.js
index 30fd21a..0d374ca 100644
--- a/examples/calculator/src/main/js/default/pages/index/index.js
+++ b/frameworks/examples/calculator/src/main/js/default/pages/index/index.js
@@ -1,3 +1,17 @@
+/*
+ * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import {calc, isOperator} from '../../common/calculator.js';
import app from '@system.app';
diff --git a/examples/music/src/main/config.json b/frameworks/examples/music/src/main/config.json
old mode 100755
new mode 100644
similarity index 97%
rename from examples/music/src/main/config.json
rename to frameworks/examples/music/src/main/config.json
index c312fec..cf48482
--- a/examples/music/src/main/config.json
+++ b/frameworks/examples/music/src/main/config.json
@@ -17,7 +17,6 @@
},
"module": {
"deviceType": [
- "liteWearable",
"smartVision"
],
"abilities": [
diff --git a/examples/music/src/main/js/default/app.js b/frameworks/examples/music/src/main/js/default/app.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/app.js
rename to frameworks/examples/music/src/main/js/default/app.js
diff --git a/examples/music/src/main/js/default/common/ic_back.png b/frameworks/examples/music/src/main/js/default/common/ic_back.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_back.png
rename to frameworks/examples/music/src/main/js/default/common/ic_back.png
diff --git a/examples/music/src/main/js/default/common/ic_music_list.png b/frameworks/examples/music/src/main/js/default/common/ic_music_list.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_list.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_list.png
diff --git a/examples/music/src/main/js/default/common/ic_music_listcycle.png b/frameworks/examples/music/src/main/js/default/common/ic_music_listcycle.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_listcycle.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_listcycle.png
diff --git a/examples/music/src/main/js/default/common/ic_music_listorder.png b/frameworks/examples/music/src/main/js/default/common/ic_music_listorder.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_listorder.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_listorder.png
diff --git a/examples/music/src/main/js/default/common/ic_music_mode.png b/frameworks/examples/music/src/main/js/default/common/ic_music_mode.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_mode.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_mode.png
diff --git a/examples/music/src/main/js/default/common/ic_music_next.png b/frameworks/examples/music/src/main/js/default/common/ic_music_next.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_next.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_next.png
diff --git a/examples/music/src/main/js/default/common/ic_music_pause.png b/frameworks/examples/music/src/main/js/default/common/ic_music_pause.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_pause.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_pause.png
diff --git a/examples/music/src/main/js/default/common/ic_music_play.png b/frameworks/examples/music/src/main/js/default/common/ic_music_play.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_play.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_play.png
diff --git a/examples/music/src/main/js/default/common/ic_music_previous.png b/frameworks/examples/music/src/main/js/default/common/ic_music_previous.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_previous.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_previous.png
diff --git a/examples/music/src/main/js/default/common/ic_music_shuffle.png b/frameworks/examples/music/src/main/js/default/common/ic_music_shuffle.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_shuffle.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_shuffle.png
diff --git a/examples/music/src/main/js/default/common/ic_music_singlecycle.png b/frameworks/examples/music/src/main/js/default/common/ic_music_singlecycle.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/js/default/common/ic_music_singlecycle.png
rename to frameworks/examples/music/src/main/js/default/common/ic_music_singlecycle.png
diff --git a/examples/music/src/main/js/default/pages/index/index.css b/frameworks/examples/music/src/main/js/default/pages/index/index.css
old mode 100755
new mode 100644
similarity index 99%
rename from examples/music/src/main/js/default/pages/index/index.css
rename to frameworks/examples/music/src/main/js/default/pages/index/index.css
index 03120ba..0064160
--- a/examples/music/src/main/js/default/pages/index/index.css
+++ b/frameworks/examples/music/src/main/js/default/pages/index/index.css
@@ -56,7 +56,7 @@
text-align: center;
}
-.songer {
+.singer {
width: 114px;
height: 42px;
margin-left: 423px;
diff --git a/examples/music/src/main/js/default/pages/index/index.hml b/frameworks/examples/music/src/main/js/default/pages/index/index.hml
old mode 100755
new mode 100644
similarity index 95%
rename from examples/music/src/main/js/default/pages/index/index.hml
rename to frameworks/examples/music/src/main/js/default/pages/index/index.hml
index f2596b7..9efaf65
--- a/examples/music/src/main/js/default/pages/index/index.hml
+++ b/frameworks/examples/music/src/main/js/default/pages/index/index.hml
@@ -20,7 +20,7 @@ limitations under the License.
音乐
-
+
{{curMusic.playTime}}
@@ -44,7 +44,7 @@ limitations under the License.
{{$item.name}}
- {{$item.songer}}
+ {{$item.singer}}
diff --git a/examples/music/src/main/js/default/pages/index/index.js b/frameworks/examples/music/src/main/js/default/pages/index/index.js
old mode 100755
new mode 100644
similarity index 97%
rename from examples/music/src/main/js/default/pages/index/index.js
rename to frameworks/examples/music/src/main/js/default/pages/index/index.js
index 22cce37..df8efb9
--- a/examples/music/src/main/js/default/pages/index/index.js
+++ b/frameworks/examples/music/src/main/js/default/pages/index/index.js
@@ -30,7 +30,7 @@ export default {
playStatus: 2, //0:play,1:pause,2:stop
curMusic: { //current music info
curMusicName: "",
- songer: "",
+ singer: "",
playTime: "00:00",
allTime: "00:00"
},
@@ -45,6 +45,9 @@ export default {
};
//update play progress
audio.ontimeupdate = () => {
+ if (audio.duration == null || audio.duration <= 0) {
+ return;
+ }
console.log("ontime update:");
this.curMusic.playTime = this.timeChange(audio.currentTime);
console.log("ontime update:" + this.curMusic.playTime);
@@ -126,7 +129,7 @@ export default {
if (music != null) {
this.playProgress = 0;
this.curMusic.curMusicName = music.name;
- this.curMusic.songer = music.songer;
+ this.curMusic.singer = music.singer;
audio.src = music.src;
console.log("playMusic:src:" + music.src);
audio.play();
@@ -181,7 +184,7 @@ export default {
console.log("ChangeSong:next" + this.curMusicIndex);
}
this.curMusic.curMusicName = this.musicList[this.curMusicIndex].name;
- this.curMusic.songer = this.musicList[this.curMusicIndex].songer;
+ this.curMusic.singer = this.musicList[this.curMusicIndex].singer;
this.playMusic(this.curMusicIndex);
if(this.showMusicList){
this.$refs.musicList.scrollTo({ index: (this.curMusicIndex == 0?0:this.curMusicIndex-1) });
diff --git a/examples/music/src/main/resources/base/media/icon.png b/frameworks/examples/music/src/main/resources/base/media/icon.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/resources/base/media/icon.png
rename to frameworks/examples/music/src/main/resources/base/media/icon.png
diff --git a/examples/music/src/main/resources/base/media/icon_small.png b/frameworks/examples/music/src/main/resources/base/media/icon_small.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/music/src/main/resources/base/media/icon_small.png
rename to frameworks/examples/music/src/main/resources/base/media/icon_small.png
diff --git a/examples/showcase/src/main/config.json b/frameworks/examples/showcase/src/main/config.json
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/config.json
rename to frameworks/examples/showcase/src/main/config.json
index 3500860..d030d3b
--- a/examples/showcase/src/main/config.json
+++ b/frameworks/examples/showcase/src/main/config.json
@@ -13,7 +13,7 @@
},
"deviceConfig": {},
"module": {
- "deviceType": ["liteWearable", "smartVision"],
+ "deviceType": ["smartVision"],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
diff --git a/examples/showcase/src/main/js/default/app.js b/frameworks/examples/showcase/src/main/js/default/app.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/app.js
rename to frameworks/examples/showcase/src/main/js/default/app.js
diff --git a/examples/showcase/src/main/js/default/common/js/chart.js b/frameworks/examples/showcase/src/main/js/default/common/js/chart.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/chart.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/chart.js
diff --git a/examples/showcase/src/main/js/default/common/js/general.js b/frameworks/examples/showcase/src/main/js/default/common/js/general.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/general.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/general.js
diff --git a/examples/showcase/src/main/js/default/common/js/image.js b/frameworks/examples/showcase/src/main/js/default/common/js/image.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/image.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/image.js
diff --git a/examples/showcase/src/main/js/default/common/js/input.js b/frameworks/examples/showcase/src/main/js/default/common/js/input.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/input.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/input.js
diff --git a/examples/showcase/src/main/js/default/common/js/list.js b/frameworks/examples/showcase/src/main/js/default/common/js/list.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/list.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/list.js
diff --git a/examples/showcase/src/main/js/default/common/js/marquee.js b/frameworks/examples/showcase/src/main/js/default/common/js/marquee.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/marquee.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/marquee.js
diff --git a/examples/showcase/src/main/js/default/common/js/picker_view.js b/frameworks/examples/showcase/src/main/js/default/common/js/picker_view.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/picker_view.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/picker_view.js
diff --git a/examples/showcase/src/main/js/default/common/js/progress.js b/frameworks/examples/showcase/src/main/js/default/common/js/progress.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/progress.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/progress.js
diff --git a/examples/showcase/src/main/js/default/common/js/stack.js b/frameworks/examples/showcase/src/main/js/default/common/js/stack.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/stack.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/stack.js
diff --git a/examples/showcase/src/main/js/default/common/js/swiper.js b/frameworks/examples/showcase/src/main/js/default/common/js/swiper.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/swiper.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/swiper.js
diff --git a/examples/showcase/src/main/js/default/common/js/text.js b/frameworks/examples/showcase/src/main/js/default/common/js/text.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/js/text.js
rename to frameworks/examples/showcase/src/main/js/default/common/js/text.js
diff --git a/examples/showcase/src/main/js/default/common/leftHead.png b/frameworks/examples/showcase/src/main/js/default/common/leftHead.png
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/common/leftHead.png
rename to frameworks/examples/showcase/src/main/js/default/common/leftHead.png
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation1/animation1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation2/animation2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation3/animation3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation4/animation4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation5/animation5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation6/animation6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/animation7/animation7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index1/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index1/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index1/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index1/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index1/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index1/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index1/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index1/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index1/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index1/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index1/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index1/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index2/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index2/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index2/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index2/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index2/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index2/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index2/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index2/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/animation/index2/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/animation/index2/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/animation/index2/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/animation/index2/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.css
index 37a167c..1349468
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.css
@@ -18,5 +18,5 @@
height: 50px;
margin-top: 10px;
margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
}
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.hml
new file mode 100644
index 0000000..57cc334
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.hml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ text1 }}
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas1/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.css
index 37a167c..1349468
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.css
@@ -18,5 +18,5 @@
height: 50px;
margin-top: 10px;
margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
}
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.hml
new file mode 100644
index 0000000..7067c31
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.hml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ text1 }}
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.css
index 37a167c..1349468
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas2/index.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.css
@@ -18,5 +18,5 @@
height: 50px;
margin-top: 10px;
margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
}
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.hml
new file mode 100644
index 0000000..6c63498
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.hml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ text1 }}
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas3/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.css
old mode 100755
new mode 100644
similarity index 92%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.css
index 999830a..5ecae92
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.css
@@ -16,9 +16,7 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
}
.stack {
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.hml
old mode 100755
new mode 100644
similarity index 53%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.hml
index 0ea7e02..4d86787
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.hml
@@ -14,18 +14,18 @@ limitations under the License.
-->
-
-
-
+
+
+
-
-
+
+
{{ text1 }}
-
+
{{ text2 }}
-
+
{{ text3 }}
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas4/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.css
index 3412d2e..fbc215c
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.css
@@ -18,7 +18,7 @@
height: 50px;
margin-top: 10px;
margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
border-width: 1px;
border-color: red;
}
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.hml
new file mode 100644
index 0000000..6b51687
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.hml
@@ -0,0 +1,31 @@
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas5/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.css
index 285f457..b20c2ce
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.css
@@ -18,5 +18,5 @@
height: 50px;
margin-top: 10px;
margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.hml
old mode 100755
new mode 100644
similarity index 53%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.hml
index eadc0d4..cbf6c59
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.hml
@@ -13,29 +13,29 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
-
+
+
+
+
-
-
+
+
{{ text1 }}
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas6/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.css
index 818750a..aae6f49
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.css
@@ -18,7 +18,7 @@
height: 50px;
margin-bottom: 10px;
margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
border-width: 1px;
border-color: red;
}
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.hml
new file mode 100644
index 0000000..6de5625
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas7/index.hml
@@ -0,0 +1,44 @@
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas8/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas8/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas8/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas8/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.css
old mode 100755
new mode 100644
similarity index 92%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.css
index 21072ca..8611914
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.css
@@ -23,8 +23,6 @@
.text {
width: 400px;
height: 100px;
- margin-top: 10px;
- margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
text-overflow: ellipsis;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.hml
old mode 100755
new mode 100644
similarity index 52%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.hml
index fb6c531..735f17d
--- a/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.hml
@@ -14,21 +14,21 @@ limitations under the License.
-->
-
-
-
+
+
+
-
+
{{ text1 }}
- 矩形为canvas组件
- 点击/长按/滑动canvas内部任意位置触发事件
+ 矩形为canvas组件
+ 点击/长按/滑动canvas内部任意位置触发事件
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/canvas9/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/index/index.hml
old mode 100755
new mode 100644
similarity index 75%
rename from examples/showcase/src/main/js/default/pages/component/canvas/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/index/index.hml
index c7dc122..07697b1
--- a/examples/showcase/src/main/js/default/pages/component/canvas/index/index.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/index/index.hml
@@ -13,12 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.hml
old mode 100755
new mode 100644
similarity index 70%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.hml
index a1e8587..5a5e40c
--- a/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.hml
@@ -13,12 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPI/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.css
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.hml
new file mode 100644
index 0000000..f586bce
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.hml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+ canvas属性接口
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.css
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.hml
new file mode 100644
index 0000000..6e5a13c
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.hml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+ canvas绘图接口
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAPIDraw/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.css
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.hml
new file mode 100644
index 0000000..584cebb
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.hml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+ canvas通用属性
+
+
+
+
+ show
+
+
+
+
+
+
+ if
+
+
+
+
+
+
+ for
+
+
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.css
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.hml
new file mode 100644
index 0000000..9c1aea6
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.hml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+ canvas通用样式
+
+
+
+
+ 背景色
+ left
+ top
+
+
+
+
+
+
+ margin
+ height
+ width
+
+
+
+
+
+
+ border
+ padding
+
+
+
+
+
+
+ margin-left
+ margin-top
+ margin-right
+ margin-bottom
+
+
+
+
+
+
+ display
+
+
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexCommonStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.css
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.hml
new file mode 100644
index 0000000..83cf172
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.hml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+ canvas通用事件
+
+
+
+
+ click
+ longpress
+ swipe
+
+
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/canvas/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart1/barChart1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.css
index 7a5644b..213527d
--- a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.css
@@ -22,7 +22,5 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.hml
old mode 100755
new mode 100644
similarity index 92%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.hml
index 762e7b1..b801d01
--- a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.hml
@@ -15,8 +15,8 @@ limitations under the License.
-
-
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart2/barChart2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart3/barChart3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart4/barChart4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart5/barChart5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart6/barChart6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart7/barChart7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/barChart8/barChart8.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/barChart/indexStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/indexStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart1/lineChart1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.css
index 7a5644b..213527d
--- a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.css
@@ -22,7 +22,5 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.hml
old mode 100755
new mode 100644
similarity index 91%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.hml
index efae822..90dd530
--- a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.hml
@@ -15,8 +15,8 @@ limitations under the License.
-
-
+
+
@@ -29,4 +29,4 @@ limitations under the License.
{{text3}}
-
+
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart2/lineChart2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart3/lineChart3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart4/lineChart4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart5/lineChart5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart6/lineChart6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart7/lineChart7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.js b/frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/chart/lineChart/lineChart8/lineChart8.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div1/div1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div1/div1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div1/div1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div1/div1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div1/div1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div1/div1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div1/div1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div1/div1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div1/div1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div1/div1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div1/div1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div1/div1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div10/div10.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div10/div10.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div10/div10.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div10/div10.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div10/div10.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div10/div10.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div10/div10.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div10/div10.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div10/div10.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div10/div10.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div10/div10.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div10/div10.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div11/div11.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div11/div11.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div11/div11.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div11/div11.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div11/div11.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div11/div11.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div11/div11.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div11/div11.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div11/div11.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div11/div11.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div11/div11.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div11/div11.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div12/div12.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div12/div12.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div12/div12.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div12/div12.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div12/div12.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div12/div12.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div12/div12.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div12/div12.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div12/div12.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div12/div12.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div12/div12.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div12/div12.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div2/div2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div2/div2.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/div/div2/div2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div2/div2.css
index 7a5644b..213527d
--- a/examples/showcase/src/main/js/default/pages/component/div/div2/div2.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div2/div2.css
@@ -22,7 +22,5 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div2/div2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div2/div2.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div2/div2.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div2/div2.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div2/div2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div2/div2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div2/div2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div2/div2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div3/div3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div3/div3.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div3/div3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div3/div3.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div3/div3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div3/div3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div3/div3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div3/div3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div3/div3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div3/div3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div3/div3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div3/div3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div4/div4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div4/div4.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div4/div4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div4/div4.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div4/div4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div4/div4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div4/div4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div4/div4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div4/div4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div4/div4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div4/div4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div4/div4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div5/div5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div5/div5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div5/div5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div5/div5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div5/div5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div5/div5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div5/div5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div5/div5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div5/div5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div5/div5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div5/div5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div5/div5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div6/div6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div6/div6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div6/div6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div6/div6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div6/div6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div6/div6.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div6/div6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div6/div6.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div6/div6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div6/div6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div6/div6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div6/div6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div7/div7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div7/div7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div7/div7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div7/div7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div7/div7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div7/div7.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div7/div7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div7/div7.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div7/div7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div7/div7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div7/div7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div7/div7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div8/div8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div8/div8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div8/div8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div8/div8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div8/div8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div8/div8.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div8/div8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div8/div8.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div8/div8.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div8/div8.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div8/div8.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div8/div8.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div9/div9.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div9/div9.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div9/div9.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div9/div9.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div9/div9.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div9/div9.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div9/div9.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div9/div9.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/div9/div9.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/div9/div9.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/div9/div9.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/div9/div9.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexCommonStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/div/indexSpecStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image1/image1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image1/image1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image1/image1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image1/image1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image1/image1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image1/image1.hml
old mode 100755
new mode 100644
similarity index 91%
rename from examples/showcase/src/main/js/default/pages/component/image/image1/image1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image1/image1.hml
index 953d8f9..516e709
--- a/examples/showcase/src/main/js/default/pages/component/image/image1/image1.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image1/image1.hml
@@ -15,8 +15,8 @@ limitations under the License.
-
-
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image1/image1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image1/image1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image1/image1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image1/image1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image2/image2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image2/image2.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image2/image2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image2/image2.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image2/image2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image2/image2.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image2/image2.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image2/image2.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image2/image2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image2/image2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image2/image2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image2/image2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image3/image3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image3/image3.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/image/image3/image3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image3/image3.css
index c56bf1d..66bbf1d
--- a/examples/showcase/src/main/js/default/pages/component/image/image3/image3.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image3/image3.css
@@ -15,8 +15,6 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image3/image3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image3/image3.hml
old mode 100755
new mode 100644
similarity index 90%
rename from examples/showcase/src/main/js/default/pages/component/image/image3/image3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image3/image3.hml
index db3f5e3..8245e76
--- a/examples/showcase/src/main/js/default/pages/component/image/image3/image3.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image3/image3.hml
@@ -15,12 +15,12 @@ limitations under the License.
-
-
+
+
{{text1}}
-
+
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image3/image3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image3/image3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image3/image3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image3/image3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image4/image4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image4/image4.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image4/image4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image4/image4.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image4/image4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image4/image4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image4/image4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image4/image4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image4/image4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image4/image4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image4/image4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image4/image4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image5/image5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image5/image5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image5/image5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image5/image5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image5/image5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image5/image5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image5/image5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image5/image5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image5/image5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image5/image5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image5/image5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image5/image5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image6/image6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image6/image6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image6/image6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image6/image6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image6/image6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image6/image6.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image6/image6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image6/image6.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image6/image6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image6/image6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image6/image6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image6/image6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image7/image7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image7/image7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image7/image7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image7/image7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image7/image7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image7/image7.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image7/image7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image7/image7.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image7/image7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image7/image7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image7/image7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image7/image7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image8/image8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image8/image8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image8/image8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image8/image8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image8/image8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image8/image8.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image8/image8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image8/image8.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/image8/image8.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/image8/image8.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/image8/image8.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/image8/image8.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/image/indexStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/baseIndex/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/containerIndex/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/formIndex/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/formIndex/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/formIndex/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/formIndex/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/index/otherIndex/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.css
index a842ca3..81fe2e5
--- a/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.css
@@ -67,23 +67,18 @@
.two-right-div {
width: 230px;
height: 150px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 150px;
- left: 0px;
- top: 0px;
+
flex-direction: column;
}
.two-div {
width: 450px;
height: 150px;
- left: 0px;
- top: 0px;
}
.item-attribute {
@@ -92,8 +87,6 @@
}
.attribute-div {
- left: 0px;
- top: 0px;
height: 100px;
width: 450px;
flex-direction: row;
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/attr/attr.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/event/event.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/event/event.css
old mode 100755
new mode 100644
similarity index 95%
rename from examples/showcase/src/main/js/default/pages/component/input/button/event/event.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/event/event.css
index 4e4ae1c..b587ee2
--- a/examples/showcase/src/main/js/default/pages/component/input/button/event/event.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/event/event.css
@@ -67,23 +67,17 @@
.two-right-div {
width: 230px;
height: 200px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.text2 {
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/event/event.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/event/event.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/event/event.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/event/event.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/event/event.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/event/event.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/event/event.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/event/event.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/style/style.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/style/style.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/style/style.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/style/style.css
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/style/style.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/style/style.hml
old mode 100755
new mode 100644
similarity index 99%
rename from examples/showcase/src/main/js/default/pages/component/input/button/style/style.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/style/style.hml
index 8ebc5e3..33d7a52
--- a/examples/showcase/src/main/js/default/pages/component/input/button/style/style.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/style/style.hml
@@ -45,7 +45,7 @@ limitations under the License.
width
-
+
diff --git a/examples/showcase/src/main/js/default/pages/component/input/button/style/style.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/button/style/style.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/button/style/style.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/button/style/style.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.css
old mode 100755
new mode 100644
similarity index 95%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.css
index f46f348..976ade6
--- a/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.css
@@ -67,23 +67,17 @@
.two-right-div {
width: 230px;
height: 150px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 150px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-div {
width: 450px;
height: 150px;
- left: 0px;
- top: 0px;
}
.item-attribute {
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/attr/attr.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.css
old mode 100755
new mode 100644
similarity index 91%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.css
index 910baf8..1a67856
--- a/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.css
@@ -76,23 +76,17 @@
.two-right-div {
width: 230px;
height: 200px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.item-change {
@@ -101,22 +95,16 @@
}
.change-div {
- left: 0px;
width: 450px;
height: 200px;
- top: 0px;
}
.change-left-div {
- left: 10px;
width: 200px;
height: 200px;
- top: 20px;
}
.change-right-div {
- left: 10px;
- top: 10px;
width: 250px;
height: 200px;
flex-direction: column;
@@ -130,8 +118,6 @@
}
.right-div {
- left: 0px;
- top: 0px;
width: 200px;
height: 200px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/event/event.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/style/style.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.css
index ca9e352..1845d0f
--- a/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.css
@@ -95,8 +95,6 @@
.three-right-div {
width: 230px;
height: 190px;
- top: 40px;
- left: 0px;
}
.general-stack {
@@ -116,8 +114,6 @@
}
.right-div {
- left: 0px;
- top: 0px;
width: 150px;
height: 200px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/input/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.css
old mode 100755
new mode 100644
similarity index 95%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.css
index 3712436..270a2d3
--- a/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.css
@@ -67,23 +67,17 @@
.two-right-div {
width: 230px;
height: 150px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 150px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-div {
width: 450px;
height: 150px;
- left: 0px;
- top: 0px;
}
.item-attribute {
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/attr/attr.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.css
old mode 100755
new mode 100644
similarity index 91%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/event/event.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.css
index eb41b4f..8510988
--- a/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.css
@@ -76,23 +76,17 @@
.two-right-div {
width: 230px;
height: 200px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.item-change {
@@ -101,22 +95,16 @@
}
.change-div {
- left: 0px;
width: 450px;
height: 150px;
- top: 0px;
}
.change-left-div {
- left: 10px;
width: 200px;
height: 150px;
- top: 20px;
}
.change-right-div {
- left: 10px;
- top: 10px;
width: 250px;
height: 150px;
flex-direction: column;
@@ -130,8 +118,6 @@
}
.right-div {
- left: 0px;
- top: 0px;
width: 150px;
height: 200px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/event/event.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/event/event.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/event/event.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.css b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.css
old mode 100755
new mode 100644
similarity index 93%
rename from examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.css
index ca9e352..762fe0e
--- a/examples/showcase/src/main/js/default/pages/component/input/checkbox/style/style.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.css
@@ -60,15 +60,11 @@
.three-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.three-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
@@ -80,8 +76,6 @@
.two-left-div {
width: 220px;
height: 150px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
@@ -95,8 +89,6 @@
.three-right-div {
width: 230px;
height: 190px;
- top: 40px;
- left: 0px;
}
.general-stack {
@@ -116,8 +108,6 @@
}
.right-div {
- left: 0px;
- top: 0px;
width: 150px;
height: 200px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/style/style.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.js b/frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/input/radio/style/style.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/input/radio/style/style.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexCommonStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.css
index 31facbb..a5d9270
--- a/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.css
@@ -22,8 +22,6 @@
.text {
width: 400px;
height: 100px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
text-overflow: ellipsis;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item1/item1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.hml
old mode 100755
new mode 100644
similarity index 98%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.hml
index 8f49750..06d5907
--- a/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.hml
@@ -25,7 +25,7 @@ limitations under the License.
background-color: #00ff00;
border-width: 1px;
border-color: #ffa500;
- margin-left: 85;
+ margin-left: 85px;
"
>
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item11/item11.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.hml
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.hml
index 3ee0ca3..6d2dbd9
--- a/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.hml
@@ -35,7 +35,7 @@ limitations under the License.
"
>
- {{ $idx }}--{{ $item }}
+ {{ $idx }}--{{ $item }}
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item12/item12.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.css
index c56bf1d..66bbf1d
--- a/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.css
@@ -15,8 +15,6 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item3/item3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item5/item5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item8/item8.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list-item/item9/item9.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexCommonStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexOperation/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/indexSpecStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list1/list1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list10/list10.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list11/list11.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list12/list12.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.css
index 231d8ff..092642b
--- a/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.css
@@ -17,5 +17,5 @@
height: 50px;
margin-top: 10px;
margin-left: 10px;
- font-size: 30;
+ font-size: 30px;
}
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.hml
new file mode 100644
index 0000000..95ddce9
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.hml
@@ -0,0 +1,34 @@
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list13/list13.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list2/list2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.css
index c56bf1d..66bbf1d
--- a/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.css
@@ -15,8 +15,6 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list3/list3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list4/list4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list5/list5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list6/list6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list7/list7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list8/list8.js
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.css b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.css
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.js b/frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/list/list/list9/list9.js
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.css b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.css
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.js b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/attr/attr.js
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.css b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.css
old mode 100755
new mode 100644
similarity index 93%
rename from examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.css
index eb7dde2..6e00e0f
--- a/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.css
@@ -62,23 +62,17 @@
.three-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.three-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.three-right-div {
width: 230px;
height: 190px;
- top: 40px;
- left: 0px;
}
.item-two {
@@ -89,16 +83,12 @@
.two-left-div {
width: 220px;
height: 150px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-div {
width: 450px;
height: 150px;
- left: 0px;
- top: 0px;
}
.general-stack {
@@ -121,8 +111,6 @@
width: 250px;
height: 200px;
background-color: springgreen;
- left: 0px;
- top: 0px;
}
.show {
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.js b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/commonStyle/commonStyle.js
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/event/event.css b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/event/event.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/marquee/event/event.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/event/event.css
index d396d80..b13016e
--- a/examples/showcase/src/main/js/default/pages/component/marquee/event/event.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/event/event.css
@@ -62,23 +62,17 @@
.two-right-div {
width: 230px;
height: 200px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.click-text {
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/event/event.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/event/event.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/event/event.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/event/event.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/event/event.js b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/event/event.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/event/event.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/event/event.js
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.css b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.css
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.js b/frameworks/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/marquee/specStyle/specStyle.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/indexStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker1/text_picker1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker10/text_picker10.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.css
index 7a5644b..213527d
--- a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.css
@@ -22,7 +22,5 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.hml
old mode 100755
new mode 100644
similarity index 91%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.hml
index f05c83b..713a3ee
--- a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.hml
@@ -15,8 +15,8 @@ limitations under the License.
-
-
+
+
@@ -29,4 +29,4 @@ limitations under the License.
{{text3}}
-
+
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker2/text_picker2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker3/text_picker3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker4/text_picker4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker5/text_picker5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker6/text_picker6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker7/text_picker7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker8/text_picker8.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/text_picker/text_picker9/text_picker9.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/indexStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker1/time_picker1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.hml
old mode 100755
new mode 100644
similarity index 92%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.hml
index 0c88404..a5f352a
--- a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.hml
@@ -15,8 +15,8 @@ limitations under the License.
-
-
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker10/time_picker10.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.css
index 7a5644b..213527d
--- a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.css
@@ -22,7 +22,5 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.hml
old mode 100755
new mode 100644
similarity index 91%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.hml
index b60fa88..069dd08
--- a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.hml
@@ -15,8 +15,8 @@ limitations under the License.
-
-
+
+
@@ -29,4 +29,4 @@ limitations under the License.
{{text3}}
-
+
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker2/time_picker2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker3/time_picker3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker4/time_picker4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker5/time_picker5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.hml
old mode 100755
new mode 100644
similarity index 92%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.hml
index 9ecbc34..c1caba4
--- a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.hml
@@ -15,8 +15,8 @@ limitations under the License.
-
-
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker6/time_picker6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.hml
old mode 100755
new mode 100644
similarity index 89%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.hml
index 1f67fca..5c9a7ec
--- a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.hml
@@ -15,12 +15,12 @@ limitations under the License.
-
-
+
+
-
+
show
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker7/time_picker7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker8/time_picker8.js
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.css b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.css
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.js b/frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/picker_view/time_picker/time_picker9/time_picker9.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.css
index f5649f6..d15c720
--- a/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.css
@@ -71,8 +71,8 @@
center-x: 50px;
center-y: 50px;
radius: 50px;
- start-angle: 0;
- total-angle: 360;
+ start-angle: 0deg;
+ total-angle: 360deg;
stroke-width: 6px;
background-color: #8b8b7a;
color: #ff0000;
@@ -84,8 +84,8 @@
center-x: 15px;
center-y: 15px;
radius: 15px;
- start-angle: 0;
- total-angle: 360;
+ start-angle: 0deg;
+ total-angle: 360deg;
stroke-width: 6px;
background-color: #8b8b7a;
color: #ff0000;
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/attr/attr.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.css
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.css
index b5952b5..a60de29
--- a/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.css
@@ -50,8 +50,8 @@
center-x: 50px;
center-y: 50px;
radius: 50px;
- start-angle: 0;
- total-angle: 360;
+ start-angle: 0deg;
+ total-angle: 360deg;
}
.item-click {
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/event/event.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.css
old mode 100755
new mode 100644
similarity index 89%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.css
index b85e5fb..1d8e2a9
--- a/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.css
@@ -52,23 +52,17 @@
.three-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.three-left-div {
width: 240px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.three-right-div {
width: 230px;
height: 210px;
- top: 40px;
- left: 0px;
}
.general-stack {
@@ -84,8 +78,8 @@
center-x: 50px;
center-y: 50px;
radius: 50px;
- start-angle: 0;
- total-angle: 120;
+ start-angle: 0deg;
+ total-angle: 120deg;
left: 20px;
top: 20px;
background-color: #ff0000;
@@ -106,8 +100,8 @@
height: 70px;
center-x: 35px;
center-y: 35px;
- start-angle: 0;
- total-angle: 360;
+ start-angle: 0deg;
+ total-angle: 360deg;
radius: 35px;
stroke-width: 5px;
}
@@ -119,8 +113,8 @@
padding: 10px;
center-x: 65px;
center-y: 65px;
- start-angle: 0;
- total-angle: 360;
+ start-angle: 0deg;
+ total-angle: 360deg;
radius: 50px;
width: 130px;
height: 130px;
@@ -132,8 +126,8 @@
.special-style {
center-x: 50px;
center-y: 50px;
- start-angle: 10;
- total-angle: 180;
+ start-angle: 10deg;
+ total-angle: 180deg;
radius: 50px;
width: 100px;
height: 100px;
@@ -146,14 +140,10 @@
.two-right-div {
width: 230px;
height: 150px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 150px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/circle/style/style.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.css
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.hml
old mode 100755
new mode 100644
similarity index 97%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.hml
index f216fc0..bb32f71
--- a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.hml
@@ -40,7 +40,7 @@ limitations under the License.
for="{{ listData }}"
type="horizontal"
percent="{{ show }}"
- style="width: 100px; height: 50px; stroke-width: 5"
+ style="width: 100px; height: 50px; stroke-width: 5px"
>
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/attr/attr.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.css
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/event/event.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.css
old mode 100755
new mode 100644
similarity index 92%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.css
index 53adbc3..3866bfb
--- a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.css
@@ -52,23 +52,17 @@
.three-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.three-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.three-right-div {
width: 230px;
height: 190px;
- top: 40px;
- left: 0px;
}
.general-stack {
@@ -131,29 +125,21 @@
.two-right-div {
width: 230px;
height: 150px;
- top: 40px;
- left: 0px;
}
.two-left-div {
width: 220px;
height: 150px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-div {
width: 450px;
height: 150px;
- left: 0px;
- top: 0px;
}
.style-right-div {
width: 250px;
height: 200px;
- left: 10px;
- top: 10px;
flex-direction: column;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/horizontal/style/style.js
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/progress/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/progress/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/progress/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/progress/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.css b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.css
old mode 100755
new mode 100644
similarity index 91%
rename from examples/showcase/src/main/js/default/pages/component/slider/attr/attr.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.css
index 2929d28..0985799
--- a/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.css
@@ -38,23 +38,17 @@
.two-div {
width: 450px;
height: 150px;
- left: 0px;
- top: 0px;
}
.two-left-div {
width: 220px;
height: 150px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.two-right-div {
width: 230px;
height: 150px;
- top: 40px;
- left: 0px;
}
.item-three {
@@ -65,23 +59,17 @@
.three-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.three-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.three-right-div {
width: 230px;
height: 190px;
- top: 40px;
- left: 0px;
}
.slider {
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/attr/attr.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.js b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/attr/attr.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/attr/attr.js
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/event/event.css b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/event/event.css
old mode 100755
new mode 100644
similarity index 95%
rename from examples/showcase/src/main/js/default/pages/component/slider/event/event.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/event/event.css
index 71c47bd..d57c01f
--- a/examples/showcase/src/main/js/default/pages/component/slider/event/event.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/event/event.css
@@ -38,23 +38,17 @@
.two-div {
width: 450px;
height: 300px;
- left: 0px;
- top: 0px;
}
.two-left-div {
width: 220px;
height: 300px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.three-right-div {
width: 230px;
height: 300px;
- top: 40px;
- left: 0px;
}
.slider {
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/event/event.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/event/event.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/event/event.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/event/event.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/event/event.js b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/event/event.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/event/event.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/event/event.js
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/style/style.css b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/style/style.css
old mode 100755
new mode 100644
similarity index 95%
rename from examples/showcase/src/main/js/default/pages/component/slider/style/style.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/style/style.css
index 8c5adfc..39d737e
--- a/examples/showcase/src/main/js/default/pages/component/slider/style/style.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/style/style.css
@@ -53,8 +53,6 @@
.two-right-div {
width: 230px;
height: 150px;
- top: 40px;
- left: 0px;
}
.item-three {
@@ -65,23 +63,17 @@
.three-div {
width: 450px;
height: 200px;
- left: 0px;
- top: 0px;
}
.three-left-div {
width: 220px;
height: 200px;
- left: 0px;
- top: 0px;
flex-direction: column;
}
.three-right-div {
width: 230px;
height: 190px;
- top: 40px;
- left: 0px;
}
.slider {
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/style/style.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/style/style.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/style/style.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/style/style.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/slider/style/style.js b/frameworks/examples/showcase/src/main/js/default/pages/component/slider/style/style.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/slider/style/style.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/slider/style/style.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/index/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/index/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/index/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/index/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/index/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/index/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/index/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/index/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexAttr/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEffect/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexEvent/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/indexStyle/index.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack1/stack1.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.css
index 7a5644b..213527d
--- a/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.css
@@ -22,7 +22,5 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.hml
new file mode 100644
index 0000000..da246b0
--- /dev/null
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.hml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+ stack已设置样式
+
+
+
+ {{text1}}
+
+
+ {{text2}}
+
+
+ {{text3}}
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack2/stack2.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack3/stack3.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.css
old mode 100755
new mode 100644
similarity index 94%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.css
index 1426740..31cb152
--- a/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.css
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.css
@@ -15,7 +15,5 @@
.text {
width: 200px;
height: 50px;
- margin-top: 10px;
- margin-left: 10px;
font-size: 30px;
}
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack4/stack4.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.hml
old mode 100755
new mode 100644
similarity index 91%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.hml
index dad4463..67f6be9
--- a/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.hml
@@ -15,8 +15,8 @@ limitations under the License.
-
-
+
+
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack5/stack5.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack6/stack6.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.hml
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.hml
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.js b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.js
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.js
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack7/stack7.js
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.css b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.css
old mode 100755
new mode 100644
similarity index 100%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.css
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.css
diff --git a/examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.hml b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.hml
old mode 100755
new mode 100644
similarity index 98%
rename from examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.hml
rename to frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.hml
index acaeaa3..5e477fe
--- a/examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.hml
+++ b/frameworks/examples/showcase/src/main/js/default/pages/component/stack/stack8/stack8.hml
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
+
+
+
+
diff --git a/examples/showcase/src/main/js/default/pages/index/index.js b/frameworks/examples/showcase/src/main/js/default/pages/index/index.js
old mode 100755
new mode 100644
similarity index 92%
rename from examples/showcase/src/main/js/default/pages/index/index.js
rename to frameworks/examples/showcase/src/main/js/default/pages/index/index.js
index 8a0740e..83b3754
--- a/examples/showcase/src/main/js/default/pages/index/index.js
+++ b/frameworks/examples/showcase/src/main/js/default/pages/index/index.js
@@ -13,9 +13,13 @@
* limitations under the License.
*/
import { backPage, routePage } from "../../common/js/general";
+import app from '@system.app';
export default {
changeComponent1: routePage("pages/component/index/containerIndex/index").changePage,
changeComponent2: routePage("pages/component/index/baseIndex/index").changePage,
changeComponent3: routePage("pages/component/index/formIndex/index").changePage,
- changeComponent4: routePage("pages/component/index/otherIndex/index").changePage
+ changeComponent4: routePage("pages/component/index/otherIndex/index").changePage,
+ exit(){
+ app.terminate();
+ }
};
diff --git a/include/base/dft_impl.h b/frameworks/include/base/dft_impl.h
similarity index 72%
rename from include/base/dft_impl.h
rename to frameworks/include/base/dft_impl.h
index e5dcd60..bd9b7af 100755
--- a/include/base/dft_impl.h
+++ b/frameworks/include/base/dft_impl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -18,13 +18,20 @@
#include "acelite_config.h"
-#ifdef OHOS_ACELITE_PRODUCT_WATCH
+#if (defined(OHOS_ACELITE_PRODUCT_WATCH)) || (defined(CHANGE_START_PAGE))
#include "memory_heap.h"
namespace OHOS {
namespace ACELite {
typedef void (*PageReplacedCallback)(const char *path, int state);
+struct Param {
+ const char *routerParam = nullptr;
+ const char *path = nullptr;
+};
+
+typedef void (*PageInfoFunc)(const Param param);
+
class DftImpl final : public MemoryHeap {
public:
static DftImpl *GetInstance();
@@ -36,15 +43,17 @@ public:
*/
void RegisterPageReplaced(PageReplacedCallback handler);
+ void RegisterPageChangedCallback(PageInfoFunc pageInfoFunc);
+
/**
* @fn DftImpl::CallbackPageReplaced()
*
* @brief Call the path handler if it's set
*/
- void CallbackPageReplaced(int state);
+ void CallbackPageReplaced(int state, const char *param = nullptr);
private:
- DftImpl() : pageReplacedCallback_(nullptr) {}
+ DftImpl() : pageReplacedCallback_(nullptr), pageInfoFunc_(nullptr) {}
~DftImpl() = default;
@@ -56,8 +65,9 @@ private:
char *GetPagePath();
PageReplacedCallback pageReplacedCallback_;
+ PageInfoFunc pageInfoFunc_;
};
} // namespace ACELite
} // namespace OHOS
#endif // OHOS_ACELITE_PRODUCT_WATCH
-#endif // OHOS_ACELITE_DFT_IMPL_H
\ No newline at end of file
+#endif // OHOS_ACELITE_DFT_IMPL_H
diff --git a/include/base/js_config.h b/frameworks/include/base/js_config.h
old mode 100755
new mode 100644
similarity index 72%
rename from include/base/js_config.h
rename to frameworks/include/base/js_config.h
index 0c9e5d8..e7c0257
--- a/include/base/js_config.h
+++ b/frameworks/include/base/js_config.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,34 +20,12 @@
/*
* Usage:
- * #if ENABLED(SECURE_C_FUNCTION)
- * #if DISABLED(SECURE_C_FUNCTION)
- * #if ENABLED(SECURE_C_FUNCTION) && DISABLED(LOG_OUTPUT)
- * #if ENABLED(SECURE_C_FUNCTION) || ENABLED(LOG_OUTPUT)
+ * #if DISABLED(LOG_OUTPUT)
+ * #if ENABLED(LOG_OUTPUT)
*/
#define ENABLED(CONFIGURATION) ((CONFIGURATION) == 1)
#define DISABLED(CONFIGURATION) ((CONFIGURATION) != 1)
-/**
- * Enable secure C functions on real device, and disable on PC simulator for
- * windows sdk version issue.
- *
- * Allowed values:
- * 0: Disable the secure C functions.
- * 1: Enable the secure C functions.
- *
- * Default: 1 on real device and 0 on PC simulator.
- */
-#if (!defined _WIN32) && (!defined _WIN64)
-#ifndef SECURE_C_FUNCTION
-#define SECURE_C_FUNCTION 1 // modify here for real device case
-#endif
-#else
-#ifndef SECURE_C_FUNCTION
-#define SECURE_C_FUNCTION 0 // modify here for PC simulator case
-#endif
-#endif
-
/**
* Enable/Disable JS framework runtime performance measurement.
*
diff --git a/include/base/js_debugger_config.h b/frameworks/include/base/js_debugger_config.h
old mode 100755
new mode 100644
similarity index 75%
rename from include/base/js_debugger_config.h
rename to frameworks/include/base/js_debugger_config.h
index 3afe749..134ea33
--- a/include/base/js_debugger_config.h
+++ b/frameworks/include/base/js_debugger_config.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -25,8 +25,16 @@
*/
namespace OHOS {
namespace ACELite {
-enum DebugProtocol { TCP, SERIAL };
-enum DebugChannel { WEBSOCKET, RAWPACKET };
+// the protocol type the engine supports
+enum DebugProtocol : uint8_t {
+ TCP,
+ SERIAL
+};
+// the protocol channel type the engine supports
+enum DebugChannel : uint8_t {
+ WEBSOCKET,
+ RAWPACKET
+};
const uint16_t DEFAULT_PORT = 5001; // default port
struct DebuggerConfig : public MemoryHeap {
DebugProtocol protocol; // use tcp as default
@@ -34,18 +42,28 @@ struct DebuggerConfig : public MemoryHeap {
uint32_t heapSize; // the JS heap size want to setup, count in bytes
uint16_t port; // used for tcp, default is 5001
bool startDebuggerServer; // default is false
- bool logToFile; // default print to stdout
bool snapshotMode; // if run in snapshot mode
- char *logFilePath; // the log file path
DebuggerConfig()
: protocol(TCP),
channel(WEBSOCKET),
heapSize(0),
port(DEFAULT_PORT),
startDebuggerServer(false),
- logToFile(false),
- snapshotMode(false),
- logFilePath(nullptr)
+ snapshotMode(false)
+ {
+ }
+ DebuggerConfig(DebugProtocol debugProtocol,
+ DebugChannel debugChannel,
+ uint32_t size,
+ uint16_t debuggerPort,
+ bool startServer,
+ bool isSnapshotMode)
+ : protocol(debugProtocol),
+ channel(debugChannel),
+ heapSize(size),
+ port(debuggerPort),
+ startDebuggerServer(startServer),
+ snapshotMode(isSnapshotMode)
{
}
};
@@ -64,27 +82,10 @@ public:
*
* @return an instance of debugger
*/
- static Debugger &GetInstance()
- {
- static Debugger instance;
- return instance;
- }
- Debugger()
-#if ENABLED(ENGINE_DEBUGGER)
- : consoleLogFileHandler_(nullptr),
-#ifdef JS_ENGINE_EXTERNAL_CONTEXT
- engineContext_(nullptr),
-#endif // JS_ENGINE_EXTERNAL_CONTEXT
- debuggerStarted_(false)
-#endif // ENABLED(ENGINE_DEBUGGER)
- {}
+ static Debugger &GetInstance();
+ Debugger() = default;
~Debugger() = default;
- /**
- * @brief Configure related debugger
- */
- void ConfigDebugger();
-
/**
* @brief Get state of the debugger
*
@@ -132,13 +133,12 @@ public:
void ReleaseJSContext();
private:
#if ENABLED(ENGINE_DEBUGGER)
- FILE *consoleLogFileHandler_;
#ifdef JS_ENGINE_EXTERNAL_CONTEXT
- void *engineContext_;
+ void *engineContext_ = nullptr;
#endif // JS_ENGINE_EXTERNAL_CONTEXT
- bool debuggerStarted_;
+ bool debuggerStarted_ = false;
+ DebuggerConfig debuggerConfig_ = {TCP, WEBSOCKET, 0, DEFAULT_PORT, false, false};
#endif // ENABLED(ENGINE_DEBUGGER)
- DebuggerConfig debuggerConfig_;
};
} // namespace ACELite
} // namespace OHOS
diff --git a/frameworks/include/base/product_adapter.h b/frameworks/include/base/product_adapter.h
new file mode 100644
index 0000000..ed60067
--- /dev/null
+++ b/frameworks/include/base/product_adapter.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_ACE_DFX_ADAPTER_H
+#define OHOS_ACELITE_ACE_DFX_ADAPTER_H
+
+#include
+#include "jsi_types.h"
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * This handler type is so specific for product, should be designed from OS dfx level.
+ */
+typedef void (*EventPrintHandler)(uint8_t info1, uint8_t info2, uint8_t info3, uint8_t info4);
+typedef void (*ErrCodePrintHandler)(uint8_t info1, uint8_t info2, uint8_t info3, uint16_t info4);
+
+/**
+ * The hook for outputing user's console log.
+ */
+typedef void (*JSLogOutputHandler)(uint8_t level, const char *content);
+
+/**
+ * The wrapper data structure for get native memory pool info.
+ */
+struct NativeMemInfo {
+ uint32_t totalSize; /* mem pool total size */
+ uint32_t freeSize; /* total free size */
+};
+
+/**
+ * Native memory pool info getter.
+ */
+typedef void (*NativeMemInfoGetter)(NativeMemInfo *memInfo);
+
+/**
+ * Product modules hook.
+ */
+typedef Module* (*ProductModulesGetter)(uint16_t& moduleCount);
+
+/**
+ * Private modules hook.
+ */
+typedef PrivateModule* (*PrivateModulesGetter)(uint16_t& moduleCount);
+
+/**
+ * The hook for terminating ability.
+ */
+typedef void (*TerminateAbilityHandler)(uint32_t token, bool forceStop);
+
+/**
+ * As all the UI event handling is driven by the render tick, and to make sure the the event handling is
+ * in JS task, the HAL layer will transfer the TE event into the loop of JS task, when JS application go forground.
+ */
+typedef void (*RenderTEHandler)();
+typedef void (*VoidFuncHook)();
+
+/**
+ * The wrapper data structure for get native memory pool info.
+ */
+struct TEHandlingHooks {
+ RenderTEHandler renderTEHandler;
+ VoidFuncHook renderEndHandler;
+};
+
+enum TEDispatchingResult : uint8_t {
+ REFUSED = 0, // not on forground, will refuse TE, vsync should send it to other
+ ACCEPTED, // on forground, and TE event is received successfully
+ ACCEPT_FAILED, // on forground, but TE event can not be received, vsync should be retried to send to ACE again
+};
+
+/**
+ * The wrapper class for some product feature implementation, since some interfaces are provided by specific product.
+ */
+class ProductAdapter final {
+public:
+ ProductAdapter(const ProductAdapter &) = delete;
+ ProductAdapter &operator=(const ProductAdapter &) = delete;
+ ProductAdapter(ProductAdapter &&) = delete;
+ ProductAdapter &operator=(ProductAdapter &&) = delete;
+ ProductAdapter() = delete;
+ ~ProductAdapter() = delete;
+
+ // initialization functions
+ static void InitTraceHandlers(EventPrintHandler eventHandler, ErrCodePrintHandler errCodeHandler);
+ static void InitAceTags(uint8_t *aceTags, uint8_t tagCount);
+ static void InitConsoleNativeHandler(JSLogOutputHandler handler);
+ static void InitNativeMemPoolHook(NativeMemInfoGetter getter);
+ static void InitExtraModulesGetter(ProductModulesGetter productModuleGetter,
+ PrivateModulesGetter privateModuleGetter);
+ static void RegTerminatingHandler(TerminateAbilityHandler handler);
+ static void RegTEHandlers(const TEHandlingHooks &teHandlingHooks);
+ static TEDispatchingResult DispatchTEMessage();
+ static void SetDefaultFontStyle(const char *defaultFontFamily, uint8_t defaultFontSize);
+ static void SetScreenSize(uint16_t width, uint16_t height);
+
+ // wrapper functions, for ace internal calling
+ static void PrintEventTrace(uint8_t info2, uint8_t info3, uint8_t info4);
+ static void PrintErrCode(uint8_t info2, uint16_t rfu);
+ static void OutputJSConsoleLog(uint8_t level, const char *content);
+ static void GetNativeMemInfo(NativeMemInfo *memInfo);
+ static void SendTerminatingRequest(uint32_t token, bool forceStop);
+ static bool IsTEHandlersRegisted();
+ static void ProcessOneTE();
+ static void NotifyRenderEnd();
+ static const char *GetDefaultFontFamilyName();
+ static uint8_t GetDefaultFontSize();
+ static void UpdateShowingState(bool forground);
+ static void GetScreenSize(uint16_t &width, uint16_t &height);
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // OHOS_ACELITE_ACE_DFX_ADAPTER_H
diff --git a/include/context/js_ability.h b/frameworks/include/context/js_ability.h
similarity index 85%
rename from include/context/js_ability.h
rename to frameworks/include/context/js_ability.h
index 8cb34b3..dc1671d 100755
--- a/include/context/js_ability.h
+++ b/frameworks/include/context/js_ability.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,12 +23,6 @@
namespace OHOS {
namespace ACELite {
-/**
- * As all the UI event handling is driven by the render tick, and to make sure the the event handling is
- * in JS task, the HAL layer will transfer the TE event into the loop of JS task, when JS application go forground.
- */
-typedef int32_t (*RenderTickHandler)();
-
class JSAbility final : public MemoryHeap {
public:
JSAbility(const JSAbility &) = delete;
@@ -57,7 +51,7 @@ public:
* the JS framework and eval abilityPath/src/index.js as well
* @param [in] the ability path to bundle name and token of this ability
*/
- void Launch(const char *abilityPath, const char *bundleName, uint16_t token);
+ void Launch(const char *abilityPath, const char *bundleName, uint16_t token, const char *pageInfo = nullptr);
/**
* @fn JSAbility::Show()
@@ -101,13 +95,6 @@ public:
*/
void ForceDestroy();
- /**
- * @fn JSAbility::RegisterTEHandler()
- *
- * @brief Register render tick event handler
- */
- static void RegisterTEHandler(RenderTickHandler handler);
-
/**
* @fn JSAbility::HandleRenderTick()
*
@@ -115,6 +102,13 @@ public:
*/
void HandleRenderTick();
+ /**
+ * @fn JSAbility::LazyLoadHandleRenderTick()
+ *
+ * @brief Call the lazy load tick if it's set
+ */
+ static void LazyLoadHandleRenderTick(void *data);
+
private:
// the holder of JS runtime and user' JS related environment
void *jsAbilityImpl_;
diff --git a/include/resource/video_panel_image_res.h b/frameworks/include/resource/video_panel_image_res.h
old mode 100755
new mode 100644
similarity index 100%
rename from include/resource/video_panel_image_res.h
rename to frameworks/include/resource/video_panel_image_res.h
diff --git a/packages/runtime-core/.babelrc b/frameworks/packages/runtime-core/.babelrc
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/.babelrc
rename to frameworks/packages/runtime-core/.babelrc
diff --git a/packages/runtime-core/.editorconfig b/frameworks/packages/runtime-core/.editorconfig
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/.editorconfig
rename to frameworks/packages/runtime-core/.editorconfig
diff --git a/packages/runtime-core/.eslintignore b/frameworks/packages/runtime-core/.eslintignore
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/.eslintignore
rename to frameworks/packages/runtime-core/.eslintignore
diff --git a/packages/runtime-core/.eslintrc.js b/frameworks/packages/runtime-core/.eslintrc.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/.eslintrc.js
rename to frameworks/packages/runtime-core/.eslintrc.js
diff --git a/packages/runtime-core/.gitignore b/frameworks/packages/runtime-core/.gitignore
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/.gitignore
rename to frameworks/packages/runtime-core/.gitignore
diff --git a/packages/runtime-core/.prettierrc b/frameworks/packages/runtime-core/.prettierrc
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/.prettierrc
rename to frameworks/packages/runtime-core/.prettierrc
diff --git a/packages/runtime-core/.size-snapshot.json b/frameworks/packages/runtime-core/.size-snapshot.json
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/.size-snapshot.json
rename to frameworks/packages/runtime-core/.size-snapshot.json
diff --git a/packages/runtime-core/contribution.md b/frameworks/packages/runtime-core/contribution.md
similarity index 93%
rename from packages/runtime-core/contribution.md
rename to frameworks/packages/runtime-core/contribution.md
index 8d43fbf..02d9f02 100644
--- a/packages/runtime-core/contribution.md
+++ b/frameworks/packages/runtime-core/contribution.md
@@ -27,7 +27,7 @@
> cd packages/runtime-core/build/
> ./../../../tools/snapshot/jerry_bin/linux/jerry-snapshot generate -o framework.min.bc ./framework.min.js
- ## 5. Update the JS and sanpshot array in C++ code
+ ## 5. Update the JS and snapshot array in C++ code
> cd tools/snapshot/
> python framework2char.py
diff --git a/packages/runtime-core/package-lock.json b/frameworks/packages/runtime-core/package-lock.json
similarity index 100%
rename from packages/runtime-core/package-lock.json
rename to frameworks/packages/runtime-core/package-lock.json
diff --git a/packages/runtime-core/package.json b/frameworks/packages/runtime-core/package.json
similarity index 100%
rename from packages/runtime-core/package.json
rename to frameworks/packages/runtime-core/package.json
diff --git a/packages/runtime-core/scripts/build.js b/frameworks/packages/runtime-core/scripts/build.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/scripts/build.js
rename to frameworks/packages/runtime-core/scripts/build.js
diff --git a/packages/runtime-core/scripts/configs.js b/frameworks/packages/runtime-core/scripts/configs.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/scripts/configs.js
rename to frameworks/packages/runtime-core/scripts/configs.js
diff --git a/packages/runtime-core/src/__test__/index.test.js b/frameworks/packages/runtime-core/src/__test__/index.test.js
similarity index 100%
rename from packages/runtime-core/src/__test__/index.test.js
rename to frameworks/packages/runtime-core/src/__test__/index.test.js
diff --git a/packages/runtime-core/src/core/index.js b/frameworks/packages/runtime-core/src/core/index.js
similarity index 100%
rename from packages/runtime-core/src/core/index.js
rename to frameworks/packages/runtime-core/src/core/index.js
diff --git a/packages/runtime-core/src/index.js b/frameworks/packages/runtime-core/src/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/src/index.js
rename to frameworks/packages/runtime-core/src/index.js
diff --git a/packages/runtime-core/src/observer/index.js b/frameworks/packages/runtime-core/src/observer/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/src/observer/index.js
rename to frameworks/packages/runtime-core/src/observer/index.js
diff --git a/packages/runtime-core/src/observer/observer.js b/frameworks/packages/runtime-core/src/observer/observer.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/src/observer/observer.js
rename to frameworks/packages/runtime-core/src/observer/observer.js
diff --git a/packages/runtime-core/src/observer/subject.js b/frameworks/packages/runtime-core/src/observer/subject.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/src/observer/subject.js
rename to frameworks/packages/runtime-core/src/observer/subject.js
diff --git a/packages/runtime-core/src/observer/utils.js b/frameworks/packages/runtime-core/src/observer/utils.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/src/observer/utils.js
rename to frameworks/packages/runtime-core/src/observer/utils.js
diff --git a/packages/runtime-core/src/profiler/index.js b/frameworks/packages/runtime-core/src/profiler/index.js
old mode 100755
new mode 100644
similarity index 100%
rename from packages/runtime-core/src/profiler/index.js
rename to frameworks/packages/runtime-core/src/profiler/index.js
diff --git a/src/core/animation/transition_impl.cpp b/frameworks/src/core/animation/transition_impl.cpp
similarity index 80%
rename from src/core/animation/transition_impl.cpp
rename to frameworks/src/core/animation/transition_impl.cpp
index 3f0afec..6b31fd4 100755
--- a/src/core/animation/transition_impl.cpp
+++ b/frameworks/src/core/animation/transition_impl.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -12,16 +12,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "transition_impl.h"
+#include "transition_impl.h"
#include
-#if ENABLED(SECURE_C_FUNCTION)
-#include "securec.h"
-#endif // ENABLED(SECURE_C_FUNCTION)
#include "ace_log.h"
#include "ace_mem_base.h"
#include "easing_equation.h"
#include "root_view.h"
+#include "securec.h"
namespace OHOS {
namespace ACELite {
@@ -40,6 +38,7 @@ void TransitionImpl::Init()
void TransitionImpl::Callback(UIView* view)
{
+ (void)(view);
if (animator_ == nullptr) {
return;
}
@@ -56,27 +55,27 @@ void TransitionImpl::Callback(UIView* view)
void TransitionImpl::Start()
{
- if (animator_) {
- uint8_t state = animator_->GetState();
- if (((state == Animator::STOP) || (state == Animator::PAUSE)) && (params_.during > 0)) {
- RecordViewStatus();
- InitTransitionParams();
- animator_->Start();
- }
- } else {
+ if (animator_ == nullptr) {
HILOG_INFO(HILOG_MODULE_ACE, "animator not initial or has been started");
+ return;
+ }
+ uint8_t state = animator_->GetState();
+ if (((state == Animator::STOP) || (state == Animator::PAUSE)) && (params_.during > 0)) {
+ RecordViewStatus();
+ InitTransitionParams();
+ animator_->Start();
}
}
void TransitionImpl::Stop() const
{
- if (animator_) {
- uint8_t state = animator_->GetState();
- if (state == Animator::START || state == Animator::RUNNING) {
- animator_->Stop();
- }
- } else {
+ if (animator_ == nullptr) {
HILOG_INFO(HILOG_MODULE_ACE, "animator not initial or is not running");
+ return;
+ }
+ uint8_t state = animator_->GetState();
+ if (state == Animator::START || state == Animator::RUNNING) {
+ animator_->Stop();
}
}
@@ -106,7 +105,7 @@ void TransitionImpl::InitTransitionParamsStyle()
widthSrc_ = params_.width_from;
}
if (params_.opacity_from >= 0 && params_.opacity_to >= 0) {
- isTransitionSet_[GeneralType::IS_OPCITY_TRANSITION_SET] = true;
+ isTransitionSet_[GeneralType::IS_OPACITY_TRANSITION_SET] = true;
opacitySrc_ = (params_.opacity_from <= OPA_OPAQUE) ? params_.opacity_from : OPA_OPAQUE;
params_.opacity_to = (params_.opacity_to <= OPA_OPAQUE) ? params_.opacity_to : OPA_OPAQUE;
}
@@ -123,6 +122,7 @@ void TransitionImpl::InitTransitionParamsStyle()
void TransitionImpl::InitTransitionParamsTransform()
{
if (params_.transformType == nullptr) {
+ HILOG_INFO(HILOG_MODULE_ACE, "transformType not set");
return;
}
if (!strcmp(params_.transformType, TRANSITION_TRANSFORM_X)) {
@@ -201,9 +201,9 @@ void TransitionImpl::RotateAroundCenterPoint(int16_t angle)
TransformMap transMap(view_->GetOrigRect());
const int circleRate = 360;
angle = angle % circleRate;
- uint8_t halfVal = 2;
- pivot_.x_ = view_->GetWidth() / halfVal;
- pivot_.y_ = view_->GetHeight() / halfVal;
+ float halfVal = 2.0f;
+ pivot_.x_ = (view_->GetWidth() - 1) / halfVal;
+ pivot_.y_ = (view_->GetHeight() - 1) / halfVal;
transMap.Rotate((angle), pivot_);
view_->SetTransformMap(transMap);
}
@@ -239,7 +239,7 @@ void TransitionImpl::Perform(int32_t elapsedTime)
PerformTransition(params_.width_from, params_.width_to, TransitionType::WIDTH, widthSrc_, elapsedTime);
}
- if (isTransitionSet_[GeneralType::IS_OPCITY_TRANSITION_SET]) {
+ if (isTransitionSet_[GeneralType::IS_OPACITY_TRANSITION_SET]) {
PerformTransition(params_.opacity_from, params_.opacity_to, TransitionType::OPACITY, opacitySrc_, elapsedTime);
}
@@ -247,7 +247,7 @@ void TransitionImpl::Perform(int32_t elapsedTime)
PerformTransitionBgColorLinear(elapsedTime);
}
- if (fill_ == OptionsFill::FNONE && timeArrivaled_) {
+ if ((fill_ == OptionsFill::FNONE) && timeArrivaled_) {
RecoveryViewStatus(view_->GetRect());
}
@@ -282,88 +282,83 @@ void TransitionImpl::PerformTransition(int16_t from,
int16_t& updateAttrValue,
int32_t elapsedTime)
{
- bool needUpdate = true;
-
if (timeArrivaled_) {
updateAttrValue = to;
} else {
- int16_t prefectchedValue = 0;
- prefectchedValue = GetNextFrameValue(from, to, elapsedTime);
- int16_t diffDistance = prefectchedValue - updateAttrValue;
+ int16_t prefetchedValue = 0;
+ prefetchedValue = GetNextFrameValue(from, to, elapsedTime);
+ int16_t diffDistance = prefetchedValue - updateAttrValue;
if (((diffDistance < 1) && (diffDistance > -1)) || (elapsedTime > params_.during)) {
- needUpdate = false;
- } else {
- updateAttrValue = static_cast(prefectchedValue);
+ return;
}
+ updateAttrValue = static_cast(prefetchedValue);
}
- if (needUpdate) {
- Rect invalidatedArea = view_->GetRect();
-
- switch (transitionType) {
- case TransitionType::TTRANSLATE_X:
- view_->SetPosition((updateAttrValue + viewStatus_.x), viewStatus_.y);
- break;
- case TransitionType::TTRANSLATE_Y:
- view_->SetPosition(viewStatus_.x, (updateAttrValue + viewStatus_.y));
- break;
- case TransitionType::TROTATE: {
- RotateAroundCenterPoint(updateAttrValue);
- break;
- }
- case TransitionType::HEIGHT:
- view_->SetHeight(updateAttrValue);
- break;
- case TransitionType::WIDTH:
- view_->SetWidth(updateAttrValue);
- break;
- case TransitionType::OPACITY: {
- double rate = (double)updateAttrValue / ALPHA_MAX;
- view_->SetStyle(STYLE_BACKGROUND_OPA, viewStatus_.rectOpacity * rate);
- view_->SetStyle(STYLE_IMAGE_OPA, viewStatus_.imageOpacity * rate);
- view_->SetStyle(STYLE_LINE_OPA, viewStatus_.lineOpacity * rate);
- view_->SetStyle(STYLE_TEXT_OPA, viewStatus_.textOpacity * rate);
- break;
- }
- default:
- HILOG_INFO(HILOG_MODULE_ACE, "animation nothing to do.");
- break;
+ Rect invalidatedArea = view_->GetRect();
+ switch (transitionType) {
+ case TransitionType::TTRANSLATE_X:
+ view_->SetPosition((updateAttrValue + viewStatus_.x), viewStatus_.y);
+ break;
+ case TransitionType::TTRANSLATE_Y:
+ view_->SetPosition(viewStatus_.x, (updateAttrValue + viewStatus_.y));
+ break;
+ case TransitionType::TROTATE: {
+ RotateAroundCenterPoint(updateAttrValue);
+ break;
}
-
- invalidatedArea.Join(invalidatedArea, view_->GetRect());
- view_->InvalidateRect(invalidatedArea);
+ case TransitionType::HEIGHT:
+ view_->SetHeight(updateAttrValue);
+ break;
+ case TransitionType::WIDTH:
+ view_->SetWidth(updateAttrValue);
+ break;
+ case TransitionType::OPACITY: {
+ double rate = (double)updateAttrValue / ALPHA_MAX;
+ view_->SetStyle(STYLE_BACKGROUND_OPA, viewStatus_.rectOpacity * rate);
+ view_->SetStyle(STYLE_IMAGE_OPA, viewStatus_.imageOpacity * rate);
+ view_->SetStyle(STYLE_LINE_OPA, viewStatus_.lineOpacity * rate);
+ view_->SetStyle(STYLE_TEXT_OPA, viewStatus_.textOpacity * rate);
+ break;
+ }
+ default:
+ HILOG_INFO(HILOG_MODULE_ACE, "animation nothing to do.");
+ break;
}
+
+ invalidatedArea.Join(invalidatedArea, view_->GetRect());
+ view_->InvalidateRect(invalidatedArea);
}
int8_t TransitionImpl::GetNumIterations(const char* iterations)
{
+ int8_t min = 1;
+ int8_t max = 127;
+ if (iterations == nullptr) {
+ return min;
+ }
if (!strcmp(iterations, "infinite")) {
return TransitionImpl::ITERATIONS_INFINITY;
}
-
- int8_t min = 1;
- int8_t max = 127;
long value = strtol(iterations, nullptr, DEC);
if ((value < min) || (value > max)) {
HILOG_ERROR(HILOG_MODULE_ACE, "animation iterations should set between 1 and 127");
return min;
- } else {
- return (int8_t)value;
}
+ return (int8_t)value;
}
bool TransitionImpl::IsEndWith(const char* src, const char* end)
{
- if (src == nullptr || end == nullptr) {
+ if ((src == nullptr) || (end == nullptr)) {
return false;
}
size_t strLen = strlen(src);
size_t endLen = strlen(end);
- if (strLen < endLen || strLen == 0 || endLen == 0) {
+ if ((strLen < endLen) || (strLen == 0) || (endLen == 0)) {
return false;
}
- while ((endLen > 0) && (strLen > 0)) {
+ while (endLen > 0) {
if (src[strLen - 1] != end[endLen - 1]) {
return false;
}
diff --git a/src/core/animation/transition_impl.h b/frameworks/src/core/animation/transition_impl.h
similarity index 94%
rename from src/core/animation/transition_impl.h
rename to frameworks/src/core/animation/transition_impl.h
index 864feb1..fb669f5 100755
--- a/src/core/animation/transition_impl.h
+++ b/frameworks/src/core/animation/transition_impl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,9 +23,9 @@
namespace OHOS {
namespace ACELite {
-enum EasingType { LINEAR, EASE_IN, EASE_OUT, EASE_IN_OUT, EEND };
+enum EasingType : uint8_t { LINEAR, EASE_IN, EASE_OUT, EASE_IN_OUT, EEND };
-enum OptionsFill { FNONE, FORWARDS };
+enum OptionsFill : uint8_t { FNONE, FORWARDS };
struct TransitionParams {
/* animation execution time (ms), default is 0, means no animation effect. */
@@ -91,17 +91,22 @@ struct ViewStatus {
oriRect(), background_color() {};
};
-enum TransformType { TRANSLATE_X, TRANSLATE_Y, ROTATE, NONE }; // rotate only support image
+enum TransformType : uint8_t {
+ TRANSLATE_X,
+ TRANSLATE_Y,
+ ROTATE, // rotate only support image
+ NONE
+};
-enum GeneralType {
+enum GeneralType : uint8_t {
IS_HEIGHT_TRANSITION_SET,
IS_WIDTH_TRANSITION_SET,
IS_BACKGROUND_COLOR_TRANSITION_SET,
- IS_OPCITY_TRANSITION_SET,
+ IS_OPACITY_TRANSITION_SET,
END
};
-enum TransitionType {
+enum TransitionType : uint8_t {
TTRANSLATE_X,
TTRANSLATE_Y,
TROTATE,
@@ -183,7 +188,7 @@ private:
TransitionParams& params_;
int8_t oriIteration_;
Animator* animator_;
- Vector2 pivot_;
+ Vector2 pivot_;
int16_t xSrc_;
int16_t ySrc_;
int16_t rotateSrc_;
diff --git a/src/core/async/js_async_work.cpp b/frameworks/src/core/async/js_async_work.cpp
similarity index 98%
rename from src/core/async/js_async_work.cpp
rename to frameworks/src/core/async/js_async_work.cpp
index 6765bd7..f1cd37c 100755
--- a/src/core/async/js_async_work.cpp
+++ b/frameworks/src/core/async/js_async_work.cpp
@@ -90,7 +90,8 @@ bool JsAsyncWork::DispatchAsyncWorkInner(AsyncWorkHandler workHandler, AsyncHand
bool ret = DispatchToLoop(ASYNCWORK, static_cast(asyncWork));
if (!ret) {
- HILOG_ERROR(HILOG_MODULE_ACE, "JsAsyncWork:DispatchAsyncWork failed!, handler[%p]", asyncWork->workHandler);
+ HILOG_ERROR(HILOG_MODULE_ACE, "JsAsyncWork:DispatchAsyncWork failed!, handler[%{private}p]",
+ asyncWork->workHandler);
delete(asyncWork);
asyncWork = nullptr;
}
diff --git a/src/core/async/message_queue_utils.cpp b/frameworks/src/core/async/message_queue_utils.cpp
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/async/message_queue_utils.cpp
rename to frameworks/src/core/async/message_queue_utils.cpp
diff --git a/frameworks/src/core/base/ace_event_id.h b/frameworks/src/core/base/ace_event_id.h
new file mode 100644
index 0000000..90e1e71
--- /dev/null
+++ b/frameworks/src/core/base/ace_event_id.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_ACE_EVENT_ID_H
+#define OHOS_ACELITE_ACE_EVENT_ID_H
+
+// ACE framework event codes
+#define MT_ACE_RELEASE_HISTORY_PAGE 0x01
+#define MT_ACE_FEATUREABILITY 0x08
+#define MT_ACE_FEATUREABILITY_SUBSCRIBEMSG 0x00
+#define MT_ACE_FEATUREABILITY_UNSUBSCRIBEMSG 0x01
+
+// ACE framework error codes
+#define EXCE_ACE_FWK_LAUNCH_FAILED 0x01
+#define EXCE_ACE_ROUTER_REPLACE_FAILED 0x02
+#define EXCE_ACE_ASYNC_WORK_FAILED 0x03
+#define EXCE_ACE_LOCALIZATION_FAILED 0x04
+#define EXCE_ACE_ENGINE_RUNTIME_ERROR 0x05
+
+// ACE framework error code : engine runtime error
+#define EXCE_ACE_JS_HEAP_OOM 0x0001
+#define EXCE_ACE_JS_REF_COUNT_LIMIT 0x0002
+#define EXCE_ACE_JS_DISABLED_BYTE_CODE 0x0003
+#define EXCE_ACE_JS_FAILED_INTERNAL_ASSERTION 0x0004
+
+// ACE framework error code : fwk launch error
+#define EXCE_ACE_INVALID_APP_PATH 0x0001
+#define EXCE_ACE_INVALID_BUNDLE_NAME 0x0002
+#define EXCE_ACE_INIT_FWK_FAILED 0x0003
+#define EXCE_ACE_APP_ENTRY_MISSING 0x0004
+#define EXCE_ACE_APP_ENTRY_FILE_TOO_HUGE 0x0005
+#define EXCE_ACE_APP_ALREADY_LAUNCHED 0x0006
+#define EXCE_ACE_APP_INDEX_MISSING 0x0007
+#define EXCE_ACE_APP_FILE_TOO_HUGE 0x0008
+#define EXCE_ACE_APP_FILE_READ_FAILED 0x0009
+#define EXCE_ACE_APP_JS_EVAL_FAILED 0x000A
+#define EXCE_ACE_APP_NO_RENDER_FUNC 0x000B
+#define EXCE_ACE_APP_RENDER_FAILED 0x000C
+
+// ACE framework error code : router replace
+#define EXCE_ACE_ROUTER_REPLACE_BIND_URI_FAILED 0x0001
+#define EXCE_ACE_PAGE_INDEX_MISSING 0x0002
+#define EXCE_ACE_PAGE_FILE_TOO_HUGE 0x0003
+#define EXCE_ACE_PAGE_FILE_READ_FAILED 0x0004
+#define EXCE_ACE_PAGE_JS_EVAL_FAILED 0x0005
+#define EXCE_ACE_PAGE_NO_RENDER_FUNC 0x0006
+#define EXCE_ACE_PAGE_RENDER_FAILED 0x0007
+
+// ACE framework error code : async work
+#define EXCE_ACE_ASYNC_WORK_DISPATCH_FAILED 0x0001
+
+// ACE framework error code : localization
+#define EXCE_ACE_LOCALIZATION_SYSTEM_LANGUAGE_NOT_INITIALIZED 0x0001
+#define EXCE_ACE_LOCALIZATION_CJSON_CREATE_FAILED 0x0002
+#define EXCE_ACE_LOCALIZATION_VALUE_FAILED 0x0003
+
+#endif // OHOS_ACELITE_ACE_EVENT_ID_H
\ No newline at end of file
diff --git a/src/core/base/ace_log.cpp b/frameworks/src/core/base/ace_log.cpp
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/base/ace_log.cpp
rename to frameworks/src/core/base/ace_log.cpp
diff --git a/src/core/base/ace_log.h b/frameworks/src/core/base/ace_log.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/base/ace_log.h
rename to frameworks/src/core/base/ace_log.h
diff --git a/frameworks/src/core/base/ace_mem_base.cpp b/frameworks/src/core/base/ace_mem_base.cpp
new file mode 100755
index 0000000..9552526
--- /dev/null
+++ b/frameworks/src/core/base/ace_mem_base.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ace_mem_base.h"
+
+#include
+#include "cache_manager.h"
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * @brief g_customHookSet
+ * Record the memory hooks used for ACE, only can be setup once when system start-up.
+ * The standard memory allocating methods are used as default.
+ */
+static ACEMemHooks g_memoryHooks = {malloc, free, calloc};
+/**
+ * @brief g_customHookSet flag for representing if the customer hooks are set
+ */
+static bool g_customHookSet = false;
+
+void InitMemHooks(const ACEMemHooks &hooks)
+{
+ if (g_customHookSet) {
+ // only can be configured once
+ return;
+ }
+ if ((hooks.malloc_func == nullptr) || (hooks.free_func == nullptr)) {
+ // the malloc and free must be given
+ return;
+ }
+ g_memoryHooks.malloc_func = hooks.malloc_func;
+ g_memoryHooks.free_func = hooks.free_func;
+ g_memoryHooks.calloc_func = hooks.calloc_func;
+ // set the flag
+ g_customHookSet = true;
+}
+
+void InitCacheBuf(uintptr_t bufAddress, size_t bufSize)
+{
+ CacheManager::GetInstance().SetupCacheMemInfo(bufAddress, bufSize);
+}
+
+void *ace_malloc(size_t size)
+{
+ return g_memoryHooks.malloc_func(size);
+}
+
+void *ace_calloc(size_t num, size_t size)
+{
+ return (g_memoryHooks.calloc_func != nullptr) ? (g_memoryHooks.calloc_func(num, size)) : nullptr;
+}
+
+void ace_free(void *ptr)
+{
+ g_memoryHooks.free_func(ptr);
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/src/core/base/ace_version.h b/frameworks/src/core/base/ace_version.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/base/ace_version.h
rename to frameworks/src/core/base/ace_version.h
diff --git a/frameworks/src/core/base/async_task_manager.cpp b/frameworks/src/core/base/async_task_manager.cpp
new file mode 100755
index 0000000..5f0d4e1
--- /dev/null
+++ b/frameworks/src/core/base/async_task_manager.cpp
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "async_task_manager.h"
+#include "ace_log.h"
+#include "fatal_handler.h"
+
+#if (defined(__LINUX__) || defined(__LITEOS_A__))
+#define TRY_LOCK() \
+ { \
+ pthread_mutex_lock(&lock_); \
+ }
+
+#define TRY_UNLOCK() \
+ { \
+ pthread_mutex_unlock(&lock_); \
+ }
+#elif defined(__LITEOS_M__)
+#define TRY_LOCK() \
+ { \
+ LOS_TaskLock(); \
+ }
+#define TRY_UNLOCK() \
+ { \
+ LOS_TaskUnlock(); \
+ }
+#else
+#define TRY_LOCK() \
+ { \
+ }
+#define TRY_UNLOCK() \
+ { \
+ }
+#endif
+
+namespace OHOS {
+namespace ACELite {
+AsyncTaskManager::AsyncTaskManager()
+ : head_(nullptr),
+ tail_(nullptr),
+#if (defined(__LINUX__) || defined(__LITEOS_A__))
+ lock_(PTHREAD_MUTEX_INITIALIZER),
+#endif
+ uniqueTaskID_(0),
+ front_(true)
+{
+#if (defined(__LINUX__) || defined(__LITEOS_A__))
+ pthread_mutex_init(&lock_, nullptr);
+#endif
+}
+
+AsyncTaskManager::~AsyncTaskManager()
+{
+ while (head_ != nullptr) {
+ AsyncTask *task = head_;
+ head_ = head_->next;
+ delete task;
+ task = nullptr;
+ }
+ tail_ = nullptr;
+}
+
+AsyncTaskManager &AsyncTaskManager::GetInstance()
+{
+ static AsyncTaskManager instance;
+ return instance;
+}
+
+void AsyncTaskManager::Init()
+{
+ Task::Init();
+}
+
+void AsyncTaskManager::Callback()
+{
+ if (!front_) {
+ return;
+ }
+
+ while (head_ != nullptr) {
+ AsyncTask *task = head_;
+ task->handler(task->data);
+ if (head_ == tail_) {
+ tail_ = nullptr;
+ }
+ head_ = head_->next;
+ delete task;
+ task = nullptr;
+ }
+}
+
+uint16_t AsyncTaskManager::Dispatch(AsyncTaskHandler handler, void *data)
+{
+ if (handler == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "AsyncTaskManager::Dispatch failed: handler is null.");
+ return DISPATCH_FAILURE;
+ }
+ if (FatalHandler::GetInstance().IsFatalErrorHitted()) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "AsyncTaskManager::Dispatch failed: Fatal error is hitted.");
+ return DISPATCH_FAILURE;
+ }
+ TRY_LOCK();
+ auto *task = new AsyncTask();
+ if (task == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "AsyncTaskManager::Dispatch failed: out of memory.");
+ TRY_UNLOCK();
+ return DISPATCH_FAILURE;
+ }
+ task->handler = handler;
+ task->data = data;
+ task->id = (++uniqueTaskID_);
+ task->next = nullptr;
+ if (head_ == nullptr) {
+ head_ = task;
+ tail_ = task;
+ } else {
+ tail_->next = task;
+ tail_ = task;
+ }
+ TRY_UNLOCK();
+ return uniqueTaskID_;
+}
+
+void AsyncTaskManager::Cancel(uint16_t taskID)
+{
+ if (DISPATCH_FAILURE == taskID) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "AsyncTaskManager::Cancel failed: invalid task ID.");
+ return;
+ }
+ TRY_LOCK();
+ AsyncTask *node = head_;
+ AsyncTask *prev = nullptr;
+ while (node != nullptr) {
+ if (node->id == taskID) {
+ if (prev == nullptr) {
+ head_ = head_->next;
+ } else {
+ prev->next = node->next;
+ if (node == tail_) {
+ tail_ = prev;
+ }
+ }
+ delete node;
+ node = nullptr;
+ break;
+ }
+ prev = node;
+ node = node->next;
+ }
+ TRY_UNLOCK();
+}
+
+void AsyncTaskManager::SetFront(bool front)
+{
+ front_ = front;
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/base/async_task_manager.h b/frameworks/src/core/base/async_task_manager.h
new file mode 100755
index 0000000..7d8a0a9
--- /dev/null
+++ b/frameworks/src/core/base/async_task_manager.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_ASYNC_TASK_MANAGER_H
+#define OHOS_ACELITE_ASYNC_TASK_MANAGER_H
+
+#if (defined(__LINUX__) || defined(__LITEOS_A__))
+#include
+#elif defined(__LITEOS_M__)
+#include "los_task.h"
+#endif
+
+#include "common/task_manager.h"
+#include "memory_heap.h"
+#include "non_copyable.h"
+
+namespace OHOS {
+namespace ACELite {
+using AsyncTaskHandler = void (*)(void *);
+
+struct AsyncTask final : public MemoryHeap {
+ uint16_t id;
+ AsyncTaskHandler handler;
+ void *data;
+ AsyncTask *next;
+};
+
+constexpr uint16_t DISPATCH_FAILURE = 0;
+
+class AsyncTaskManager final : public Task {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(AsyncTaskManager);
+
+ static AsyncTaskManager &GetInstance();
+
+ virtual void Init() override;
+
+ virtual void Callback() override;
+
+ uint16_t Dispatch(AsyncTaskHandler handler, void *data);
+
+ void Cancel(uint16_t taskID);
+
+ void SetFront(bool front);
+
+private:
+ AsyncTaskManager();
+
+ ~AsyncTaskManager();
+
+ AsyncTask *head_;
+ AsyncTask *tail_;
+#if (defined(__LINUX__) || defined(__LITEOS_A__))
+ pthread_mutex_t lock_;
+#endif
+ uint16_t uniqueTaskID_;
+ bool front_;
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif
\ No newline at end of file
diff --git a/frameworks/src/core/base/cache/cache_config.h b/frameworks/src/core/base/cache/cache_config.h
new file mode 100644
index 0000000..0c8c9f1
--- /dev/null
+++ b/frameworks/src/core/base/cache/cache_config.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_CACHE_CONFIG_H
+#define OHOS_ACELITE_CACHE_CONFIG_H
+
+#include
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * The magic number used at the beginning of every cache memory area.
+ */
+constexpr uint8_t MAGIC_NUMBER_LENGTH = 4; // count in bytes
+constexpr uint32_t CACHE_MEM_MAGIC_NUMBER = 0xCCCCCCCC;
+
+constexpr uint8_t ALIGNMENT_SIZE = 8;
+
+/**
+ * Every cache user can not use more than the max length buffer.
+ * Count in KB.
+ */
+constexpr uint8_t CACHE_UNIT_MAX_KBS = 128; // max 128KB
+constexpr uint32_t CACHE_UNIT_MAX_BYTES = CACHE_UNIT_MAX_KBS * 1024;
+
+/**
+ * Define the purpose of the specific cache memory range.
+ */
+enum CacheUser : uint8_t {
+ USER_LOCALICATION,
+ USER_PAGE_FILE,
+ USER_MAX_COUNT
+};
+
+/**
+ * Records the cache requester info.
+ */
+struct CacheUnit {
+ // the cache unit owner
+ CacheUser cacheUser_;
+ // the required min buffer length, count in KB, max is 255KB
+ uint8_t minLength_;
+ // constructors
+ CacheUnit() : cacheUser_(USER_MAX_COUNT), minLength_(CACHE_UNIT_MAX_KBS) {}
+ CacheUnit(CacheUser user, uint8_t length) : cacheUser_(user), minLength_(length) {}
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // OHOS_ACELITE_CACHE_CONFIG_H
\ No newline at end of file
diff --git a/frameworks/src/core/base/cache/cache_manager.cpp b/frameworks/src/core/base/cache/cache_manager.cpp
new file mode 100644
index 0000000..32d663a
--- /dev/null
+++ b/frameworks/src/core/base/cache/cache_manager.cpp
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "cache_manager.h"
+
+#include "ace_log.h"
+#include "securec.h"
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * This table will decide the cache usage distribution. If one module want to use cache functionality,
+ * it must config here first. The cache manager will assign buffer according to the actual whole
+ * buffer rang, if the buffer supplement is rich, every cache user might be assigned one buffer
+ * rang bigger than its lowest requirement.
+ *
+ * NOTE: the user must not be duplicated in this list
+ */
+const CacheUnit CacheManager::DEFAULT_CONFIG_TABLE[] = {
+ {USER_LOCALICATION, 16}, // localication key-value cache, lowest 16KB
+};
+
+CacheManager::CacheManager() : cacheState_(STATE_NORMAL)
+{
+ configTable_ = DEFAULT_CONFIG_TABLE;
+ configTableLen_ = sizeof(DEFAULT_CONFIG_TABLE) / sizeof(CacheUnit);
+ ResetDistributedInfo();
+}
+
+CacheManager &CacheManager::GetInstance()
+{
+ static CacheManager cacheManager;
+ return cacheManager;
+}
+
+void CacheManager::ResetDistributedInfo()
+{
+ wholeCacheMemInfo_.cacheStartAddr = 0;
+ wholeCacheMemInfo_.cacheLength = 0;
+ if (EOK !=
+ memset_s(cacheUnitInfo_, sizeof(CacheMemInfo) * USER_MAX_COUNT, 0, sizeof(CacheMemInfo) * USER_MAX_COUNT)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "reset cache info failed");
+ }
+}
+
+void CacheManager::SetConfigTable(const CacheUnit *table, size_t count)
+{
+ if (cacheState_ == STATE_SUCCESS) {
+ // reset
+ cacheState_ = STATE_NORMAL;
+ ResetDistributedInfo();
+ }
+ configTable_ = table;
+ configTableLen_ = count;
+}
+
+void CacheManager::SetupCacheMemInfo(uintptr_t startAddr, size_t length)
+{
+ // only can be setup once
+ if (cacheState_ == STATE_SUCCESS) {
+ return;
+ }
+ // try to distribute the whole buffer, and if the buffer length can not meet the lowest requirement, just give up
+ cacheState_ = DistributeCacheRange(startAddr, length);
+ if (cacheState_ != STATE_SUCCESS) {
+ return;
+ }
+ wholeCacheMemInfo_.cacheStartAddr = startAddr;
+ wholeCacheMemInfo_.cacheLength = length;
+}
+
+CacheSetupState CacheManager::DistributeCacheRange(uintptr_t startAddr, size_t totalBytes)
+{
+ if (configTableLen_ == 0 || configTable_ == nullptr) {
+ // no user, return normal as no one cares
+ return STATE_NORMAL;
+ }
+ if (startAddr == 0 || totalBytes == 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "error cache buffer rang!");
+ return STATE_FAILURE;
+ }
+ // count in KB
+ size_t lowestRequirement = 0;
+ size_t index = 0;
+ while (index < configTableLen_) {
+ lowestRequirement = lowestRequirement + configTable_[index].minLength_;
+ index++;
+ }
+ constexpr uint16_t bytesOneKB = 1024;
+ size_t totalKBs = totalBytes / bytesOneKB;
+ if (lowestRequirement > totalKBs) {
+ // the given buffer is less than the lowest requirement
+ HILOG_ERROR(HILOG_MODULE_ACE, "the cache buffer length can not meet the lowest requirement!");
+ return STATE_FAILURE;
+ }
+
+ index = 0;
+ // will put one magic number at the begin and end of every buffer
+ constexpr uint8_t magicNumberCount = 2;
+ size_t offset = 0;
+ while (index < configTableLen_) {
+ size_t requestBytes = (configTable_[index].minLength_ * bytesOneKB) + (MAGIC_NUMBER_LENGTH * magicNumberCount);
+ uintptr_t startPos = startAddr + offset;
+ cacheUnitInfo_[configTable_[index].cacheUser_].cacheStartAddr = startPos;
+ cacheUnitInfo_[configTable_[index].cacheUser_].cacheLength = requestBytes;
+ // set magic number
+ *(reinterpret_cast(startPos)) = CACHE_MEM_MAGIC_NUMBER;
+ *(reinterpret_cast(startPos + requestBytes - MAGIC_NUMBER_LENGTH)) = CACHE_MEM_MAGIC_NUMBER;
+ offset = offset + requestBytes;
+ index++;
+ }
+ return STATE_SUCCESS;
+}
+
+bool CacheManager::IsEnvReady(CacheUser user) const
+{
+ if (cacheState_ != STATE_SUCCESS) {
+ return false;
+ }
+ return ((user < USER_MAX_COUNT) && (cacheUnitInfo_[user].cacheStartAddr != 0));
+}
+
+uintptr_t CacheManager::GetCacheBufAddress(CacheUser user) const
+{
+ if (!IsEnvReady(user)) {
+ return 0;
+ }
+ return cacheUnitInfo_[user].cacheStartAddr + MAGIC_NUMBER_LENGTH;
+}
+
+size_t CacheManager::GetCacheBufLength(CacheUser user) const
+{
+ if (!IsEnvReady(user)) {
+ return 0;
+ }
+ return cacheUnitInfo_[user].cacheLength;
+}
+
+bool CacheManager::IsCacheOverflow(CacheUser user) const
+{
+ if (!IsEnvReady(user)) {
+ return false;
+ }
+ // get head and tail magic number
+ uint32_t *bufferHead = reinterpret_cast(cacheUnitInfo_[user].cacheStartAddr);
+ uint32_t headMagicNumber = reinterpret_cast(*(bufferHead));
+ uint32_t *bufferTail = reinterpret_cast(cacheUnitInfo_[user].cacheStartAddr +
+ cacheUnitInfo_[user].cacheLength - MAGIC_NUMBER_LENGTH);
+ uint32_t tailMagicNumber = reinterpret_cast(*(bufferTail));
+ // if the head magic number was over write, it means someone else overflow this area
+ if (headMagicNumber != CACHE_MEM_MAGIC_NUMBER) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "the cache buffer[%d] was overflown by someone else?", user);
+ return true;
+ }
+ // if the tail magic number was over write, it means the user itself overflow this area
+ if (tailMagicNumber != CACHE_MEM_MAGIC_NUMBER) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "the cache buffer[%d] was overflown by self?", user);
+ return true;
+ }
+ return false;
+}
+
+bool CacheManager::IsWholeCacheHealthy() const
+{
+ if (cacheState_ != STATE_SUCCESS) {
+ return false;
+ }
+ for (int i = 0; i < USER_MAX_COUNT; i++) {
+ if (IsCacheOverflow(CacheUser(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/base/cache/cache_manager.h b/frameworks/src/core/base/cache/cache_manager.h
new file mode 100644
index 0000000..49a2376
--- /dev/null
+++ b/frameworks/src/core/base/cache/cache_manager.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_CACHE_MANAGER_H
+#define OHOS_ACELITE_CACHE_MANAGER_H
+
+#include "cache_config.h"
+
+#include
+#include
+#include "non_copyable.h"
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * The structure used for recording the cache memory detail information.
+ */
+struct CacheMemInfo {
+ // the cache memory start address, including the magic number at beginning
+ uintptr_t cacheStartAddr;
+ // count in bytes, and the max capability is 4M, including the maginc number at the beginning and ending
+ size_t cacheLength;
+};
+
+enum CacheSetupState : uint8_t {
+ STATE_NORMAL, // the cache is not initialized ever, or no user is configured
+ STATE_SUCCESS, // the cache was initialized and distributed to all users successfully
+ STATE_FAILURE, // the cache was tried be initialized but failed to distributed to all users
+};
+
+/**
+ * This is one singleton instance for cache memory management. It can be used
+ * out of the applications' lifecycle. It records the memory area for all kinds
+ * of caching purpose in the frameworks. If the cache memory rang is not setup,
+ * the cache functionality will not work.
+ */
+class CacheManager final {
+public:
+ static CacheManager &GetInstance();
+ void SetupCacheMemInfo(uintptr_t startAddr, size_t length);
+ uintptr_t GetCacheBufAddress(CacheUser user) const;
+ size_t GetCacheBufLength(CacheUser user) const;
+ bool IsCacheAvailable(CacheUser user) const;
+ bool IsCacheOverflow(CacheUser user) const;
+ bool IsWholeCacheHealthy() const;
+ /**
+ * @brief SetConfigTable give the config table from outside, call this function carefully
+ * @param table the config table
+ * @param count the actual user count
+ */
+ void SetConfigTable(const CacheUnit *table, size_t count);
+
+private:
+ ACE_DISALLOW_COPY_AND_MOVE(CacheManager);
+ CacheManager();
+ ~CacheManager() = default;
+ /**
+ * @brief ResetDistributedInfo clean up all assigned buffer info
+ */
+ void ResetDistributedInfo();
+ /**
+ * @brief DistributeCacheRange called once to assign proper memory rang to all the user in the config table
+ * @param startAddr the entire cache buffer start address
+ * @param length the entire cache length
+ * @return the result of the assignment process, if the memory size can not meet the lowest request, the process
+ * will return false as failure
+ */
+ CacheSetupState DistributeCacheRange(uintptr_t startAddr, size_t length);
+ bool IsEnvReady(CacheUser user) const;
+ CacheMemInfo wholeCacheMemInfo_;
+ CacheMemInfo cacheUnitInfo_[USER_MAX_COUNT]; // count in bytes
+ const CacheUnit *configTable_;
+ size_t configTableLen_;
+ CacheSetupState cacheState_;
+ static const CacheUnit DEFAULT_CONFIG_TABLE[];
+};
+} // namespace ACELite
+} // namespace OHOS
+
+#endif // OHOS_ACELITE_CACHE_MANAGER_H
\ No newline at end of file
diff --git a/src/core/async/BUILD.gn b/frameworks/src/core/base/cache/test/unittest/BUILD.gn
similarity index 53%
rename from src/core/async/BUILD.gn
rename to frameworks/src/core/base/cache/test/unittest/BUILD.gn
index 4e95508..3780b5d 100755
--- a/src/core/async/BUILD.gn
+++ b/frameworks/src/core/base/cache/test/unittest/BUILD.gn
@@ -1,4 +1,4 @@
-#Copyright (c) 2020 Huawei Device Co., Ltd.
+#Copyright (c) 2021 Huawei Device Co., Ltd.
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
@@ -9,16 +9,19 @@
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
-#limitations under the License.
+#limitations under the License.
-source_set("async") {
- configs += [
- "//foundation/ace/lite/jsfwk:ace_config",
- ]
- sources = [
- "js_async_work.cpp",
- "message_queue_utils.cpp",
- ]
- include_dirs = [
- ]
+import("//build/lite/config/test.gni")
+import("//foundation/ace/ace_engine_lite/test/ace_test_config.gni")
+
+unittest("js_frameworks_test_cache_manager") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [ "common/cache_manager_tdd_test.cpp" ]
+ deps = ace_test_deps
+}
+
+group("cache_manager_unittest") {
+ deps = [ ":js_frameworks_test_cache_manager" ]
}
diff --git a/frameworks/src/core/base/cache/test/unittest/common/cache_manager_tdd_test.cpp b/frameworks/src/core/base/cache/test/unittest/common/cache_manager_tdd_test.cpp
new file mode 100755
index 0000000..190446d
--- /dev/null
+++ b/frameworks/src/core/base/cache/test/unittest/common/cache_manager_tdd_test.cpp
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "cache_manager_tdd_test.h"
+
+#include "ace_mem_base.h"
+
+namespace OHOS {
+namespace ACELite {
+const CacheUnit CacheManagerTddTest::TEST_CONFIG_TABLE[] = {
+ {USER_LOCALICATION, 16}, // localication key-value cache, lowest 16KB
+};
+
+void CacheManagerTddTest::SetUp()
+{
+ const size_t count = 1;
+ CacheManager::GetInstance().SetConfigTable(TEST_CONFIG_TABLE, count);
+}
+
+/**
+ * @tc.name: CacheDistributeTest001
+ * @tc.desc: Verify the cache distribution process
+ * @tc.require: AR000F8FOG
+ */
+HWTEST_F(CacheManagerTddTest, CacheDistribute001, TestSize.Level1)
+{
+ /**
+ * @tc.steps: step1. prepare cache buffer
+ */
+ const size_t totalSize = 20 * 1024; // 20KB
+ char *buffer = static_cast(ace_malloc(sizeof(char) * totalSize));
+ if (buffer == nullptr) {
+ return;
+ }
+ /**
+ * @tc.steps: step2. trigger the cache setup
+ */
+ uintptr_t startAddr = reinterpret_cast(buffer);
+ CacheManager::GetInstance().SetupCacheMemInfo(startAddr, totalSize);
+ /**
+ * @tc.steps: step3. verify the result
+ */
+ uintptr_t localicationPos = CacheManager::GetInstance().GetCacheBufAddress(CacheUser::USER_LOCALICATION);
+ size_t localicationBufSize = CacheManager::GetInstance().GetCacheBufLength(CacheUser::USER_LOCALICATION);
+ const uintptr_t targetPos = startAddr + MAGIC_NUMBER_LENGTH;
+ const size_t unit = 1024;
+ const uint8_t magicNumberCount = 2;
+ const uint8_t localicationMin = 16;
+ const size_t targetLength = (localicationMin * unit) + (magicNumberCount * MAGIC_NUMBER_LENGTH);
+ EXPECT_EQ(localicationPos, targetPos);
+ EXPECT_EQ(localicationBufSize, targetLength);
+ ace_free(buffer);
+ buffer = nullptr;
+}
+
+/**
+ * @tc.name: CacheDistributeTest002
+ * @tc.desc: Verify the cache distribution process
+ * @tc.require: AR000F8FOG
+ */
+HWTEST_F(CacheManagerTddTest, CacheDistribute002, TestSize.Level1)
+{
+ /**
+ * @tc.steps: step1. prepare cache buffer
+ */
+ const size_t totalSize = 20 * 1024; // 40KB
+ char *buffer = static_cast(ace_malloc(sizeof(char) * totalSize));
+ if (buffer == nullptr) {
+ return;
+ }
+ const uint8_t pageFileBufLength = 6;
+ const uint8_t localicationBufLength = 8;
+ const CacheUnit customerCacheUnitTable[] = {
+ {USER_PAGE_FILE, pageFileBufLength},
+ {USER_LOCALICATION, localicationBufLength},
+ };
+ /**
+ * @tc.steps: step2. trigger the cache setup
+ */
+ const size_t count = 2;
+ CacheManager::GetInstance().SetConfigTable(customerCacheUnitTable, count);
+ uintptr_t startAddr = reinterpret_cast(buffer);
+ CacheManager::GetInstance().SetupCacheMemInfo(startAddr, totalSize);
+ /**
+ * @tc.steps: step3. verify the result
+ */
+ uintptr_t bufferPos = CacheManager::GetInstance().GetCacheBufAddress(CacheUser::USER_LOCALICATION);
+ size_t bufSize = CacheManager::GetInstance().GetCacheBufLength(CacheUser::USER_LOCALICATION);
+ const size_t unit = 1024;
+ const uint8_t magicNumberCount = 2;
+ uintptr_t targetPos =
+ startAddr + (pageFileBufLength * unit) + (magicNumberCount * MAGIC_NUMBER_LENGTH) + MAGIC_NUMBER_LENGTH;
+ const size_t targetLength = (localicationBufLength * unit) + (magicNumberCount * MAGIC_NUMBER_LENGTH);
+ EXPECT_EQ(bufferPos, targetPos);
+ EXPECT_EQ(bufSize, targetLength);
+ ace_free(buffer);
+ buffer = nullptr;
+}
+
+/**
+ * @tc.name: CacheDistributeTest003
+ * @tc.desc: Verify the cache distribution process
+ * @tc.require: AR000F8FOG
+ */
+HWTEST_F(CacheManagerTddTest, CacheDistribute003, TestSize.Level1)
+{
+ /**
+ * @tc.steps: step1. prepare cache buffer
+ */
+ const size_t totalSize = 2 * 1024; // 2KB
+ char *buffer = static_cast(ace_malloc(sizeof(char) * totalSize));
+ if (buffer == nullptr) {
+ return;
+ }
+
+ /**
+ * @tc.steps: step2. trigger the cache setup
+ */
+ uintptr_t startAddr = reinterpret_cast(buffer);
+ CacheManager::GetInstance().SetupCacheMemInfo(startAddr, totalSize);
+ /**
+ * @tc.steps: step3. verify the result
+ */
+ uintptr_t localPos = CacheManager::GetInstance().GetCacheBufAddress(CacheUser::USER_LOCALICATION);
+ size_t localBufSize = CacheManager::GetInstance().GetCacheBufLength(CacheUser::USER_LOCALICATION);
+ EXPECT_EQ(localPos, 0);
+ EXPECT_EQ(localBufSize, 0);
+ ace_free(buffer);
+ buffer = nullptr;
+}
+
+/**
+ * @tc.name: CacheDistributeTest004
+ * @tc.desc: Verify the cache distribution process
+ * @tc.require: AR000F8FOG
+ */
+HWTEST_F(CacheManagerTddTest, CacheDistribute004, TestSize.Level1)
+{
+ /**
+ * @tc.steps: step1. prepare cache buffer
+ */
+ const size_t totalSize = 20 * 1024; // 20KB
+ char *buffer = static_cast(ace_malloc(sizeof(char) * totalSize));
+ if (buffer == nullptr) {
+ return;
+ }
+
+ /**
+ * @tc.steps: step2. trigger the cache setup
+ */
+ uintptr_t startAddr = reinterpret_cast(buffer);
+ CacheManager::GetInstance().SetupCacheMemInfo(startAddr, totalSize);
+ /**
+ * @tc.steps: step3. verify the result
+ */
+ uintptr_t bufStartPos = CacheManager::GetInstance().GetCacheBufAddress(CacheUser::USER_LOCALICATION);
+ size_t bufLength = CacheManager::GetInstance().GetCacheBufLength(CacheUser::USER_LOCALICATION);
+ uint32_t headMagicNumber = *(uint32_t *)(bufStartPos - MAGIC_NUMBER_LENGTH);
+ EXPECT_EQ(headMagicNumber, CACHE_MEM_MAGIC_NUMBER);
+ const uint8_t magicNumberCount = 2;
+ uint32_t tailMagicNumber = *(uint32_t *)(bufStartPos + bufLength - (magicNumberCount * MAGIC_NUMBER_LENGTH));
+ EXPECT_EQ(tailMagicNumber, CACHE_MEM_MAGIC_NUMBER);
+ ace_free(buffer);
+ buffer = nullptr;
+}
+
+/**
+ * @tc.name: CacheDistributeTest005
+ * @tc.desc: Verify the cache distribution process and overflow checking
+ * @tc.require: AR000F8FOG
+ */
+HWTEST_F(CacheManagerTddTest, CacheDistribute005, TestSize.Level1)
+{
+ /**
+ * @tc.steps: step1. prepare cache buffer
+ */
+ const size_t totalSize = 20 * 1024; // 20KB
+ char *buffer = static_cast(ace_malloc(sizeof(char) * totalSize));
+ if (buffer == nullptr) {
+ return;
+ }
+
+ /**
+ * @tc.steps: step2. trigger the cache setup
+ */
+ uintptr_t startAddr = reinterpret_cast(buffer);
+ CacheManager::GetInstance().SetupCacheMemInfo(startAddr, totalSize);
+ size_t bufLength = CacheManager::GetInstance().GetCacheBufLength(CacheUser::USER_LOCALICATION);
+ if (bufLength < MAGIC_NUMBER_LENGTH) {
+ ace_free(buffer);
+ buffer = nullptr;
+ return;
+ }
+ /**
+ * @tc.steps: step3. overflow the cache head and tail
+ */
+ buffer[0] = 0x11;
+ size_t tailPos = bufLength - MAGIC_NUMBER_LENGTH;
+ buffer[tailPos] = 0x22;
+ EXPECT_TRUE(CacheManager::GetInstance().IsCacheOverflow(CacheUser::USER_LOCALICATION));
+ EXPECT_FALSE(CacheManager::GetInstance().IsWholeCacheHealthy());
+ ace_free(buffer);
+ buffer = nullptr;
+}
+
+/**
+ * used for debugging TDD implementation on simulator
+ */
+void CacheManagerTddTest::RunTests()
+{
+#ifndef TDD_ASSERTIONS
+ CacheDistribute001();
+ CacheDistribute002();
+ CacheDistribute003();
+ CacheDistribute004();
+ CacheDistribute005();
+#endif // TDD_ASSERTIONS
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/base/cache/test/unittest/common/cache_manager_tdd_test.h b/frameworks/src/core/base/cache/test/unittest/common/cache_manager_tdd_test.h
new file mode 100755
index 0000000..ddbaff6
--- /dev/null
+++ b/frameworks/src/core/base/cache/test/unittest/common/cache_manager_tdd_test.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_CACHE_MANAGER_TDD_TEST_H
+#define OHOS_ACELITE_CACHE_MANAGER_TDD_TEST_H
+
+#include "acelite_config.h"
+#include "cache_config.h"
+#include "cache_manager.h"
+#ifdef TDD_ASSERTIONS
+#include
+#include
+#endif
+#include "test_common.h"
+
+namespace OHOS {
+namespace ACELite {
+#ifdef TDD_ASSERTIONS
+using namespace std;
+using namespace testing::ext;
+class CacheManagerTddTest : public testing::Test {
+#else
+class CacheManagerTddTest {
+#endif
+public:
+ CacheManagerTddTest() = default;
+ ~CacheManagerTddTest() = default;
+ void SetUp();
+ void CacheDistribute001();
+ void CacheDistribute002();
+ void CacheDistribute003();
+ void CacheDistribute004();
+ void CacheDistribute005();
+ void RunTests();
+
+private:
+ static const CacheUnit TEST_CONFIG_TABLE[];
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // OHOS_ACELITE_CACHE_MANAGER_TDD_TEST_H
\ No newline at end of file
diff --git a/src/core/base/dft_impl.cpp b/frameworks/src/core/base/dft_impl.cpp
similarity index 77%
rename from src/core/base/dft_impl.cpp
rename to frameworks/src/core/base/dft_impl.cpp
index 2815504..fa97af2 100755
--- a/src/core/base/dft_impl.cpp
+++ b/frameworks/src/core/base/dft_impl.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,7 +15,7 @@
#include "dft_impl.h"
-#ifdef OHOS_ACELITE_PRODUCT_WATCH
+#if (defined(OHOS_ACELITE_PRODUCT_WATCH))||(defined(CHANGE_START_PAGE))
#include "ace_log.h"
#include "js_app_context.h"
@@ -57,13 +57,24 @@ void DftImpl::RegisterPageReplaced(PageReplacedCallback handler)
pageReplacedCallback_ = handler;
}
-void DftImpl::CallbackPageReplaced(int state)
+void DftImpl::RegisterPageChangedCallback(PageInfoFunc pageInfoFunc)
+{
+ pageInfoFunc_ = pageInfoFunc;
+}
+
+void DftImpl::CallbackPageReplaced(int state, const char *param)
{
if (pageReplacedCallback_ != nullptr) {
char *currentPath = DftImpl::GetPagePath();
pageReplacedCallback_(currentPath, state);
ACE_FREE(currentPath);
}
+ if ((pageInfoFunc_ != nullptr) && (param != nullptr)) {
+ Param value;
+ value.routerParam = param;
+ value.path = JsAppContext::GetInstance()->GetCurrentJsPath();
+ pageInfoFunc_(value);
+ }
}
} // namespace ACELite
} // namespace OHOS
diff --git a/frameworks/src/core/base/dfx_assist.cpp b/frameworks/src/core/base/dfx_assist.cpp
new file mode 100644
index 0000000..ed2fff9
--- /dev/null
+++ b/frameworks/src/core/base/dfx_assist.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "dfx_assist.h"
+#include "ace_log.h"
+#include "jerryscript-core.h"
+#include "presets/console_log_impl.h"
+
+namespace OHOS {
+namespace ACELite {
+void DfxAssist::DumpErrorCode(const jerry_value_t errorValue)
+{
+ const uint16_t errorMsgMaxLength = 128;
+ if (!jerry_is_feature_enabled(JERRY_FEATURE_ERROR_MESSAGES)) {
+ return;
+ }
+
+ jerry_value_t errValue = jerry_get_value_from_error(errorValue, false);
+ jerry_value_t errStrVal = jerry_value_to_string(errValue);
+ jerry_release_value(errValue);
+
+ if (jerry_value_is_error(errStrVal)) {
+ /* Avoid recursive error throws. */
+ HILOG_ERROR(HILOG_MODULE_ACE, "[Error value to string failed]");
+ jerry_release_value(errStrVal);
+ return;
+ }
+
+ jerry_size_t errStrSize = jerry_get_utf8_string_size(errStrVal);
+ if (errStrSize >= errorMsgMaxLength) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "[Error message too long]");
+ jerry_release_value(errStrVal);
+ return;
+ }
+
+ jerry_char_t *errStrBuffer = static_cast(ace_malloc(sizeof(jerry_char_t) * (errStrSize + 1)));
+ if (errStrBuffer == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "malloc memory failed!");
+ jerry_release_value(errStrVal);
+ return;
+ }
+ jerry_size_t stringEnd = jerry_string_to_utf8_char_buffer(errStrVal, errStrBuffer, errStrSize);
+ errStrBuffer[stringEnd] = '\0';
+ // output to platform trace
+ HILOG_ERROR(HILOG_MODULE_ACE, " [JS Error]: %s", reinterpret_cast(errStrBuffer));
+ // output to user console
+ LogString(LogLevel::LOG_LEVEL_ERR, "[JS Exception]: ");
+ LogString(LogLevel::LOG_LEVEL_ERR, reinterpret_cast(errStrBuffer));
+ // output line separator to trigger trace output
+ LogString(LogLevel::LOG_LEVEL_ERR, "\n");
+ ace_free(errStrBuffer);
+ errStrBuffer = nullptr;
+ jerry_release_value(errStrVal);
+}
+
+void DfxAssist::DumpErrorMessage(const jerry_value_t errorValue)
+{
+ const uint16_t stackMsgMaxLength = 256;
+ const uint8_t arrMaxLength = 32;
+ jerry_value_t stackStr = jerry_create_string((const jerry_char_t *) "stack");
+ jerry_value_t errorVal = jerry_get_value_from_error(errorValue, false);
+
+ jerry_value_t backtraceVal = jerry_get_property(errorVal, stackStr);
+ jerry_release_value(stackStr);
+ jerry_release_value(errorVal);
+
+ if (jerry_value_is_error(backtraceVal) || !(jerry_value_is_array(backtraceVal))) {
+ jerry_release_value(backtraceVal);
+ return;
+ }
+
+ uint32_t length = jerry_get_array_length(backtraceVal);
+ if (length == 0) {
+ jerry_release_value(backtraceVal);
+ return;
+ }
+ if (length > arrMaxLength) {
+ length = arrMaxLength;
+ }
+
+ jerry_char_t *errStrBuffer = static_cast(ace_malloc(sizeof(jerry_char_t) * (stackMsgMaxLength)));
+ if (errStrBuffer == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "malloc memory failed!");
+ jerry_release_value(backtraceVal);
+ return;
+ }
+ HILOG_ERROR(HILOG_MODULE_ACE, "[Exception backtrace]:");
+ for (uint8_t i = 0; i < length; i++) {
+ jerry_value_t itemVal = jerry_get_property_by_index(backtraceVal, i);
+ jerry_size_t strSize = 0;
+ if (!jerry_value_is_error(itemVal) && jerry_value_is_string(itemVal)) {
+ strSize = jerry_get_utf8_string_size(itemVal);
+ }
+
+ if (strSize >= stackMsgMaxLength) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "%u: [Backtrace string too long]", i);
+ } else {
+ jerry_size_t stringEnd = jerry_string_to_utf8_char_buffer(itemVal, errStrBuffer, strSize);
+ errStrBuffer[stringEnd] = '\0';
+ HILOG_ERROR(HILOG_MODULE_ACE, "%u: %s", i, reinterpret_cast(errStrBuffer));
+ }
+ jerry_release_value(itemVal);
+ }
+ ace_free(errStrBuffer);
+ errStrBuffer = nullptr;
+ jerry_release_value(backtraceVal);
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/base/dfx_assist.h b/frameworks/src/core/base/dfx_assist.h
new file mode 100644
index 0000000..e960ad8
--- /dev/null
+++ b/frameworks/src/core/base/dfx_assist.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_DFX_ASSIST_H
+#define OHOS_ACELITE_DFX_ASSIST_H
+
+#include "acelite_config.h"
+#include "js_app_context.h"
+#include "memory_heap.h"
+#include "non_copyable.h"
+
+namespace OHOS {
+namespace ACELite {
+class DfxAssist final : public MemoryHeap {
+public:
+ DfxAssist() = default;
+
+ ~DfxAssist() = default;
+
+ /**
+ * @fn DfxAssist::DumpErrorCode()
+ *
+ * @brief dump js error error code
+ */
+ void DumpErrorCode(const jerry_value_t errorValue);
+
+ /**
+ * @fn DfxAssist::DumpErrorMessage()
+ *
+ * @brief dump js stack error message
+ */
+ void DumpErrorMessage(const jerry_value_t errorValue);
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // OHOS_ACELITE_DFX_ASSIST_H
diff --git a/frameworks/src/core/base/event_util.cpp b/frameworks/src/core/base/event_util.cpp
new file mode 100755
index 0000000..3da9381
--- /dev/null
+++ b/frameworks/src/core/base/event_util.cpp
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "event_util.h"
+#include "ace_log.h"
+#include "async_task_manager.h"
+
+namespace OHOS {
+namespace ACELite {
+constexpr char ATTR_TYPE[] = "type";
+constexpr char ATTR_TARGET[] = "target";
+constexpr char ATTR_CURRENT_TARGET[] = "currentTarget";
+constexpr char ATTR_TIMESTAMP[] = "timestamp";
+constexpr char ATTR_GLOBAL_X[] = "globalX";
+constexpr char ATTR_GLOBAL_Y[] = "globalY";
+constexpr char ATTR_DIRECTION[] = "direction";
+constexpr char ATTR_DIRECTION_RIGHT[] = "right";
+constexpr char ATTR_DIRECTION_LEFT[] = "left";
+constexpr char ATTR_DIRECTION_UP[] = "up";
+constexpr char ATTR_DIRECTION_DOWN[] = "down";
+const char *EventUtil::EVENT_CLICK = "click";
+const char *EventUtil::EVENT_LONGPRESS = "longpress";
+const char *EventUtil::EVENT_SWIPE = "swipe";
+
+void CallbackExecutor(void *data)
+{
+ if (data == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "failed to execute the callback function of event.");
+ return;
+ }
+
+ auto *params = static_cast(data);
+ if (!JSFunction::Is(params->fn)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "failed to execute the callback function of event.");
+ delete params;
+ params = nullptr;
+ return;
+ }
+ constexpr uint8_t argsLength = 1;
+ JSValue args[argsLength] = {params->arg};
+ JSRelease(JSFunction::Call(params->fn, params->vm, args, argsLength));
+ JSRelease(params->arg);
+ delete params;
+ params = nullptr;
+}
+
+JSValue EventUtil::CreateEvent(const char *type, UIView &view, const Event &event)
+{
+ // create a JAVASCRIPT plain object that is used as the input parameter of
+ // the callback function for click or longpress event.
+ JSValue arg = JSObject::Create();
+ // set the 'type' attribute value
+ JSObject::SetString(arg, ATTR_TYPE, type);
+ // set the 'target' attribute value
+ UIView *target = nullptr;
+ UIView *currentTarget = nullptr;
+ Point point = event.GetCurrentPos();
+ view.GetTargetView(point, ¤tTarget, &target);
+ JSObject::Set(arg, ATTR_TARGET, GetElementByUIView(target));
+ // set the 'currentTarget' attribute value
+ JSObject::Set(arg, ATTR_CURRENT_TARGET, GetElementByUIView(currentTarget));
+ // set the 'timestamp' attribute value
+ JSObject::SetNumber(arg, ATTR_TIMESTAMP, event.GetTimeStamp());
+ // set the 'globalX' attribute
+ JSObject::SetNumber(arg, ATTR_GLOBAL_X, point.x);
+ // set the 'globalY' attribute
+ JSObject::SetNumber(arg, ATTR_GLOBAL_Y, point.y);
+ return arg;
+}
+JSValue EventUtil::CreateSwipeEvent(UIView &view, const DragEvent &event)
+{
+ // create a JAVASCRIPT plain object that is used as the input parameter of
+ // the event callback function.
+ JSValue arg = EventUtil::CreateEvent(EVENT_SWIPE, view, event);
+ // set the 'direction' attribute for the input parameter of the swipe event callback function.
+ switch (event.GetDragDirection()) {
+ case DragEvent::DIRECTION_LEFT_TO_RIGHT: {
+ JSObject::SetString(arg, ATTR_DIRECTION, ATTR_DIRECTION_RIGHT);
+ break;
+ }
+ case DragEvent::DIRECTION_RIGHT_TO_LEFT: {
+ JSObject::SetString(arg, ATTR_DIRECTION, ATTR_DIRECTION_LEFT);
+ break;
+ }
+ case DragEvent::DIRECTION_TOP_TO_BOTTOM: {
+ JSObject::SetString(arg, ATTR_DIRECTION, ATTR_DIRECTION_DOWN);
+ break;
+ }
+ case DragEvent::DIRECTION_BOTTOM_TO_TOP: {
+ JSObject::SetString(arg, ATTR_DIRECTION, ATTR_DIRECTION_UP);
+ break;
+ }
+ default: {
+ HILOG_ERROR(HILOG_MODULE_ACE, "failed to set direction attribute for event argument.");
+ break;
+ }
+ }
+ return arg;
+}
+void EventUtil::InvokeCallback(JSValue vm, JSValue callback, JSValue event)
+{
+ auto *params = new CallbackParams();
+ if (params == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "fail to invoke event callback.");
+ return;
+ }
+ params->vm = vm;
+ params->fn = callback;
+ params->arg = event;
+ // The views may be destroyed or recreated in conditional or list rendering.
+ // If we directly call the event callback function, the program will crash.
+ if (DISPATCH_FAILURE == AsyncTaskManager::GetInstance().Dispatch(CallbackExecutor, static_cast(params))) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "EventUtil::InvokeCallback failed: Async task dispatch failure.");
+ delete params;
+ params = nullptr;
+ JSRelease(event);
+ }
+}
+JSValue EventUtil::GetElementByUIView(UIView *view)
+{
+ if (view == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "fail to get element by UI view.");
+ return JSUndefined::Create();
+ }
+ UIView::ViewExtraMsg *extraMsg = view->GetExtraMsg();
+ if (extraMsg == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "fail to get element by UI view.");
+ return JSUndefined::Create();
+ }
+ JSValue *elementPtr = reinterpret_cast(extraMsg->elementPtr);
+ if (elementPtr == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "fail to get element by UI view.");
+ return JSUndefined::Create();
+ }
+ return *elementPtr;
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/base/event_util.h b/frameworks/src/core/base/event_util.h
new file mode 100755
index 0000000..e4fa6d0
--- /dev/null
+++ b/frameworks/src/core/base/event_util.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_EVENT_UTIL_H
+#define OHOS_ACELITE_EVENT_UTIL_H
+
+#include "non_copyable.h"
+#include "ui_view.h"
+#include "wrapper/js.h"
+
+namespace OHOS {
+namespace ACELite {
+struct CallbackParams : public MemoryHeap {
+ JSValue vm;
+ JSValue fn;
+ JSValue arg;
+};
+class EventUtil final : public MemoryHeap {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(EventUtil);
+
+ /**
+ * @brief Create a JAVASCRIPT plain object that is used as the input parameter of
+ * the callback function for click or longpress event.
+ */
+ static JSValue CreateEvent(const char *type, UIView &view, const Event &event);
+
+ /**
+ * @brief Create a JAVASCRIPT plain object that is used as the input parameter of
+ * the callback function for swipe event.
+ */
+ static JSValue CreateSwipeEvent(UIView &view, const DragEvent &event);
+
+ /**
+ * @brief Invoke the callback function of event.
+ */
+ static void InvokeCallback(JSValue vm, JSValue callback, JSValue event);
+
+ static const char *EVENT_CLICK;
+ static const char *EVENT_LONGPRESS;
+ static const char *EVENT_SWIPE;
+
+private:
+ EventUtil() {}
+ ~EventUtil() {}
+
+ /**
+ * @brief Get the DOM element that is reference to view
+ */
+ static JSValue GetElementByUIView(UIView *view);
+};
+} // namespace ACELite
+} // namespace OHOS
+
+#endif // OHOS_ACELITE_EVENT_UTIL_H
diff --git a/src/core/base/framework_min_bc.h b/frameworks/src/core/base/framework_min_bc.h
old mode 100755
new mode 100644
similarity index 99%
rename from src/core/base/framework_min_bc.h
rename to frameworks/src/core/base/framework_min_bc.h
index f29b227..6c357d5
--- a/src/core/base/framework_min_bc.h
+++ b/frameworks/src/core/base/framework_min_bc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,13 +15,15 @@
// AUTO GENERATED, PLEASE DO NOT EDIT DIRECTLY
+#include
+
#ifndef ACELITE_FRAMEWORK_RAW_BUFFER
#error THIS FILE CAN ONLY BE INCLUDED BY RAW BUFFER CPP
#endif
#ifndef OHOS_ACELITE_FRAMEWORK_MIN_SNAPSHOT_BUFFER
#define OHOS_ACELITE_FRAMEWORK_MIN_SNAPSHOT_BUFFER
-const char g_frameworkBCBuffer[] =
+const uint8_t g_frameworkBCBuffer[] =
{
0x4a, 0x52, 0x52, 0x59, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0a, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03, 0x00,
diff --git a/src/core/base/framework_min_js.h b/frameworks/src/core/base/framework_min_js.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/base/framework_min_js.h
rename to frameworks/src/core/base/framework_min_js.h
diff --git a/src/core/base/js_debugger_config.cpp b/frameworks/src/core/base/js_debugger_config.cpp
old mode 100755
new mode 100644
similarity index 76%
rename from src/core/base/js_debugger_config.cpp
rename to frameworks/src/core/base/js_debugger_config.cpp
index dc1488c..ec0a912
--- a/src/core/base/js_debugger_config.cpp
+++ b/frameworks/src/core/base/js_debugger_config.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,6 +23,12 @@
namespace OHOS {
namespace ACELite {
+Debugger &Debugger::GetInstance()
+{
+ static Debugger instance;
+ return instance;
+}
+
#if ENABLED(ENGINE_DEBUGGER)
bool Debugger::IsDebuggerEnabled()
{
@@ -32,7 +38,6 @@ bool Debugger::IsDebuggerEnabled()
void Debugger::ConfigEngineDebugger(DebuggerConfig &config)
{
debuggerConfig_ = config;
- ConfigDebugger();
}
void Debugger::StartDebugger()
@@ -54,12 +59,9 @@ void Debugger::StartDebugger()
jerryx_debugger_after_connect(protocol && connected);
debuggerStarted_ = true;
}
+
void Debugger::TearDownDebugger()
{
- if (consoleLogFileHandler_ != nullptr) {
- fclose(consoleLogFileHandler_);
- consoleLogFileHandler_ = nullptr;
- }
if ((!debuggerConfig_.startDebuggerServer) || !(jerry_is_feature_enabled(JERRY_FEATURE_DEBUGGER))) {
return;
}
@@ -68,41 +70,14 @@ void Debugger::TearDownDebugger()
debuggerStarted_ = false;
}
-void Debugger::ConfigDebugger()
-{
- if (consoleLogFileHandler_ != nullptr) {
- fclose(consoleLogFileHandler_);
- consoleLogFileHandler_ = nullptr;
- }
-
- if ((debuggerConfig_.logToFile)) {
- if ((debuggerConfig_.logFilePath != nullptr) && (strlen(debuggerConfig_.logFilePath) > 0)) {
- consoleLogFileHandler_ = fopen(debuggerConfig_.logFilePath, "w+");
- if (consoleLogFileHandler_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "can not open the console log output file");
- }
- }
- }
-}
-
void Debugger::Output(const char * const str)
{
- // if debugger enabled, get config from debugger config
- if (consoleLogFileHandler_ != nullptr) {
- int res = fputs(str, consoleLogFileHandler_);
- if (res == EOF) {
- // write file error
- HILOG_ERROR(HILOG_MODULE_ACE, "write log file failed");
- }
- }
// print out the log into stdout anyway
printf("%s", str);
}
+
void Debugger::FlushOutput()
{
- if (consoleLogFileHandler_ != nullptr) {
- fflush(consoleLogFileHandler_);
- }
fflush(stdout);
}
@@ -150,29 +125,33 @@ bool Debugger::IsDebuggerEnabled()
{
return true;
}
+
void Debugger::ConfigEngineDebugger(DebuggerConfig &config)
{
UNUSED(config);
}
+
void Debugger::StartDebugger()
{
}
+
void Debugger::TearDownDebugger()
{
}
-void Debugger::ConfigDebugger()
-{
-}
+
void Debugger::Output(const char * const str)
{
UNUSED(str);
}
+
void Debugger::FlushOutput()
{
}
+
void Debugger::SetupJSContext()
{
}
+
void Debugger::ReleaseJSContext()
{
}
diff --git a/src/core/base/js_fwk_common.cpp b/frameworks/src/core/base/js_fwk_common.cpp
similarity index 83%
rename from src/core/base/js_fwk_common.cpp
rename to frameworks/src/core/base/js_fwk_common.cpp
index 4d411ab..9683239 100755
--- a/src/core/base/js_fwk_common.cpp
+++ b/frameworks/src/core/base/js_fwk_common.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -13,32 +13,33 @@
* limitations under the License.
*/
#include "js_fwk_common.h"
+#include
+#include
+#include
+#include
+#include
+#if ((defined(__WIN32)) || (defined(__WIN64)))
+#include
+#endif
#include "ace_event_error_code.h"
#include "ace_log.h"
#include "ace_mem_base.h"
#include "component.h"
#include "component_utils.h"
+#include "dfx_assist.h"
#include "fatal_handler.h"
-#include "file.h"
#include "js_app_context.h"
#include "js_app_environment.h"
#include "js_profiler.h"
#if ENABLED(CONSOLE_LOG_OUTPUT)
#include "presets/console_module.h"
#endif
-#if ENABLED(SECURE_C_FUNCTION)
-#include "securec.h"
-#endif // ENABLED(SECURE_C_FUNCTION)
#include "presets/console_log_impl.h"
+#include "product_adapter.h"
+#include "securec.h"
#include "task_manager.h"
-#if defined(__LITEOS__)
-#include
-#include
-#include
-#endif
-
-#if ((defined __LITEOS__) || (defined __linux__) || (defined SCREENRESOLUTION_CMAKE))
+#if ((defined __LITEOS__) || (defined __linux__) || (defined SCREENSIZE_SPECIFIED))
#include
#endif
@@ -90,6 +91,19 @@ int16_t JerryGetIntegerProperty(jerry_value_t object, const char * const name)
return result;
}
+bool JerryGetBoolProperty(jerry_value_t object, const char * const name, bool &outValue)
+{
+ jerry_value_t value = jerryx_get_property_str(object, name);
+ if (!jerry_value_is_boolean(value)) {
+ jerry_release_value(value);
+ HILOG_ERROR(HILOG_MODULE_ACE, "js value is not bool.");
+ return false;
+ }
+ outValue = jerry_value_to_boolean(value);
+ jerry_release_value(value);
+ return true;
+}
+
void JerrySetFuncProperty(jerry_value_t object, const char * const name, jerry_external_handler_t handler)
{
if (name == nullptr || !strlen(name)) {
@@ -116,57 +130,56 @@ char *MallocStringOf(jerry_value_t source)
char *MallocStringOf(jerry_value_t source, uint16_t *strLength)
{
- if (strLength == nullptr) {
+ if ((IS_UNDEFINED(source)) || (strLength == nullptr)) {
return nullptr;
}
+
*strLength = 0;
- if (IS_UNDEFINED(source)) {
- return nullptr;
- }
- jerry_value_t target;
- if (jerry_value_is_symbol(source)) {
- target = jerry_get_symbol_descriptive_string(source);
- } else {
- target = jerry_value_to_string(source);
- }
- if (IS_ERROR_VALUE(target)) {
- HILOG_ERROR(HILOG_MODULE_ACE, "jerry_value_to_string failed, can not continue to generate char buffer");
- jerry_release_value(target);
- return nullptr;
- }
- jerry_size_t size = jerry_get_string_size(target);
- if (size == 0) {
- jerry_release_value(target);
- // return empty char instead of nullptr, so caller can free safely if source is JS empty string
- char *emptyStr = static_cast(ace_malloc(sizeof(char)));
- if (emptyStr == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "malloc buffer failed for empty str");
- return nullptr;
+ bool success = false;
+ jerry_value_t target = UNDEFINED;
+ jerry_char_t *buffer = nullptr;
+ jerry_size_t length = 0;
+ do {
+ if (jerry_value_is_symbol(source)) {
+ target = jerry_get_symbol_descriptive_string(source);
+ } else {
+ target = jerry_value_to_string(source);
}
- emptyStr[0] = '\0';
- return emptyStr;
- }
- if (size >= UINT16_MAX) {
- jerry_release_value(target);
- return nullptr;
- }
- jerry_char_t *buffer = static_cast(ace_malloc(sizeof(jerry_char_t) * (size + 1)));
- if (buffer == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "malloc buffer for convert jerry string failed");
- jerry_release_value(target);
- return nullptr;
- }
- jerry_size_t length = jerry_string_to_char_buffer(target, buffer, size);
- if ((length == 0) || (length >= UINT16_MAX) || (length > size)) {
- HILOG_ERROR(HILOG_MODULE_ACE, "jerry string to char buffer failed, target size[%d]", size);
- jerry_release_value(target);
- ace_free(buffer);
- buffer = nullptr;
- return nullptr;
- }
- // end character
- buffer[length] = '\0';
+ if (IS_ERROR_VALUE(target)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "jerry_value_to_string failed, can not continue to generate char buffer");
+ break;
+ }
+
+ jerry_size_t size = jerry_get_string_size(target);
+ if (size >= UINT16_MAX) {
+ break;
+ }
+ buffer = static_cast(ace_malloc(sizeof(jerry_char_t) * (size + 1)));
+ if (buffer == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "malloc buffer for convert jerry string failed");
+ break;
+ }
+ if (size == 0) {
+ // if here got matched, it means the JS string is empty itself
+ success = true;
+ break;
+ }
+
+ length = jerry_string_to_char_buffer(target, buffer, size);
+ if ((length == 0) || (length >= UINT16_MAX) || (length > size)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "jerry string to char buffer failed, target size[%d]", size);
+ break;
+ }
+ success = true;
+ } while (0);
+
jerry_release_value(target);
+ if (!success) {
+ ACE_FREE(buffer);
+ return nullptr;
+ }
+ // successful scenario, add end character
+ buffer[length] = '\0';
*strLength = length;
return reinterpret_cast(buffer);
}
@@ -240,43 +253,12 @@ jerry_value_t WatcherCallbackFunc(const jerry_value_t func,
// print out error information from jerry value
void PrintErrorMessage(const jerry_value_t errorValue)
{
- const uint8_t errorMsgMaxLength = 128;
- if (!jerry_is_feature_enabled(JERRY_FEATURE_ERROR_MESSAGES)) {
- return;
- }
-
- jerry_value_t errValue = jerry_get_value_from_error(errorValue, false);
- jerry_value_t errStrVal = jerry_value_to_string(errValue);
- jerry_release_value(errValue);
-
- if (jerry_value_is_error(errStrVal)) {
- /* Avoid recursive error throws. */
- HILOG_ERROR(HILOG_MODULE_ACE, "[Error value to string failed]");
- jerry_release_value(errStrVal);
- return;
- }
-
- jerry_size_t errStrSize = jerry_get_utf8_string_size(errStrVal);
- if (errStrSize >= errorMsgMaxLength) {
- HILOG_ERROR(HILOG_MODULE_ACE, "[Error message too long]");
- jerry_release_value(errStrVal);
- return;
- }
-
- jerry_char_t errStrBuffer[errorMsgMaxLength];
- jerry_size_t stringEnd = jerry_string_to_utf8_char_buffer(errStrVal, errStrBuffer, errStrSize);
- errStrBuffer[stringEnd] = 0;
- // output to platform trace
- HILOG_ERROR(HILOG_MODULE_ACE, " [JS Error]: %s", reinterpret_cast(errStrBuffer));
- // output to user console
- LogString(LogLevel::LOG_LEVEL_ERR, "[JS Exception]: ");
- LogString(LogLevel::LOG_LEVEL_ERR, reinterpret_cast(errStrBuffer));
- // output line seperator to trigger trace output
- LogString(LogLevel::LOG_LEVEL_ERR, "\n");
+ DfxAssist dfxAssist;
+ dfxAssist.DumpErrorCode(errorValue);
+ dfxAssist.DumpErrorMessage(errorValue);
#if ENABLED(ENGINE_DEBUGGER)
FlushOutput();
#endif
- jerry_release_value(errStrVal);
}
// wrapper function for jerry_call_function
@@ -286,7 +268,7 @@ jerry_value_t CallJSFunction(const jerry_value_t func,
jerry_size_t argsCount)
{
jerry_value_t ret = jerry_call_function(func, context, args, argsCount);
- // trace out error infomation if the result contains error
+ // trace out error information if the result contains error
if (jerry_value_is_error(ret)) {
PrintErrorMessage(ret);
}
@@ -422,16 +404,15 @@ static size_t AppendTwoPath(char * const first, uint8_t startIndex, const char *
size_t copiedLength = 0;
// we dont append '/' at the first index
- bool sepNeeded = (first[startIndex - 1] != PATH_SEPERATOR);
+ bool sepNeeded = (first[startIndex - 1] != PATH_SEPARATOR);
if (sepNeeded) {
- first[startIndex] = PATH_SEPERATOR;
+ first[startIndex] = PATH_SEPARATOR;
copiedLength++;
startIndex++;
}
- if (sec[0] == PATH_SEPERATOR) {
+ if (sec[0] == PATH_SEPARATOR) {
if (secLength > 1) {
- // we have make sure '/' appened to the target already, skip it
if (memcpy_s(first + startIndex, (destSize - startIndex), (sec + 1), (secLength - 1)) != 0) {
HILOG_ERROR(HILOG_MODULE_ACE, "append path error");
return 0;
@@ -470,7 +451,7 @@ char *RelocateFilePath(const char *appRootPath, const char *subPath, const char
HILOG_ERROR(HILOG_MODULE_ACE, "input path or fileName is too long");
return nullptr;
}
- // alawys consume subPath does not have '/'
+ // always consume subPath does not have '/'
const uint8_t addedLength = 2;
size_t totalLength = appRootPathLength + subPathLength + fileNameLength + addedLength;
char *fullPath = static_cast(ace_malloc(totalLength + 1));
@@ -505,7 +486,7 @@ char *RelocateFilePathRelative(const char * const appRootPath, const char * cons
if (jsPath == nullptr) {
return nullptr;
}
- const char * const ret = strrchr(jsPath, RESOURCE_SEPERATOR);
+ const char * const ret = strrchr(jsPath, RESOURCE_SEPARATOR);
if (ret == nullptr) {
return nullptr;
}
@@ -567,7 +548,7 @@ char *RelocateJSSourceFilePath(const char * const appRootPath, const char * cons
char *ReadJSFile(const char * const appPath, const char * const jsFileName)
{
uint32_t contentLength = 0;
- return ReadJSFile(appPath, jsFileName, &contentLength);
+ return ReadJSFile(appPath, jsFileName, contentLength);
}
/**
@@ -578,17 +559,10 @@ bool IsFileExisted(const char * const filePath)
if (filePath == nullptr) {
return false;
}
-#if defined(__LITEOS__)
- struct stat info;
+ struct stat info = {0};
if (stat(filePath, &info) != 0) {
return false;
}
-#else
- FileStatInfo fileStat;
- if (FileStat(filePath, &fileStat) != 0) {
- return false;
- }
-#endif
return true;
}
@@ -600,109 +574,103 @@ int32_t GetFileSize(const char * const filePath)
if (filePath == nullptr) {
return 0;
}
-#if defined(__LITEOS__)
- struct stat info;
- info.st_size = 0;
+ struct stat info = {0};
int32_t ret = stat(filePath, &info);
- if ((ret != 0) || (info.st_size == 0)) {
- HILOG_ERROR(HILOG_MODULE_ACE, "file [%s], file.size =%lld", filePath, info.st_size);
- }
- return info.st_size;
-#else
- FileStatInfo fileStat;
- fileStat.size = 0;
- int32_t ret = FileStat(filePath, &fileStat);
- if ((ret == FILE_RET_FAIL) || (fileStat.size == 0)) {
+ if (ret < 0) {
HILOG_ERROR(HILOG_MODULE_ACE, "file doesn't exit or it's empty, [%s]", filePath);
}
- return fileStat.size;
-#endif
+ return info.st_size;
}
static int32_t OpenFileInternal(const char * const orgFullPath, bool binary = false)
{
-#if defined(__LITEOS__)
+ const char *path = orgFullPath;
+#ifndef __LITEOS_M__ // no path canonicalization on M core
char fullPath[PATH_MAX + 1] = {0};
+#if ((defined(__WIN32)) || (defined(__WIN64)))
+ if (!PathCanonicalize(fullPath, orgFullPath)) {
+ return -1;
+ }
+#else
if (realpath(orgFullPath, fullPath) == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "realpath handle failed, [%s]", orgFullPath);
- return FILE_RET_FAIL;
+ return -1;
}
- return open(fullPath, O_RDONLY, S_IREAD | S_IWRITE);
#endif
-
-#if (defined(_WIN32) || defined(_WIN64))
- return FileOpen(orgFullPath, (binary ? _O_BINARY : DEFAULT_FILE_PERMISSION));
-#else
- return FileOpen(orgFullPath, O_RDONLY);
-#endif // (defined(_WIN32) || defined(_WIN64))
+ path = fullPath;
+#endif
+ return open(path, O_RDONLY);
}
-static int32_t ReadFileInternal(const int32_t fd, void *buffer, const uint32_t targetLength)
+/**
+ * Check if the file length is under MAX limitation.
+ */
+static bool CheckFileLength(const char * const fullPath, int32_t &outFileSize)
{
-#if defined(__LITEOS__)
- int32_t count = read(fd, buffer, targetLength);
-#else
- int32_t count = FileRead(fd, buffer, targetLength);
-#endif
- return count;
-}
-
-static void CloseFileInternal(int32_t fd)
-{
-#if defined(__LITEOS__)
- close(fd);
-#else
- FileClose(fd);
-#endif
+ outFileSize = 0;
+ int32_t fileSize = GetFileSize(fullPath);
+ if (fileSize <= 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "open file[%s] failed for reading.", fullPath);
+ return false;
+ }
+ if (fileSize > FILE_CONTENT_LENGTH_MAX) {
+ ACE_ERROR_CODE_PRINT(EXCE_ACE_ROUTER_REPLACE_FAILED, EXCE_ACE_PAGE_FILE_TOO_HUGE);
+ return false;
+ }
+ outFileSize = fileSize;
+ return true;
}
/**
* Read file content from one give full file path.
* Return value must be freed by caller.
*/
-char *ReadFile(const char * const fullPath, uint32_t *fileSize, const bool binary)
+char *ReadFile(const char * const fullPath, uint32_t &fileSize, const bool binary)
{
- if (fileSize == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "open file[%s] failed for reading, fileSize == nullptr", fullPath);
- return nullptr;
- }
- int32_t scriptLength = GetFileSize(fullPath);
- if (scriptLength <= 0) {
- HILOG_ERROR(HILOG_MODULE_ACE, "open file[%s] failed for reading, scriptLength has error.", fullPath);
- return nullptr;
- }
+ UNUSED(binary);
+ char *scriptBuffer = nullptr;
+ int32_t fd = -1;
+ bool success = false;
- if (scriptLength > FILE_CONTENT_LENGTH_MAX) {
- ACE_ERROR_CODE_PRINT(EXCE_ACE_ROUTER_REPLACE_FAILED, EXCE_ACE_PAGE_FILE_TOO_HUGE);
- return nullptr;
- }
+ do {
+ int32_t scriptLength = 0;
+ if (!CheckFileLength(fullPath, scriptLength)) {
+ break;
+ }
- *fileSize = 0;
- // open file
- int32_t fd = OpenFileInternal(fullPath, binary);
- if (fd == FILE_RET_FAIL) {
- HILOG_ERROR(HILOG_MODULE_ACE, "open file[fd: %d] failed for reading", fd);
- HILOG_ERROR(HILOG_MODULE_ACE, "open file[path: %s] failed for reading", fullPath);
+ fileSize = 0;
+ fd = OpenFileInternal(fullPath, O_RDONLY);
+ if (fd < 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "open file[fd: %d] failed for reading", fd);
+ HILOG_ERROR(HILOG_MODULE_ACE, "open file[path: %s] failed for reading", fullPath);
+ break;
+ }
+ scriptBuffer = static_cast(ace_malloc(scriptLength + 1));
+ if (scriptBuffer == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "malloc buffer for file content failed, file length[%d]", scriptLength);
+ break;
+ }
+ if (EOK != memset_s(scriptBuffer, (scriptLength + 1), 0, (scriptLength + 1))) {
+ break;
+ }
+ int32_t count = read(fd, scriptBuffer, scriptLength);
+ if ((count <= 0) || (count > scriptLength)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "read fail, count(%d), length(%u), path(%s)", count, scriptLength, fullPath);
+ break;
+ }
+ scriptBuffer[count] = '\0';
+ fileSize = count;
+ success = true;
+ } while (0);
+
+ if (fd >= 0) {
+ close(fd);
+ }
+ if (!success) {
+ // failed, free buffer if it's already malloced out
+ ACE_FREE(scriptBuffer);
return nullptr;
}
- char *scriptBuffer = static_cast(ace_malloc(scriptLength + 1));
- if (scriptBuffer == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "malloc buffer for file content failed, file length[%d]", scriptLength);
- CloseFileInternal(fd);
- return nullptr;
- }
- int32_t count = ReadFileInternal(fd, scriptBuffer, scriptLength);
- if ((count <= 0) || (count > scriptLength)) {
- HILOG_ERROR(HILOG_MODULE_ACE, "FileRead failed, count(%d), targetLength(%u), filePath(%s)", count, scriptLength,
- fullPath);
- CloseFileInternal(fd);
- ace_free(scriptBuffer);
- scriptBuffer = nullptr;
- return nullptr;
- }
- scriptBuffer[count] = '\0';
- CloseFileInternal(fd);
- *fileSize = binary ? scriptLength : count;
return scriptBuffer;
}
@@ -710,12 +678,9 @@ char *ReadFile(const char * const fullPath, uint32_t *fileSize, const bool binar
* give app path, such as /system/app/uuid/, read script string from /system/app/uuid/src/index.js,
* return value must be freed by caller.
*/
-char *ReadJSFile(const char * const appPath, const char * const jsFileName, uint32_t *fileSize)
+char *ReadJSFile(const char * const appPath, const char * const jsFileName, uint32_t &fileSize)
{
- if (fileSize == nullptr) {
- return nullptr;
- }
- *fileSize = 0;
+ fileSize = 0;
// RelocateFilePath() will check the input parameters
char *fullPath = RelocateJSSourceFilePath(appPath, jsFileName);
if (fullPath == nullptr) {
@@ -1051,7 +1016,8 @@ bool ParseRgbaColor(const char * const source, uint32_t &color, uint8_t &alpha)
}
buffer[bufSize] = 0;
char *token;
- int8_t move = 16;
+ // BITS_PER_BYTE is unsigned, result always equals to 16, can't overflow
+ int8_t move = BITS_PER_BYTE << 1;
char *next = nullptr;
token = strtok_s(buffer, DELIMITER, &next);
color = 0;
@@ -1100,21 +1066,25 @@ struct JSPageSpecific jsPageSpecific;
uint16_t GetHorizontalResolution()
{
-// SCREENRESOLUTION_CMAKE is temporarily set, when ui and graphic unifid, this can be removed
-#if ((defined __LITEOS__) || (defined __linux__) || (defined SCREENRESOLUTION_CMAKE))
+// SCREENSIZE_SPECIFIED is temporarily set, when ui and graphic unifid, this can be removed
+#if ((defined __LITEOS__) || (defined __linux__) || (defined SCREENSIZE_SPECIFIED))
return Screen::GetInstance().GetWidth();
#else
uint16_t horizontalResolution = 454;
+ uint16_t verticalResolution = 454;
+ ProductAdapter::GetScreenSize(horizontalResolution, verticalResolution);
return horizontalResolution;
#endif // OHOS_ACELITE_PRODUCT_WATCH
}
uint16_t GetVerticalResolution()
{
-#if ((defined __LITEOS__) || (defined __linux__) || (defined SCREENRESOLUTION_CMAKE))
+#if ((defined __LITEOS__) || (defined __linux__) || (defined SCREENSIZE_SPECIFIED))
return Screen::GetInstance().GetHeight();
#else
+ uint16_t horizontalResolution = 454;
uint16_t verticalResolution = 454;
+ ProductAdapter::GetScreenSize(horizontalResolution, verticalResolution);
return verticalResolution;
#endif // OHOS_ACELITE_PRODUCT_WATCH
}
@@ -1202,7 +1172,7 @@ void CureImagePath(char *&imagePath)
}
if (lastPathPos < 0) {
- if (*(imagePath + index) == PATH_SEPERATOR) {
+ if (*(imagePath + index) == PATH_SEPARATOR) {
lastPathPos = index;
}
}
@@ -1254,7 +1224,7 @@ const char *ParseImageSrc(jerry_value_t source)
}
if ((strstr(rawSrc, PATH_RELATIVE_WHOLE) != nullptr) || (strstr(rawSrc, PATH_RELATIVE_PART) != nullptr)) {
- HILOG_ERROR(HILOG_MODULE_ACE, "Ralative path is not allowed in image src.");
+ HILOG_ERROR(HILOG_MODULE_ACE, "Relative path is not allowed in image src.");
ace_free(rawSrc);
rawSrc = nullptr;
return nullptr;
@@ -1269,11 +1239,13 @@ const char *ParseImageSrc(jerry_value_t source)
return imageSrc;
}
-bool CopyFontFamily(char *&destination, const char * const fontFamily)
+bool CopyFontFamily(char *&destination, const char * const fontFamily, uint32_t fontFamilyNameLen)
{
+ // unused parameter for now, added for clean up warning
+ UNUSED(fontFamilyNameLen);
ACE_FREE(destination);
if (fontFamily == nullptr) {
- return true; // the destination is alread nullptr
+ return true; // the destination is already nullptr
}
size_t fontFamilyLen = strlen(fontFamily);
if (fontFamilyLen >= UINT8_MAX) {
diff --git a/src/core/base/js_fwk_common.h b/frameworks/src/core/base/js_fwk_common.h
similarity index 93%
rename from src/core/base/js_fwk_common.h
rename to frameworks/src/core/base/js_fwk_common.h
index 1fc3b06..875a53a 100755
--- a/src/core/base/js_fwk_common.h
+++ b/frameworks/src/core/base/js_fwk_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -157,6 +157,11 @@ constexpr char TRANSITION_TRANSFORM_Y[] = "translateY";
constexpr char CONSTRUCTOR_VIEW_MODEL[] = "ViewModel";
constexpr char CONSTRUCTOR_ABILITY_SLICE[] = "AbilitySlice";
+#ifdef FEATURE_ROTATION_API
+constexpr char FUNC_ROTATION_NAME[] = "rotation";
+constexpr char ATTR_NAME_FOCUS[] = "focus";
+#endif // FEATURE_ROTATION_API
+
// get screen horizontal resolution
uint16_t GetHorizontalResolution();
// get screen vertical resolution
@@ -170,6 +175,14 @@ void JerrySetStringProperty(jerry_value_t object, const char * const name, const
// value returned should be freed by caller when it's not nullptr and won't be used any more
char *JerryMallocStringProperty(const jerry_value_t object, const char * const name, uint16_t &length);
int16_t JerryGetIntegerProperty(jerry_value_t object, const char * const name);
+/**
+ * @brief try to parse bool property from one JS object, caller should check the returned result before using outValue.
+ * @param object the given object
+ * @param name the target property name
+ * @param outValue the target property value
+ * @return true if the parse successfully
+ */
+bool JerryGetBoolProperty(jerry_value_t object, const char * const name, bool &outValue);
void JerrySetFuncProperty(jerry_value_t object, const char * const name, jerry_external_handler_t handler);
char *MallocStringOf(jerry_value_t source);
// convert one jerry string value to char*, and return the string length
@@ -191,9 +204,9 @@ char *RelocateJSSourceFilePath(const char * const appRootPath, const char * cons
// read from src file, return value must be freed by caller
char *ReadJSFile(const char * const appPath, const char * const jsFileName);
// read the given file and return the whole file content
-char *ReadJSFile(const char * const appPath, const char * const jsFileName, uint32_t *fileSize);
+char *ReadJSFile(const char * const appPath, const char * const jsFileName, uint32_t &fileSize);
// read the given file and return the whole file content
-char *ReadFile(const char * const fullPath, uint32_t *fileSize, const bool binary);
+char *ReadFile(const char * const fullPath, uint32_t &fileSize, const bool binary);
// check whether the given file exists
bool IsFileExisted(const char * const filePath);
// Whether file existed and return the file size. 0 represents file not existed.
@@ -281,7 +294,7 @@ constexpr uint8_t ALPHA_MAX = 255;
constexpr char BRACE_OPEN = '(';
constexpr char BRACE_CLOSE = ')';
constexpr char DELIMITER[] = ",";
-constexpr char RESOURCE_SEPERATOR = '/';
+constexpr char RESOURCE_SEPARATOR = '/';
bool StartWith(const char *sequence, const char *prefix);
bool IsHexColor(const char * const target);
@@ -290,16 +303,16 @@ bool IsRgbaColor(const char * const target);
bool ParseHexColor(const char * const source, uint32_t &color, uint8_t &alpha);
bool ParseRgbaColor(const char * const source, uint32_t &color, uint8_t &alpha);
bool ParseColor(const char * const source, uint32_t &color, uint8_t &alpha);
-bool CopyFontFamily(char *&destination, const char * const fontFamily);
+bool CopyFontFamily(char *&destination, const char * const fontFamily, uint32_t fontFamilyNameLen = 0);
#if (defined(_WIN32) || defined(_WIN64))
-constexpr char PATH_SEPERATOR = '\\';
+constexpr char PATH_SEPARATOR = '\\';
constexpr char PATH_RELATIVE_WHOLE[] = "\\..\\";
constexpr char PATH_RELATIVE_PART[] = "..\\";
constexpr char SRC_SUB_FOLDER_NAME[] = "";
constexpr char JS_INDEX_FILE_PATH[] = "pages\\index\\index";
#else
-constexpr char PATH_SEPERATOR = '/';
+constexpr char PATH_SEPARATOR = '/';
constexpr char PATH_RELATIVE_WHOLE[] = "/../";
constexpr char PATH_RELATIVE_PART[] = "../";
constexpr char SRC_SUB_FOLDER_NAME[] = "";
@@ -317,6 +330,7 @@ enum {
};
constexpr int VA_ARG_END_FLAG = -1;
+constexpr int INVALID_PIXEL_VALUE = -1;
// switch on random path
#ifndef JS_PAGE_SPECIFIC
diff --git a/src/core/base/key_parser.cpp b/frameworks/src/core/base/key_parser.cpp
similarity index 91%
rename from src/core/base/key_parser.cpp
rename to frameworks/src/core/base/key_parser.cpp
index 02d3631..d37cb61 100755
--- a/src/core/base/key_parser.cpp
+++ b/frameworks/src/core/base/key_parser.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -205,10 +205,16 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
return K_CLOCK_HAND;
}
#endif // FEATURE_COMPONENT_ANALOG_CLOCK
+ break;
case 'd':
if (!strcmp(s, "atasets")) {
return K_DATASETS;
}
+#ifdef FEATURE_DATE_FORMAT
+ if (!strcmp(s, "ay")) {
+ return K_DAY;
+ }
+#endif
#ifdef FEATURE_COMPONENT_DATE_PICKER
if (!strcmp(s, "ate")) {
return K_DATE;
@@ -261,6 +267,9 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
if (!strcmp(s, "alse")) {
return K_FALSE;
}
+ if (!strcmp(s, "illmode")) {
+ return K_FILL_MODE;
+ }
if (!strcmp(s, "ixedsize")) {
return K_FIXED_SIZE;
}
@@ -295,11 +304,16 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
if (!strcmp(s, "eight")) {
return K_HEIGHT;
}
-#ifdef FEATURE_COMPONENT_ANALOG_CLOCK
+#if (defined(FEATURE_COMPONENT_ANALOG_CLOCK)) || (defined(FEATURE_DATE_FORMAT))
if (!strcmp(s, "our")) {
return K_HOUR;
}
#endif // FEATURE_COMPONENT_ANALOG_CLOCK
+#ifdef FEATURE_DATE_FORMAT
+ if (!strcmp(s, "our12")) {
+ return K_HOUR12;
+ }
+#endif
break;
case 'i':
if (!strcmp(s, "d")) {
@@ -367,6 +381,11 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
if (!strcmp(s, "oop")) {
return K_LOOP;
}
+#ifdef FEATURE_DATE_FORMAT
+ if (!strcmp(s, "ong")) {
+ return K_LONG;
+ }
+#endif
break;
case 'm':
if (!strcmp(s, "argin")) {
@@ -401,6 +420,22 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
return K_MUTED;
}
#endif // FEATURE_COMPONENT_VIDEO
+#ifdef FEATURE_NUMBER_FORMAT
+ if (!strcmp(s, "inimumFractionDigits")) {
+ return K_MINIMUMFRACTIONDIGITS;
+ }
+ if (!strcmp(s, "aximumFractionDigits")) {
+ return K_MAXIMUMFRACTIONDIGITS;
+ }
+#endif
+#ifdef FEATURE_DATE_FORMAT
+ if (!strcmp(s, "inute")) {
+ return K_MINUTE;
+ }
+ if (!strcmp(s, "onth")) {
+ return K_MONTH;
+ }
+#endif
break;
case 'n':
if (!strcmp(s, "ame")) {
@@ -409,13 +444,18 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
if (!strcmp(s, "one")) {
return K_NONE;
}
+#ifdef FEATURE_DATE_FORMAT
+ if (!strcmp(s, "umeric")) {
+ return K_NUMERIC;
+ }
+#endif
break;
case 'o':
if (!strcmp(s, "pacity")) {
return K_OPACITY;
}
if (!strcmp(s, "ptions")) {
- return K_OPATIONS;
+ return K_OPTIONS;
}
break;
case 'p':
@@ -462,6 +502,13 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
return K_PROGRESS;
}
break;
+#ifdef FEATURE_COMPONENT_QRCODE
+ case 'q':
+ if (!strcmp(s, "rcode")) {
+ return K_QRCODE;
+ }
+ break;
+#endif // FEATURE_COMPONENT_QRCODE
case 'r':
if (!strcmp(s, "adio")) {
return K_RADIO;
@@ -529,6 +576,11 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
if (!strcmp(s, "how")) {
return K_SHOW;
}
+#ifdef FEATURE_DATE_FORMAT
+ if (!strcmp(s, "hort")) {
+ return K_SHORT;
+ }
+#endif
if (!strcmp(s, "lider")) {
return K_SLIDER;
}
@@ -561,6 +613,11 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
if (!strcmp(s, "trokeWidth")) {
return K_STROKE_WIDTH;
}
+#ifdef FEATURE_NUMBER_FORMAT
+ if (!strcmp(s, "tyle")) {
+ return K_STYLE;
+ }
+#endif // FEATURE_NUMBER_FORMAT
if (!strcmp(s, "wipe")) {
return K_SWIPE;
}
@@ -635,6 +692,13 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
}
#endif // FEATURE_COMPONENT_ANALOG_CLOCK
break;
+ case 'u':
+#ifdef FEATURE_NUMBER_FORMAT
+ if (!strcmp(s, "seGrouping")) {
+ return K_USEGROUP;
+ }
+#endif // FEATURE_NUMBER_FORMAT
+ break;
case 'v':
if (!strcmp(s, "alue")) {
return K_VALUE;
@@ -656,6 +720,13 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
return K_WRAP;
}
break;
+ case '2':
+#ifdef FEATURE_DATE_FORMAT
+ if (!strcmp(s, "-digit")) {
+ return K_DIGIT2;
+ }
+ break;
+#endif
default:
break;
// clang-format on
diff --git a/src/core/base/key_parser.h b/frameworks/src/core/base/key_parser.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/base/key_parser.h
rename to frameworks/src/core/base/key_parser.h
diff --git a/src/core/base/keys.h b/frameworks/src/core/base/keys.h
similarity index 91%
rename from src/core/base/keys.h
rename to frameworks/src/core/base/keys.h
index e0f379d..0fbeb8e 100755
--- a/src/core/base/keys.h
+++ b/frameworks/src/core/base/keys.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -94,6 +94,10 @@ enum {
#ifdef FEATURE_COMPONENT_DATE_PICKER
KEYWORD(DATE, date) // picker-view attr value
#endif // FEATURE_COMPONENT_DATE_PICKER
+#ifdef FEATURE_DATE_FORMAT
+ KEYWORD(DAY, day)
+ KEYWORD(DIGIT2, digit2)
+#endif
KEYWORD(DIRECTION, direction) // progress direction
KEYWORD(DISPLAY, display) // div layout
KEYWORD(DIV, div) // tag name
@@ -114,6 +118,7 @@ enum {
#ifdef FEATURE_COMPONENT_VIDEO
KEYWORD(FINISH, finish) // video component finish event tag
#endif // FEATURE_COMPONENT_VIDEO
+ KEYWORD(FILL_MODE, fillmode) // image-animator attribtue
KEYWORD(FIXED_SIZE, fixedsize) // image-animator attribute
KEYWORD(FLEX_DIRECTION, flexDirection) // layout style
KEYWORD(FLEX_END, flex-end) // layout style
@@ -123,9 +128,12 @@ enum {
KEYWORD(FONT_FAMILY, fontFamily) // text style type
KEYWORD(FORWARDS, forwards) // animation fill value
KEYWORD(HEIGHT, height) // common attributes
-#ifdef FEATURE_COMPONENT_ANALOG_CLOCK
+#if (defined(FEATURE_COMPONENT_ANALOG_CLOCK)) || (defined(FEATURE_DATE_FORMAT))
KEYWORD(HOUR, hour) // analog-clock hour
-#endif // FEATURE_COMPONENT_ANALOG_CLOCK
+#endif // FEATURE_COMPONENT_ANALOG_CLOCK FEATURE_DATE_FORMAT
+#ifdef FEATURE_DATE_FORMAT
+ KEYWORD(HOUR12, hour12)
+#endif
KEYWORD(ID, id) // common attributes
KEYWORD(IMAGE, image) // tag name
KEYWORD(IMAGE_ANIMATOR, image-animator) // tag name
@@ -145,6 +153,9 @@ enum {
KEYWORD(LINE_HEIGHT, lineHeight) // text style type
KEYWORD(LIST, list) // list tag name
KEYWORD(LIST_ITEM, list-item) // list-item tag name
+#ifdef FEATURE_DATE_FORMAT
+ KEYWORD(LONG, long)
+#endif
KEYWORD(LONGPRESS, longpress) // long progress event listener
KEYWORD(LOOP, loop) // swiper loop attribute
KEYWORD(MARGIN, margin) // common style margin
@@ -156,13 +167,20 @@ enum {
KEYWORD(MAX, max) // common attributes
KEYWORD(MIN, min) // common attributes, analog-clock minute
KEYWORD(MINI, mini) // text font size type
+#ifdef FEATURE_DATE_FORMAT
+ KEYWORD(MINUTE, minute)
+ KEYWORD(MONTH, month)
+#endif
#ifdef FEATURE_COMPONENT_VIDEO
KEYWORD(MUTED, muted) // video component muted attribute
#endif // FEATURE_COMPONENT_VIDEO
KEYWORD(NAME, name) // the attribute name
KEYWORD(NONE, none) // animation fill value
+#ifdef FEATURE_DATE_FORMAT
+ KEYWORD(NUMERIC, numeric)
+#endif
KEYWORD(OPACITY, opacity) // common style opacity
- KEYWORD(OPATIONS, opations) // chart options
+ KEYWORD(OPTIONS, options) // chart options
KEYWORD(PADDING, padding)
KEYWORD(PADDING_BOTTOM, paddingBottom)
KEYWORD(PADDING_LEFT, paddingLeft)
@@ -179,6 +197,9 @@ enum {
KEYWORD(PIVOT_Y, pivotY) // clock-hand pivot-y
#endif // FEATURE_COMPONENT_ANALOG_CLOCK
KEYWORD(PROGRESS, progress) // progress tag name
+#ifdef FEATURE_COMPONENT_QRCODE
+ KEYWORD(QRCODE, qrcode) // qrcode tag name
+#endif
KEYWORD(RADIO, radio) // the type in input
KEYWORD(RADIUS, radius) // circle progress radius
KEYWORD(RANGE, range) // picker-view attr
@@ -196,6 +217,9 @@ enum {
#ifdef FEATURE_COMPONENT_ANALOG_CLOCK
KEYWORD(SEC, sec) // analog-clock second
#endif // FEATURE_COMPONENT_ANALOG_CLOCK
+#ifdef FEATURE_DATE_FORMAT
+ KEYWORD(SECOND, second)
+#endif
#ifdef FEATURE_COMPONENT_VIDEO
KEYWORD(SEEKING, seeking) // // video component seeking event tag
KEYWORD(SEEKED, seeked) // // video component seeked event tag
@@ -204,6 +228,9 @@ enum {
KEYWORD(SELECTED_COLOR, selectedColor) // picker-view style
KEYWORD(SELECTED_FONT_FAMILY, selectedFontFamily) // picker-view style
KEYWORD(SELECTED_FONT_SIZE, selectedFontSize) // picker-view style
+#ifdef FEATURE_DATE_FORMAT
+ KEYWORD(SHORT, short)
+#endif
KEYWORD(SHOW, show)
KEYWORD(SLIDER, slider) // tag name
KEYWORD(SPACE_AROUND, space-around) // layout style
@@ -254,6 +281,16 @@ enum {
#endif // FEATURE_COMPONENT_VIDEO
KEYWORD(WIDTH, width) // common attributes
KEYWORD(WRAP, wrap) // flex wrap
+#ifdef FEATURE_DATE_FORMAT
+ KEYWORD(WEEKDAY, weekday)
+ KEYWORD(YEAR, year)
+#endif
+#ifdef FEATURE_NUMBER_FORMAT
+ KEYWORD(STYLE, style)
+ KEYWORD(USEGROUP, useGroup)
+ KEYWORD(MINIMUMFRACTIONDIGITS, minimumFractionDigits)
+ KEYWORD(MAXIMUMFRACTIONDIGITS, maximumFractionDigits)
+#endif
// Reused by the struct end
// clang-format on
#ifdef KEYWORDS_ENUM_DEFINE
diff --git a/frameworks/src/core/base/lazy_load_manager.cpp b/frameworks/src/core/base/lazy_load_manager.cpp
new file mode 100755
index 0000000..00001f2
--- /dev/null
+++ b/frameworks/src/core/base/lazy_load_manager.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "lazy_load_manager.h"
+#include "ace_log.h"
+#include "component.h"
+#include "component_utils.h"
+#include "lazy_load_watcher.h"
+
+namespace OHOS {
+namespace ACELite {
+LazyLoadManager::LazyLoadManager() : firstWatcher_(nullptr), lastWatcher_(nullptr), state_(LazyLoadState::INIT)
+{
+}
+
+LazyLoadManager::~LazyLoadManager()
+{
+ ResetWatchers();
+}
+
+void LazyLoadManager::ResetWatchers()
+{
+ LazyLoadWatcher *next = nullptr;
+ while (firstWatcher_ != nullptr) {
+ next = const_cast(firstWatcher_->GetNext());
+ delete firstWatcher_;
+ firstWatcher_ = next;
+ }
+
+ lastWatcher_ = nullptr;
+ state_ = LazyLoadState::INIT;
+}
+
+void LazyLoadManager::RenderLazyLoadWatcher()
+{
+ LazyLoadWatcher *next = nullptr;
+ while (firstWatcher_ != nullptr) {
+ Component *componet = ComponentUtils::GetComponentFromBindingObject(firstWatcher_->GetNativeElement());
+ if (componet != nullptr) {
+ componet->AddWatcherItem(firstWatcher_->GetAttrName(), firstWatcher_->GetAttrGetter());
+ }
+ next = const_cast(firstWatcher_->GetNext());
+ delete firstWatcher_;
+ firstWatcher_ = next;
+ }
+ state_ = LazyLoadState::DONE;
+}
+
+void LazyLoadManager::AddLazyLoadWatcher(jerry_value_t nativeElement, jerry_value_t attrName, jerry_value_t getter)
+{
+ if (nativeElement == UNDEFINED || attrName == UNDEFINED || getter == UNDEFINED) {
+ return;
+ }
+
+ LazyLoadWatcher *watcher =
+ new LazyLoadWatcher(nativeElement, jerry_acquire_value(attrName), jerry_acquire_value(getter));
+ if (watcher == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "create watcher errpr");
+ return;
+ }
+ if (firstWatcher_ == nullptr) {
+ firstWatcher_ = watcher;
+ lastWatcher_ = watcher;
+ } else {
+ lastWatcher_->SetNext(*watcher);
+ lastWatcher_ = watcher;
+ }
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/base/lazy_load_manager.h b/frameworks/src/core/base/lazy_load_manager.h
new file mode 100755
index 0000000..514ad17
--- /dev/null
+++ b/frameworks/src/core/base/lazy_load_manager.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_LAZY_LOAD_MANAGER_H
+#define OHOS_ACELITE_LAZY_LOAD_MANAGER_H
+
+#include "lazy_load_watcher.h"
+#include "non_copyable.h"
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * lazy load state
+ */
+enum class LazyLoadState : uint8_t {
+ INIT,
+ READY,
+ DONE,
+ ABANDON
+};
+
+class LazyLoadManager final : public MemoryHeap {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(LazyLoadManager);
+ LazyLoadManager();
+
+ ~LazyLoadManager();
+
+ void ResetWatchers();
+
+ /**
+ * @brief Cache watcher
+ */
+ void AddLazyLoadWatcher(jerry_value_t nativeElement, jerry_value_t attrName, jerry_value_t getter);
+
+ /**
+ * @brief Render watcher at next TE task
+ */
+ void RenderLazyLoadWatcher();
+
+ const LazyLoadWatcher *GetLazyWatcher() const
+ {
+ return firstWatcher_;
+ }
+
+ void SetState(LazyLoadState state)
+ {
+ state_ = state;
+ }
+
+ LazyLoadState GetState() const
+ {
+ return state_;
+ }
+private:
+ LazyLoadWatcher *firstWatcher_;
+ LazyLoadWatcher *lastWatcher_;
+ LazyLoadState state_;
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // OHOS_ACELITE_LAZY_LOAD_MANAGER_H
diff --git a/frameworks/src/core/base/lazy_load_watcher.cpp b/frameworks/src/core/base/lazy_load_watcher.cpp
new file mode 100755
index 0000000..d9cbda8
--- /dev/null
+++ b/frameworks/src/core/base/lazy_load_watcher.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "lazy_load_watcher.h"
+namespace OHOS {
+namespace ACELite {
+LazyLoadWatcher::LazyLoadWatcher(jerry_value_t nativeElement, jerry_value_t attrName, jerry_value_t getter)
+ : nativeElement_(nativeElement),
+ attrName_(attrName),
+ getter_(getter),
+ next_(nullptr)
+{
+}
+
+LazyLoadWatcher::~LazyLoadWatcher()
+{
+ jerry_release_value(attrName_);
+ jerry_release_value(getter_);
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/base/lazy_load_watcher.h b/frameworks/src/core/base/lazy_load_watcher.h
new file mode 100755
index 0000000..8a9329b
--- /dev/null
+++ b/frameworks/src/core/base/lazy_load_watcher.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_LAZY_LOAD_WATCHER_H
+#define OHOS_ACELITE_LAZY_LOAD_WATCHER_H
+
+#include "jerryscript-core.h"
+#include "js_fwk_common.h"
+#include "non_copyable.h"
+
+namespace OHOS {
+namespace ACELite {
+class LazyLoadWatcher final : public MemoryHeap {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(LazyLoadWatcher);
+
+ LazyLoadWatcher(jerry_value_t nativeElement, jerry_value_t attrName, jerry_value_t getter);
+
+ ~LazyLoadWatcher();
+
+ void SetNext(LazyLoadWatcher &next)
+ {
+ next_ = &next;
+ }
+
+ const LazyLoadWatcher *GetNext() const
+ {
+ return next_;
+ }
+
+ jerry_value_t GetNativeElement() const
+ {
+ return nativeElement_;
+ }
+
+ jerry_value_t GetAttrName() const
+ {
+ return attrName_;
+ }
+
+ jerry_value_t GetAttrGetter() const
+ {
+ return getter_;
+ }
+private:
+ jerry_value_t nativeElement_;
+ jerry_value_t attrName_;
+ jerry_value_t getter_;
+ LazyLoadWatcher *next_;
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // OHOS_ACELITE_LAZY_LOAD_WATCHER_H
diff --git a/frameworks/src/core/base/locale_util.cpp b/frameworks/src/core/base/locale_util.cpp
new file mode 100755
index 0000000..ee145cb
--- /dev/null
+++ b/frameworks/src/core/base/locale_util.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "locale_util.h"
+#ifdef FEATURE_INTL_MODULE
+#include "ace_log.h"
+#include "global.h"
+#include "js_fwk_common.h"
+#include "memory_heap.h"
+#include "securec.h"
+#include "string.h"
+
+namespace OHOS {
+namespace ACELite {
+using namespace I18N;
+LocaleInfo *LocaleUtil::GetLocaleInfo(char* locale)
+{
+ if (locale == nullptr) {
+ return GetSystemLocaleInfo();
+ }
+ LocaleInfo *localeInfo = nullptr;
+ // the locale info is used '-' as separator
+ const char *delemeter = "-";
+ char *country = nullptr;
+ char *next = nullptr;
+ if (strstr(locale, delemeter)) {
+ country = strtok_s(locale, delemeter, &next);
+ }
+ if (country == nullptr) {
+ localeInfo = new LocaleInfo(locale, nullptr);
+ } else {
+ char *origion = strtok_s(nullptr, delemeter, &next);
+ if ((next == nullptr) || (!strcmp("", next))) {
+ // set the language and region info
+ localeInfo = new LocaleInfo(country, origion);
+ } else {
+ // set the language, region and script info
+ localeInfo = new LocaleInfo(country, origion, next);
+ }
+ }
+ // if the locale info is nullptr or set locale info failed, set the system locale info
+ if ((localeInfo == nullptr) || (localeInfo->GetId() == nullptr)) {
+ ACE_DELETE(localeInfo);
+ localeInfo = GetSystemLocaleInfo();
+ }
+ return localeInfo;
+}
+
+LocaleInfo *LocaleUtil::GetSystemLocaleInfo()
+{
+ LocaleInfo *info = nullptr;
+ char *language = nullptr;
+ char *region = nullptr;
+ do {
+ language = reinterpret_cast(ace_malloc(MAX_LANGUAGE_LENGTH));
+ region = reinterpret_cast(ace_malloc(MAX_REGION_LENGTH));
+ if ((language == nullptr) || (region == nullptr)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "malloc system info failed");
+ break;
+ }
+ int langRet = GLOBAL_GetLanguage(language, MAX_LANGUAGE_LENGTH);
+ int regionRet = GLOBAL_GetRegion(region, MAX_REGION_LENGTH);
+ if ((langRet != 0) || (regionRet != 0)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "get system language info failed");
+ break;
+ }
+ info = new LocaleInfo(language, region);
+ } while (0);
+ ACE_FREE(language);
+ ACE_FREE(region);
+ return info;
+}
+} // namespace ACELite
+} // namespace OHOS
+#endif
diff --git a/frameworks/src/core/base/locale_util.h b/frameworks/src/core/base/locale_util.h
new file mode 100644
index 0000000..8a8bd76
--- /dev/null
+++ b/frameworks/src/core/base/locale_util.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_LOCALE_UTIL_H
+#define OHOS_ACELITE_LOCALE_UTIL_H
+#include "acelite_config.h"
+#ifdef FEATURE_INTL_MODULE
+#include "locale_info.h"
+#include "non_copyable.h"
+namespace OHOS {
+namespace ACELite {
+class LocaleUtil final {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(LocaleUtil);
+ LocaleUtil() = delete;
+ ~LocaleUtil() = delete;
+
+ /**
+ * @brief split the locale info by '-', set the language, region, and script info
+ * @param locale the locale string
+ * @return the localeInfo object which has set the language, region and script
+ */
+ static I18N::LocaleInfo *GetLocaleInfo(char *locale);
+
+ /**
+ * @brief get the system language and region info
+ * @return the locale object which has set the language and region info
+ */
+ static I18N::LocaleInfo *GetSystemLocaleInfo();
+};
+}
+}
+#endif // FEATURE_INTL_MODULE
+#endif
diff --git a/frameworks/src/core/base/mem_proc.cpp b/frameworks/src/core/base/mem_proc.cpp
new file mode 100644
index 0000000..1b09282
--- /dev/null
+++ b/frameworks/src/core/base/mem_proc.cpp
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mem_proc.h"
+#ifdef SIMULATOR_MEMORY_ANALYSIS
+#include
+#include
+#include
+#include "ace_log.h"
+#include "file.h"
+#include "jerryscript-core.h"
+#include "jerryscript.h"
+#include "js_fwk_common.h"
+#include "securec.h"
+#include "time.h"
+
+namespace OHOS {
+namespace ACELite {
+constexpr uint8_t MSG_LENGTH = 100;
+
+constexpr uint32_t UNIT = 1024;
+
+AceMemProc *AceMemProc::GetInstance()
+{
+ static AceMemProc instance;
+ return &instance;
+}
+
+void AceMemProc::ClearUp()
+{
+ if (!IsEnabled()) {
+ return;
+ }
+ // backup prev txt, create a new txt
+ struct stat fileStat;
+
+ int32_t state = stat(MEM_LOG_FILE_PATH, &fileStat);
+ if ((state != 0) || (fileStat.st_size == 0)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Back up file error.");
+ return;
+ }
+ // it exists and not empty
+ time_t seconds = time(NULL);
+ char markdata[MSG_LENGTH];
+ if (sprintf_s(markdata, MSG_LENGTH, "%ti.txt", seconds) < 0) {
+ close(state);
+ state = -1;
+ return;
+ }
+ char *fullPath = RelocateJSSourceFilePath(MEM_BACK_UP_LOG_FILE_PREFIX, markdata);
+ if (fullPath == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Back up file error.");
+ } else {
+ rename(MEM_LOG_FILE_PATH, fullPath);
+ ace_free(fullPath);
+ fullPath = nullptr;
+ }
+ close(state);
+ state = -1;
+}
+
+void AceMemProc::SysMemTracing()
+{
+ if (!IsEnabled()) {
+ return;
+ }
+ HANDLE handle = GetCurrentProcess();
+ PROCESS_MEMORY_COUNTERS pmc = {0};
+ if (!GetProcessMemoryInfo(handle, (PROCESS_MEMORY_COUNTERS *)&pmc, sizeof(pmc))) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Get process memory error.");
+ return;
+ }
+
+ FILE *fp = fopen(MEM_LOG_FILE_PATH, "a+");
+ if (fp == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Get file error.");
+ return;
+ }
+
+ // physical memory
+ char markdata[MSG_LENGTH];
+ if (sprintf_s(markdata, MSG_LENGTH, "Phy:%d(KB)\n", uint32_t(pmc.WorkingSetSize / UNIT)) < 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Output file error.");
+ fclose(fp);
+ fp = nullptr;
+ return;
+ }
+ fputs(markdata, fp);
+
+ // virtual memory
+ if (sprintf_s(markdata, MSG_LENGTH, "Vir:%d(KB)\n", uint32_t(pmc.PagefileUsage / UNIT)) < 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Output file error.");
+ fclose(fp);
+ fp = nullptr;
+ return;
+ }
+ fputs(markdata, fp);
+
+ fflush(fp);
+ fclose(fp);
+ fp = nullptr;
+}
+
+void AceMemProc::JerryMemTracing()
+{
+ if (!IsEnabled()) {
+ return;
+ }
+ jerry_heap_stats_t stats = {0};
+ if (!jerry_get_memory_stats(&stats)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Get jerry heap stats error.");
+ return;
+ }
+
+ FILE *fp = nullptr;
+ fp = fopen(MEM_LOG_FILE_PATH, "a+");
+ if (fp == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Get file error");
+ return;
+ }
+
+ size_t total = stats.size;
+ size_t current = stats.allocated_bytes;
+ size_t peak = stats.peak_allocated_bytes;
+ // jerry total memory
+ char markdata[MSG_LENGTH];
+ if (sprintf_s(markdata, MSG_LENGTH, "jerry heap total:%d(KB)\n", uint32_t(total / UNIT)) < 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Output file error.");
+ fclose(fp);
+ fp = nullptr;
+ return;
+ }
+ fputs(markdata, fp);
+
+ // jerry current memory
+ if (sprintf_s(markdata, MSG_LENGTH, "jerry heap current:%d(KB)\n", uint32_t(current / UNIT)) < 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Output file error.");
+ fclose(fp);
+ fp = nullptr;
+ return;
+ }
+ fputs(markdata, fp);
+
+ // jerry peak memory
+ if (sprintf_s(markdata, MSG_LENGTH, "jerry heap peak:%d(KB)\n", uint32_t(peak / UNIT)) < 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Output file error.");
+ fclose(fp);
+ fp = nullptr;
+ return;
+ }
+ fputs(markdata, fp);
+
+ fflush(fp);
+ fclose(fp);
+ fp = nullptr;
+}
+
+bool AceMemProc::IsEnabled()
+{
+ return IsFileExisted(MEM_PROC_ENABLE_FLAG_FILE);
+}
+} // namespace ACELite
+} // namespace OHOS
+#endif // SIMULATOR_MEMORY_ANALYSIS
diff --git a/frameworks/src/core/base/mem_proc.h b/frameworks/src/core/base/mem_proc.h
new file mode 100644
index 0000000..21036b5
--- /dev/null
+++ b/frameworks/src/core/base/mem_proc.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_MEM_PROC_H
+#define OHOS_ACELITE_MEM_PROC_H
+
+#include "acelite_config.h"
+#ifdef SIMULATOR_MEMORY_ANALYSIS
+#define CLEAR_UP() AceMemProc::GetInstance()->ClearUp()
+#define SYS_MEMORY_TRACING() AceMemProc::GetInstance()->SysMemTracing()
+#define JERRY_MEMORY_TRACING() AceMemProc::GetInstance()->JerryMemTracing()
+#else
+#define CLEAR_UP()
+#define SYS_MEMORY_TRACING()
+#define JERRY_MEMORY_TRACING()
+#endif // SIMULATOR_MEMORY_ANALYSIS
+
+#ifdef SIMULATOR_MEMORY_ANALYSIS
+namespace OHOS {
+namespace ACELite {
+class AceMemProc {
+public:
+ /**
+ * @brief Use static global variable for easy access in different source code file.
+ *
+ * @return global singleton AceMemProc object
+ */
+ static AceMemProc *GetInstance();
+
+ /**
+ * @brief Check if the memory proc is enabled or not.
+ *
+ * @return true for enabled, false for not
+ */
+ static bool IsEnabled();
+
+ /**
+ * @brief Clear up the previous analysis file.
+ */
+ void ClearUp();
+
+ /**
+ * @brief Output the system memory.
+ */
+ void SysMemTracing();
+
+ /**
+ * @brief Output the jerry memory.
+ *
+ */
+ void JerryMemTracing();
+
+private:
+ /**
+ * @brief Default constructor.
+ */
+ AceMemProc() = default;
+
+ /**
+ * @brief Default destructor.
+ */
+ ~AceMemProc() = default;
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // SIMULATOR_MEMORY_ANALYSIS
+#endif // OHOS_ACELITE_MEM_PROC_H
\ No newline at end of file
diff --git a/src/core/base/memory_heap.cpp b/frameworks/src/core/base/memory_heap.cpp
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/base/memory_heap.cpp
rename to frameworks/src/core/base/memory_heap.cpp
diff --git a/src/core/base/non_copyable.h b/frameworks/src/core/base/non_copyable.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/base/non_copyable.h
rename to frameworks/src/core/base/non_copyable.h
diff --git a/frameworks/src/core/base/number_parser.cpp b/frameworks/src/core/base/number_parser.cpp
new file mode 100644
index 0000000..751646d
--- /dev/null
+++ b/frameworks/src/core/base/number_parser.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "number_parser.h"
+#include
+#include
+#include "ace_log.h"
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * @brief ParseDoubleValue convert one string to number(int32_t) value
+ * @param percentStr the under processing string
+ * @param strLength the given string length
+ * @param outValue the converted result
+ * @return the process result, false for converting failed, true for success, caller
+ * should check the returned value before using outValue.
+ */
+bool NumberParser::ParseDoubleValue(const char *str, uint16_t strLength, double &outValue)
+{
+ if (!IsValidString(str, strLength)) {
+ return false;
+ }
+
+ outValue = strtod(str, nullptr);
+ return true;
+}
+
+/**
+ * @brief ParsePercentValue convert percent string to number value
+ * @param percentStr the under processing percent string, for example "10%"
+ * @param strLength the given percent string length
+ * @param outValue the converted result
+ * @return the process result, false for converting failed, true for success, caller
+ * should check the returned value before using outValue.
+ */
+bool NumberParser::ParsePercentValue(const char *percentStr, uint16_t strLength, float &outValue)
+{
+ constexpr uint16_t minLength = 2;
+ // check input parameters
+ if (!(IsValidString(percentStr, strLength)) || (strLength < minLength)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "parse percent value failed, invalid input parameters");
+ return false;
+ }
+ size_t originalStrLen = strlen(percentStr);
+ uint16_t ensuredStrLength = (strLength > originalStrLen) ? originalStrLen : strLength;
+ // only support max 15 bytes length string
+ constexpr uint16_t maxLength = 16;
+ if (ensuredStrLength > maxLength) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "parse percent value failed, input string too long [%d]", ensuredStrLength);
+ return false;
+ }
+ // the latest charater must be %, and the first digit must not be "."
+ if ((percentStr[0] == '.') || (percentStr[ensuredStrLength - 1] != '%')) {
+ return false;
+ }
+ // check if the string is one valid number format
+ uint16_t index = (percentStr[0] == '-') ? 1 : 0;
+ constexpr uint16_t minNegativeLength = minLength + 1;
+ if ((index == 1) && (ensuredStrLength < minNegativeLength)) {
+ // for negative number, the min length is 3
+ return false;
+ }
+ while ((index < ensuredStrLength) && (percentStr[index] != '%')) {
+ if ((percentStr[index] != '.') && ((percentStr[index] < '0') || (percentStr[index] > '9'))) {
+ // give up the parsing, it's not digit format
+ return false;
+ }
+ index++;
+ }
+ // do the parsing
+ outValue = (float)(strtod(percentStr, nullptr));
+ return true;
+}
+
+/**
+ * @brief IsValidString check if the input target string is valid
+ * @param str the given under processing string
+ * @param strLength the given string's length
+ * @return true for valid string, false for not
+ */
+bool NumberParser::IsValidString(const char *str, uint16_t strLength)
+{
+ return ((str != nullptr) && (strLength != 0));
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/base/number_parser.h b/frameworks/src/core/base/number_parser.h
new file mode 100644
index 0000000..a12063c
--- /dev/null
+++ b/frameworks/src/core/base/number_parser.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_NUMBER_PARSER_H
+#define OHOS_ACELITE_NUMBER_PARSER_H
+
+#include
+#include "non_copyable.h"
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * Utils class for number formating operations.
+ */
+class NumberParser final {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(NumberParser);
+ NumberParser() = delete;
+ ~NumberParser() = delete;
+
+ /**
+ * @brief ParseDoubleValue convert one string to number(double) value
+ * @param percentStr the under processing string
+ * @param strLength the given string length
+ * @param outValue the converted result
+ * @return the process result, false for converting failed, true for success, caller
+ * should check the returned value before using outValue.
+ */
+ static bool ParseDoubleValue(const char *str, uint16_t strLength, double &outValue);
+
+ /**
+ * @brief ParsePercentValue convert percent string to number value
+ * @param percentStr the under processing percent string, for example "10%"
+ * @param strLength the given percent string length
+ * @param outValue the converted result
+ * @return the process result, false for converting failed, true for success, caller
+ * should check the returned value before using outValue.
+ */
+ static bool ParsePercentValue(const char *percentStr, uint16_t strLength, float &outValue);
+
+private:
+ /**
+ * @brief IsValidString check if the input target string is valid
+ * @param str the given under processing string
+ * @param strLength the given string's length
+ * @return true for valid string, false for not
+ */
+ static bool IsValidString(const char *str, uint16_t strLength);
+};
+} // namespace ACELite
+} // namespace OHOS
+
+#endif // OHOS_ACELITE_NUMBER_PARSER_H
diff --git a/frameworks/src/core/base/product_adapter.cpp b/frameworks/src/core/base/product_adapter.cpp
new file mode 100644
index 0000000..7c6ca96
--- /dev/null
+++ b/frameworks/src/core/base/product_adapter.cpp
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "product_adapter.h"
+
+#include "acelite_config.h"
+#include "graphic_config.h"
+#include "js_async_work.h"
+#include "message_queue_utils.h"
+#include "module_manager.h"
+
+namespace OHOS {
+namespace ACELite {
+/**
+ * Used for holding all the related dfx interfaces assigned from specific implementation.
+ */
+struct DFXWrapper {
+ DFXWrapper()
+ : eventTag_(0),
+ eventSubTag_(0),
+ errCodeTag_(0),
+ errCodeSubTag_(0),
+ eventPrintHandler_(nullptr),
+ errCodePrintHandler_(nullptr),
+ jsLogOutputHandler_(nullptr),
+ nativeMemInfoGetter_(nullptr)
+ {
+ }
+ uint8_t eventTag_;
+ uint8_t eventSubTag_;
+ uint8_t errCodeTag_;
+ uint8_t errCodeSubTag_;
+ EventPrintHandler eventPrintHandler_;
+ ErrCodePrintHandler errCodePrintHandler_;
+ JSLogOutputHandler jsLogOutputHandler_;
+ NativeMemInfoGetter nativeMemInfoGetter_;
+};
+
+static DFXWrapper g_dfxWrapper;
+static TEHandlingHooks g_teHandlingHooks = {nullptr, nullptr};
+static TerminateAbilityHandler g_termiantingHandler = nullptr;
+// default font styles
+static char *g_defaultFontFamilyName = nullptr;
+static uint8_t g_defaultFontSize = 30;
+static uint16_t g_screenWidth = 454;
+static uint16_t g_screenHeight = 454;
+
+// indicating if the ace application is on forground
+static bool g_isAceForground = false;
+
+void ProductAdapter::InitAceTags(uint8_t *aceTags, uint8_t tagCount)
+{
+ const uint8_t minCount = 4;
+ if (aceTags == nullptr || tagCount < minCount) {
+ return;
+ }
+ uint8_t index = 0;
+ g_dfxWrapper.eventTag_ = aceTags[index++];
+ g_dfxWrapper.eventSubTag_ = aceTags[index++];
+ g_dfxWrapper.errCodeTag_ = aceTags[index++];
+ g_dfxWrapper.errCodeSubTag_ = aceTags[index++];
+}
+
+void ProductAdapter::InitTraceHandlers(EventPrintHandler eventHandler, ErrCodePrintHandler errCodeHandler)
+{
+ g_dfxWrapper.eventPrintHandler_ = eventHandler;
+ g_dfxWrapper.errCodePrintHandler_ = errCodeHandler;
+}
+
+void ProductAdapter::InitConsoleNativeHandler(JSLogOutputHandler handler)
+{
+ g_dfxWrapper.jsLogOutputHandler_ = handler;
+}
+
+void ProductAdapter::InitNativeMemPoolHook(NativeMemInfoGetter getter)
+{
+ g_dfxWrapper.nativeMemInfoGetter_ = getter;
+}
+
+void ProductAdapter::InitExtraModulesGetter(ProductModulesGetter productModuleGetter,
+ PrivateModulesGetter privateModuleGetter)
+{
+ ModuleManager::GetInstance()->SetProductModulesGetter(productModuleGetter);
+ ModuleManager::GetInstance()->SetPrivateModulesGetter(privateModuleGetter);
+}
+
+void ProductAdapter::PrintEventTrace(uint8_t info2, uint8_t info3, uint8_t info4)
+{
+ if (g_dfxWrapper.eventPrintHandler_ == nullptr || g_dfxWrapper.eventTag_ == 0 || g_dfxWrapper.eventSubTag_ == 0) {
+ return;
+ }
+
+ uint8_t subTag = (info2 == 0) ? g_dfxWrapper.eventSubTag_ : info2;
+ g_dfxWrapper.eventPrintHandler_(g_dfxWrapper.eventTag_, subTag, info3, info4);
+}
+
+void ProductAdapter::PrintErrCode(uint8_t info2, uint16_t rfu)
+{
+ if (g_dfxWrapper.errCodePrintHandler_ == nullptr || g_dfxWrapper.errCodeTag_ == 0 ||
+ g_dfxWrapper.errCodeSubTag_ == 0) {
+ return;
+ }
+ g_dfxWrapper.errCodePrintHandler_(g_dfxWrapper.errCodeTag_, g_dfxWrapper.errCodeSubTag_, info2, rfu);
+}
+
+void ProductAdapter::OutputJSConsoleLog(uint8_t level, const char *content)
+{
+ if (g_dfxWrapper.jsLogOutputHandler_ == nullptr) {
+ return;
+ }
+ g_dfxWrapper.jsLogOutputHandler_(level, content);
+}
+
+void ProductAdapter::GetNativeMemInfo(NativeMemInfo *memInfo)
+{
+ if (g_dfxWrapper.nativeMemInfoGetter_ == nullptr) {
+ return;
+ }
+
+ g_dfxWrapper.nativeMemInfoGetter_(memInfo);
+}
+
+void ProductAdapter::RegTerminatingHandler(TerminateAbilityHandler handler)
+{
+ g_termiantingHandler = handler;
+}
+
+void ProductAdapter::RegTEHandlers(const TEHandlingHooks &teHandlingHooks)
+{
+ g_teHandlingHooks.renderTEHandler = teHandlingHooks.renderTEHandler;
+ g_teHandlingHooks.renderEndHandler = teHandlingHooks.renderEndHandler;
+}
+
+// NOTE: This TE function will be called in VSYNC interrupt, and
+// as no any task can be switched to during an interrupt, so it's safe to
+// read the global value directly here.
+TEDispatchingResult ProductAdapter::DispatchTEMessage()
+{
+#ifdef OHOS_ACELITE_PRODUCT_WATCH // only some specific products support TE dispatching
+ if (!g_isAceForground) {
+ return TEDispatchingResult::REFUSED;
+ }
+
+ if (JsAsyncWork::DispatchToLoop(TE_EVENT, nullptr)) {
+ return TEDispatchingResult::ACCEPTED;
+ }
+ // if the ACE application is on forground and the dispatching failed, should retry sending to ACE again
+ return TEDispatchingResult::ACCEPT_FAILED;
+#else
+ return TEDispatchingResult::REFUSED;
+#endif // OHOS_ACELITE_PRODUCT_WATCH
+}
+
+void ProductAdapter::SendTerminatingRequest(uint32_t token, bool forceStop)
+{
+ if (g_termiantingHandler != nullptr) {
+ g_termiantingHandler(token, forceStop);
+ }
+}
+
+bool ProductAdapter::IsTEHandlersRegisted()
+{
+ return (g_teHandlingHooks.renderTEHandler != nullptr);
+}
+
+void ProductAdapter::ProcessOneTE()
+{
+ if (g_teHandlingHooks.renderTEHandler != nullptr) {
+ (void)(g_teHandlingHooks.renderTEHandler());
+ }
+}
+
+void ProductAdapter::NotifyRenderEnd()
+{
+ if (g_teHandlingHooks.renderEndHandler != nullptr) {
+ g_teHandlingHooks.renderEndHandler();
+ }
+}
+
+void ProductAdapter::SetDefaultFontStyle(const char *defaultFontFamily, uint8_t defaultFontSize)
+{
+ g_defaultFontFamilyName = const_cast(defaultFontFamily);
+ g_defaultFontSize = defaultFontSize;
+}
+
+const char *ProductAdapter::GetDefaultFontFamilyName()
+{
+ return (g_defaultFontFamilyName != nullptr) ? g_defaultFontFamilyName : DEFAULT_VECTOR_FONT_FILENAME;
+}
+
+uint8_t ProductAdapter::GetDefaultFontSize()
+{
+ return g_defaultFontSize;
+}
+
+void ProductAdapter::UpdateShowingState(bool forground)
+{
+ g_isAceForground = forground;
+}
+
+void ProductAdapter::SetScreenSize(uint16_t width, uint16_t height)
+{
+ g_screenWidth = width;
+ g_screenHeight = height;
+}
+
+void ProductAdapter::GetScreenSize(uint16_t &width, uint16_t &height)
+{
+ width = g_screenWidth;
+ height = g_screenHeight;
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/src/core/base/string_util.cpp b/frameworks/src/core/base/string_util.cpp
old mode 100644
new mode 100755
similarity index 91%
rename from src/core/base/string_util.cpp
rename to frameworks/src/core/base/string_util.cpp
index 5fe0d9f..5650417
--- a/src/core/base/string_util.cpp
+++ b/frameworks/src/core/base/string_util.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,10 +15,8 @@
#include "ace_mem_base.h"
#include "js_config.h"
-#include "string_util.h"
-#if ENABLED(SECURE_C_FUNCTION)
#include "securec.h"
-#endif // ENABLED(SECURE_C_FUNCTION)
+#include "string_util.h"
namespace OHOS {
namespace ACELite {
@@ -28,6 +26,9 @@ char *StringUtil::Copy(const char *sequence)
return nullptr;
}
size_t size = strlen(sequence);
+ if (size >= UINT16_MAX) {
+ return nullptr;
+ }
char *buffer = StringUtil::Malloc(size);
if (buffer == nullptr) {
return nullptr;
@@ -66,7 +67,7 @@ char *StringUtil::Slice(const char *sequence, const int32_t start, const int32_t
if (startIdx < endIdx || endIdx < 0) {
return nullptr;
}
- uint32_t diffSize = endIdx - startIdx;
+ int32_t diffSize = endIdx - startIdx;
if (diffSize < 0) {
return nullptr;
}
@@ -74,7 +75,7 @@ char *StringUtil::Slice(const char *sequence, const int32_t start, const int32_t
if (buffer == nullptr) {
return nullptr;
}
- if (strncpy_s(buffer, size + 1, sequence + startIdx, diffSize) == 0) {
+ if (strncpy_s(buffer, diffSize + 1, sequence + startIdx, diffSize) == 0) {
return buffer;
}
ace_free(buffer);
diff --git a/src/core/base/string_util.h b/frameworks/src/core/base/string_util.h
similarity index 100%
rename from src/core/base/string_util.h
rename to frameworks/src/core/base/string_util.h
diff --git a/src/core/base/time_util.cpp b/frameworks/src/core/base/time_util.cpp
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/base/time_util.cpp
rename to frameworks/src/core/base/time_util.cpp
diff --git a/src/core/base/time_util.h b/frameworks/src/core/base/time_util.h
old mode 100755
new mode 100644
similarity index 88%
rename from src/core/base/time_util.h
rename to frameworks/src/core/base/time_util.h
index ad6b0e9..6cb6c7a
--- a/src/core/base/time_util.h
+++ b/frameworks/src/core/base/time_util.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -17,9 +17,7 @@
#define OHOS_ACELITE_TIME_UTIL_H
#include
#include "js_config.h"
-#if ENABLED(SECURE_C_FUNCTION)
#include "securec.h"
-#endif // ENABLED(SECURE_C_FUNCTION)
namespace OHOS {
namespace ACELite {
diff --git a/src/core/components/analog_clock_component.cpp b/frameworks/src/core/components/analog_clock_component.cpp
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/components/analog_clock_component.cpp
rename to frameworks/src/core/components/analog_clock_component.cpp
diff --git a/src/core/components/analog_clock_component.h b/frameworks/src/core/components/analog_clock_component.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/components/analog_clock_component.h
rename to frameworks/src/core/components/analog_clock_component.h
diff --git a/src/core/components/camera_component.cpp b/frameworks/src/core/components/camera_component.cpp
similarity index 87%
rename from src/core/components/camera_component.cpp
rename to frameworks/src/core/components/camera_component.cpp
index b6ca76c..b04e8f1 100755
--- a/src/core/components/camera_component.cpp
+++ b/frameworks/src/core/components/camera_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -17,6 +17,7 @@
#ifdef FEATURE_COMPONENT_CAMERA
#include "camera_component.h"
+#include
#include
#include
#include
@@ -39,13 +40,11 @@ jerry_value_t CameraComponent::jsContext_;
bool CameraComponent::lastCaptureCompleted_ = true;
const char * const CameraComponent::TAKE_PHOTO = "takePhoto";
-
-const uint32_t CameraComponent::IMAG_W_PIXELS_LOW = 720;
-const uint32_t CameraComponent::IMAG_H_PIXELS_LOW = 576;
-const uint32_t CameraComponent::IMAG_W_PIXELS_NORMAL = 1280;
-const uint32_t CameraComponent::IMAG_H_PIXELS_NORMAL = 720;
-const uint32_t CameraComponent::IMAG_W_PIXELS_HIGH = 1920;
-const uint32_t CameraComponent::IMAG_H_PIXELS_HIGH = 1080;
+const uint32_t CameraComponent::IMAG_W_PIXELS = 1920;
+const uint32_t CameraComponent::IMAG_H_PIXELS = 1080;
+const int32_t CameraComponent::IMAG_QFACTOR_LOW = 50;
+const int32_t CameraComponent::IMAG_QFACTOR_NORMAL = 85;
+const int32_t CameraComponent::IMAG_QFACTOR_HIGH = 90;
void FrameCallback::OnFrameFinished(Media::Camera &camera,
Media::FrameConfig &frameConfig,
@@ -141,9 +140,16 @@ string *FrameCallback::CreateFilePath() const
{
const char *dataPath = GetDataPath();
if (dataPath == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "FrameCallback: get data path failed!");
return nullptr;
}
- string dataPathStr(dataPath);
+ char fullDataPath[PATH_MAX + 1] = {0};
+ if (realpath(dataPath, fullDataPath) == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "FrameCallback: invalid data path!");
+ return nullptr;
+ }
+
+ string dataPathStr(fullDataPath);
string prefix = dataPathStr + "/Img_";
ostringstream oss;
struct timeval timeVal;
@@ -272,6 +278,8 @@ bool CameraComponent::CreateNativeViews()
cameraCallback_ = make_unique();
frameConfig_ = new Media::FrameConfig(Media::FRAME_CONFIG_CAPTURE);
if (frameConfig_ != nullptr) {
+ captureSurface_->SetWidthAndHeight(IMAG_W_PIXELS, IMAG_H_PIXELS);
+ captureSurface_->SetUsage(BUFFER_CONSUMER_USAGE_HARDWARE);
frameConfig_->AddSurface(*captureSurface_);
}
return true;
@@ -301,7 +309,9 @@ inline UIView *CameraComponent::GetComponentRootView() const
return static_cast(cameraView_.get());
}
-bool CameraComponent::RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
+bool CameraComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation)
{
bool result = false;
switch (eventTypeId) {
@@ -326,12 +336,32 @@ void CameraComponent::PostRender()
}
list camList = cameraKit_->GetCameraIds();
if (camList.empty()) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "CameraComponent: empty camera list!");
return;
}
const string cameraId = camList.front();
+ const Media::CameraAbility *ability = cameraKit_->GetCameraAbility(cameraId);
+ if (ability == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "CameraComponent: get camera ability failed!");
+ return;
+ }
+ bool isSizeSupported = false;
+ list sizeList = ability->GetSupportedSizes(0);
+ for (auto &pic : sizeList) {
+ if (pic.width == IMAG_W_PIXELS && pic.height == IMAG_H_PIXELS) {
+ isSizeSupported = true;
+ break;
+ }
+ }
+ if (!isSizeSupported) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "CameraComponent: capture resolution unsupported!");
+ return;
+ }
+
Surface *previewSurface = cameraView_->GetSurface();
if (previewSurface != nullptr) {
- previewSurface->SetWidthAndHeight(IMAG_W_PIXELS_NORMAL, IMAG_H_PIXELS_NORMAL);
+ previewSurface->SetWidthAndHeight(IMAG_W_PIXELS, IMAG_H_PIXELS);
+ previewSurface->SetUsage(BUFFER_CONSUMER_USAGE_HARDWARE);
cameraCallback_->SetPreviewSurface(*previewSurface);
}
cameraKit_->CreateCamera(cameraId, *cameraCallback_.get(), *cameraCallback_->GetEventHandler());
@@ -388,26 +418,20 @@ void CameraComponent::ReleaseStaticResources()
bool CameraComponent::CaptureFrame(const CameraComponent *component, const char *quality)
{
Media::FrameConfig *frameConfig = component->GetFrameConfig();
- Surface *surface = const_cast(component->GetCaptureSurface());
- if ((frameConfig == nullptr) || (surface == nullptr)) {
+ if (frameConfig == nullptr) {
return false;
}
-
- uint32_t surfWidth = IMAG_W_PIXELS_NORMAL; // corresponding to default resolution
- uint32_t surfHeight = IMAG_H_PIXELS_NORMAL; // corresponding to default resolution
+ int32_t qfactor = IMAG_QFACTOR_NORMAL;
if (quality != nullptr) {
const char * const qualityLow = "low";
const char * const qualityHigh = "high";
if (strcmp(quality, qualityLow) == 0) {
- surfWidth = IMAG_W_PIXELS_LOW;
- surfHeight = IMAG_H_PIXELS_LOW;
+ qfactor = IMAG_QFACTOR_LOW;
} else if (strcmp(quality, qualityHigh) == 0) {
- surfWidth = IMAG_W_PIXELS_HIGH;
- surfHeight = IMAG_H_PIXELS_HIGH;
+ qfactor = IMAG_QFACTOR_HIGH;
}
}
- surface->SetWidthAndHeight(surfWidth, surfHeight);
-
+ frameConfig->SetParameter(PARAM_KEY_IMAGE_ENCODE_QFACTOR, qfactor);
const CameraCallback *cameraCallback = component->GetCameraCallback();
if (cameraCallback == nullptr) {
return false;
diff --git a/src/core/components/camera_component.h b/frameworks/src/core/components/camera_component.h
similarity index 91%
rename from src/core/components/camera_component.h
rename to frameworks/src/core/components/camera_component.h
index b090467..71ab07b 100755
--- a/src/core/components/camera_component.h
+++ b/frameworks/src/core/components/camera_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -149,7 +149,9 @@ protected:
bool CreateNativeViews() override;
void ReleaseNativeViews() override;
UIView *GetComponentRootView() const override;
- bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation) override;
void PostRender() override;
private:
@@ -159,23 +161,17 @@ private:
Media::FrameConfig *frameConfig_;
Surface *captureSurface_;
static const char * const TAKE_PHOTO;
- static const uint32_t IMAG_W_PIXELS_LOW;
- static const uint32_t IMAG_H_PIXELS_LOW;
- static const uint32_t IMAG_W_PIXELS_NORMAL;
- static const uint32_t IMAG_H_PIXELS_NORMAL;
- static const uint32_t IMAG_W_PIXELS_HIGH;
- static const uint32_t IMAG_H_PIXELS_HIGH;
+ static const uint32_t IMAG_W_PIXELS;
+ static const uint32_t IMAG_H_PIXELS;
+ static const int32_t IMAG_QFACTOR_LOW;
+ static const int32_t IMAG_QFACTOR_NORMAL;
+ static const int32_t IMAG_QFACTOR_HIGH;
Media::FrameConfig *GetFrameConfig() const
{
return frameConfig_;
}
- const Surface *GetCaptureSurface() const
- {
- return captureSurface_;
- }
-
static bool CaptureFrame(const CameraComponent *component, const char *quality);
static jerry_value_t TakePhoto(const jerry_value_t func,
const jerry_value_t context,
diff --git a/frameworks/src/core/components/canvas_component.cpp b/frameworks/src/core/components/canvas_component.cpp
new file mode 100644
index 0000000..e78c09e
--- /dev/null
+++ b/frameworks/src/core/components/canvas_component.cpp
@@ -0,0 +1,960 @@
+/*
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "acelite_config.h"
+
+#ifdef FEATURE_COMPONENT_CANVAS
+#include "canvas_component.h"
+#include "js_fwk_common.h"
+#include "product_adapter.h"
+#include "securec.h"
+
+namespace OHOS {
+namespace ACELite {
+// default fill style color=black
+const char * const CanvasComponent::DEFAULT_FILLSTYLE = "#000000";
+// default stroke style color=black
+const char * const CanvasComponent::DEFAULT_STROKESTYLE = "#000000";
+// default text align=left
+const char * const CanvasComponent::DEFAULT_TEXTALIGN = "left";
+
+// API-attribute
+const char * const CanvasComponent::ATTR_FILLSTYLE = "fillStyle";
+const char * const CanvasComponent::ATTR_STROKESTYLE = "strokeStyle";
+const char * const CanvasComponent::ATTR_LINEWIDTH = "lineWidth";
+const char * const CanvasComponent::ATTR_FONT = "font";
+const char * const CanvasComponent::ATTR_TEXTALIGN = "textAlign";
+
+// API-method
+const char * const CanvasComponent::FUNC_GETCONTEXT = "getContext";
+const char * const CanvasComponent::FUNC_FILLRECT = "fillRect";
+const char * const CanvasComponent::FUNC_STROKERECT = "strokeRect";
+const char * const CanvasComponent::FUNC_FILLTEXT = "fillText";
+const char * const CanvasComponent::FUNC_BEGINPATH = "beginPath";
+const char * const CanvasComponent::FUNC_MOVETO = "moveTo";
+const char * const CanvasComponent::FUNC_LINETO = "lineTo";
+const char * const CanvasComponent::FUNC_RECT = "rect";
+const char * const CanvasComponent::FUNC_ARC = "arc";
+const char * const CanvasComponent::FUNC_CLOSEPATH = "closePath";
+const char * const CanvasComponent::FUNC_STROKE = "stroke";
+
+// create canvas draw attribute-callback mapping
+const AttrMap CanvasComponent::attrMap_[] = {
+ {ATTR_FILLSTYLE, FillStyleSetter, FillStyleGetter},
+ {ATTR_STROKESTYLE, StrokeStyleSetter, StrokeStyleGetter},
+ {ATTR_LINEWIDTH, LineWidthSetter, LineWidthGetter},
+ {ATTR_FONT, FontSetter, FontGetter},
+ {ATTR_TEXTALIGN, TextAlignSetter, TextAlignGetter}
+};
+
+// create canvas draw method-callback mapping
+const MethodMap CanvasComponent::methodMap_[] = {
+ {FUNC_GETCONTEXT, GetContext},
+ {FUNC_FILLRECT, FillRect},
+ {FUNC_STROKERECT, StrokeRect},
+ {FUNC_FILLTEXT, FillText},
+ {FUNC_BEGINPATH, BeginPath},
+ {FUNC_MOVETO, MoveTo},
+ {FUNC_LINETO, LineTo},
+ {FUNC_RECT, Rect},
+ {FUNC_ARC, Arc},
+ {FUNC_CLOSEPATH, ClosePath},
+ {FUNC_STROKE, Stroke}
+};
+
+CanvasComponent::CanvasComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager)
+ : Component(options, children, styleManager),
+ context_(UNDEFINED),
+ fillStyleValue_(nullptr),
+ strokeStyleValue_(nullptr),
+ fontValue_(nullptr),
+ textAlignValue_(nullptr),
+ lineWidthValue_(1)
+{
+ SetComponentName(K_CANVAS);
+ // set default paint pattern
+ paint_.SetFillColor(Color::Black());
+ paint_.SetOpacity(OPA_OPAQUE);
+ paint_.SetStrokeColor(Color::Black());
+ paint_.SetStrokeWidth(1);
+
+ // set default text font pattern
+ fontStyle_.align = TEXT_ALIGNMENT_LEFT;
+ fontStyle_.direct = TEXT_DIRECT_LTR;
+ fontStyle_.fontSize = ProductAdapter::GetDefaultFontSize();
+ char *defaultFontName = nullptr;
+ CopyFontFamily(defaultFontName, ProductAdapter::GetDefaultFontFamilyName());
+ fontStyle_.fontName = defaultFontName;
+ fontStyle_.letterSpace = DEFAULT_FONT_LETTERSPACE;
+
+ RegisterNamedFunction(methodMap_[0].methodName, methodMap_[0].callbackName);
+}
+
+// Create UICanvas
+bool CanvasComponent::CreateNativeViews()
+{
+ return true;
+}
+
+void CanvasComponent::ReleaseNativeViews()
+{
+ ACE_FREE(fillStyleValue_);
+ ACE_FREE(strokeStyleValue_);
+ ACE_FREE(fontValue_);
+ ACE_FREE(textAlignValue_);
+ // free fontStyle_.fontName memory which malloc in FontSetter method.
+ if (fontStyle_.fontName != nullptr) {
+ ace_free(const_cast(fontStyle_.fontName));
+ fontStyle_.fontName = nullptr;
+ }
+ if (!IS_UNDEFINED(context_)) {
+ bool deleted = jerry_delete_object_native_pointer(context_, nullptr);
+ if (!deleted) {
+ HILOG_WARN(HILOG_MODULE_ACE, "canvas_component: delete object native pointer context_ failed!");
+ }
+ jerry_release_value(context_);
+ }
+}
+
+UIView *CanvasComponent::GetComponentRootView() const
+{
+ return (const_cast(&canvas_));
+}
+
+jerry_value_t CanvasComponent::GetContext(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ if (argsNum != ArgsCount::NUM_1) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of getContext method parameter error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("getContext method parameter error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ if (IS_UNDEFINED(component->context_)) {
+ component->context_ = jerry_create_object();
+ jerry_set_object_native_pointer(component->context_, component, nullptr);
+
+ // register fillStyle, strokeStyle, lineWidth, font, textAlign attribute
+ uint16_t attrMapLength = sizeof(attrMap_) / sizeof(attrMap_[0]);
+ for (uint16_t index = 0; index < attrMapLength; index++) {
+ RegisterAttributeFunc(component->context_, attrMap_[index].attrName, attrMap_[index].setterName,
+ attrMap_[index].getterName);
+ }
+
+ // register fillRect, strokeRect, fillText, beginPath, moveTo, lineTo, rect, arc, closePath, stroke method
+ uint16_t methodMapLength = sizeof(methodMap_) / sizeof(methodMap_[0]);
+ for (uint16_t index = 1; index < methodMapLength; index++) {
+ RegisterDrawMethodFunc(component->context_, methodMap_[index].methodName, methodMap_[index].callbackName);
+ }
+ }
+
+ // BeginPath function need to be called after getting canvas API object
+ component->canvas_.BeginPath();
+
+ jerry_acquire_value(component->context_);
+ return component->context_;
+}
+
+jerry_value_t CanvasComponent::FillStyleSetter(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_1) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: fillStyle value error!");
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("fillStyle value error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ ACE_FREE(component->fillStyleValue_);
+
+ component->fillStyleValue_ = MallocStringOf(args[ArgsIndex::IDX_0]);
+ if (component->fillStyleValue_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: fillStyle value error!");
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("fillStyle value erro!"));
+ }
+
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ ParseColor(component->fillStyleValue_, color, alpha);
+ component->paint_.SetFillColor(component->GetRGBColor(color));
+ component->paint_.SetOpacity(alpha);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::FillStyleGetter(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ (void)argsNum;
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ if (component->fillStyleValue_ == nullptr) {
+ CopyFontFamily(component->fillStyleValue_, DEFAULT_FILLSTYLE);
+ }
+
+ if (component->fillStyleValue_ != nullptr) {
+ return jerry_create_string(reinterpret_cast(component->fillStyleValue_));
+ }
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("fillStyle value error"));
+}
+
+jerry_value_t CanvasComponent::StrokeStyleSetter(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_1) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: strokeStyle value error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("the value of strokeStyle is null"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ ACE_FREE(component->strokeStyleValue_);
+
+ component->strokeStyleValue_ = MallocStringOf(args[ArgsIndex::IDX_0]);
+ if (component->strokeStyleValue_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: strokeStyle value error");
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("strokeStyle value error"));
+ }
+
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ ParseColor(component->strokeStyleValue_, color, alpha);
+ component->paint_.SetStrokeColor(component->GetRGBColor(color));
+ component->paint_.SetOpacity(alpha);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::StrokeStyleGetter(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ (void)argsNum;
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ if (component->strokeStyleValue_ == nullptr) {
+ CopyFontFamily(component->strokeStyleValue_, DEFAULT_STROKESTYLE);
+ }
+
+ if (component->strokeStyleValue_ != nullptr) {
+ return jerry_create_string(reinterpret_cast(component->strokeStyleValue_));
+ }
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("strokeStyle value error"));
+}
+
+jerry_value_t CanvasComponent::LineWidthSetter(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_1) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: lineWidth value error!");
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("lineWidth value error!"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ component->lineWidthValue_ = IntegerOf(args[ArgsIndex::IDX_0]);
+ component->paint_.SetStrokeWidth(component->lineWidthValue_);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::LineWidthGetter(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ (void)argsNum;
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+ return jerry_create_number(component->lineWidthValue_);
+}
+
+jerry_value_t CanvasComponent::FontSetter(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_1) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: font value error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("font value error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ ACE_FREE(component->fontValue_);
+
+ component->fontValue_ = MallocStringOf(args[ArgsIndex::IDX_0]);
+ if (component->fontValue_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: text font value error!");
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("text font value error"));
+ }
+
+ const int8_t maxParamCount = 2;
+ for (int8_t index = 0; index < maxParamCount; index++) {
+ // get font size or font family from fontValue.
+ char *mallocSubFont = nullptr;
+ component->GetSubFont(component->fontValue_, index, mallocSubFont);
+ if (mallocSubFont == nullptr) {
+ HILOG_WARN(HILOG_MODULE_ACE, "canvas_component: get text font size or font family failed");
+ ace_free(component->fontValue_);
+ component->fontValue_ = nullptr;
+ return UNDEFINED;
+ }
+
+ // if it is a font size
+ if (*mallocSubFont >= '0' && *mallocSubFont <= '9') {
+ component->fontStyle_.fontSize = strtol(mallocSubFont, nullptr, DEC);
+ ace_free(mallocSubFont);
+ mallocSubFont = nullptr;
+ } else { // if it is a font family
+ // free default component->fontStyle_.fontName memory.
+ if (component->fontStyle_.fontName != nullptr) {
+ ace_free(const_cast(component->fontStyle_.fontName));
+ component->fontStyle_.fontName = nullptr;
+ }
+ // set customized font name, the memory of mallocFontFamily need be free in CanvasFillText method.
+ component->fontStyle_.fontName = mallocSubFont;
+ }
+ }
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::FontGetter(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ (void)argsNum;
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ if (component->fontValue_ == nullptr) {
+ uint8_t defaultFontSize = ProductAdapter::GetDefaultFontSize();
+ const char *defaultFontName = ProductAdapter::GetDefaultFontFamilyName();
+ size_t nameLength = (defaultFontName != nullptr) ? strlen(defaultFontName) : 0;
+ const uint8_t maxNameLen = 32;
+ const uint8_t maxFontSizeLen = 16;
+ const uint8_t maxBufferLen = maxNameLen + maxFontSizeLen;
+ if (nameLength > 0 && (nameLength < maxNameLen) && (defaultFontSize < UINT8_MAX)) {
+ char defaultFont[maxBufferLen] = {0};
+ int length = sprintf_s(defaultFont, (maxBufferLen - 1), "%dpx %s", defaultFontSize, defaultFontName);
+ if (length > 0 && length < maxBufferLen) {
+ CopyFontFamily(component->fontValue_, defaultFont, length);
+ }
+ }
+ }
+
+ if (component->fontValue_ != nullptr) {
+ return jerry_create_string(reinterpret_cast(component->fontValue_));
+ }
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("text font value error"));
+}
+
+jerry_value_t CanvasComponent::TextAlignSetter(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_1) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: textAlign value error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("textAlign value error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ ACE_FREE(component->textAlignValue_);
+
+ uint16_t textAlignLength = 0;
+ component->textAlignValue_ = MallocStringOf(args[ArgsIndex::IDX_0], &textAlignLength);
+ if (component->textAlignValue_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: text align value error!");
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("text align value error"));
+ }
+
+ uint16_t textAlignId = KeyParser::ParseKeyId(component->textAlignValue_, textAlignLength);
+ if (textAlignId == K_LEFT) {
+ component->fontStyle_.align = TEXT_ALIGNMENT_LEFT;
+ } else if (textAlignId == K_RIGHT) {
+ component->fontStyle_.align = TEXT_ALIGNMENT_RIGHT;
+ } else if (textAlignId == K_CENTER) {
+ component->fontStyle_.align = TEXT_ALIGNMENT_CENTER;
+ } else {
+ // do nothing(use default align=TEXT_ALIGNMENT_LEFT)
+ }
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::TextAlignGetter(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ (void)argsNum;
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ if (component->textAlignValue_ == nullptr) {
+ CopyFontFamily(component->textAlignValue_, DEFAULT_TEXTALIGN);
+ }
+
+ if (component->textAlignValue_ != nullptr) {
+ return jerry_create_string(reinterpret_cast(component->textAlignValue_));
+ }
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("textAlign value error"));
+}
+
+jerry_value_t CanvasComponent::FillRect(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_4) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of fillRect method parameter error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("fillRect method parameter error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ int16_t startX = IntegerOf(args[ArgsIndex::IDX_0]);
+ int16_t startY = IntegerOf(args[ArgsIndex::IDX_1]);
+ int16_t width = IntegerOf(args[ArgsIndex::IDX_2]);
+ int16_t height = IntegerOf(args[ArgsIndex::IDX_3]);
+
+ // FILL_STYLE: fill rect support fill shapses only
+ component->paint_.SetStyle(component->paint_.FILL_STYLE);
+
+ Point startPoint;
+ startPoint.x = startX;
+ startPoint.y = startY;
+ component->canvas_.DrawRect(startPoint, height, width, component->paint_);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::StrokeRect(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_4) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of strokeRect method parameter error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("strokeRect method parameter error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ int16_t startX = IntegerOf(args[ArgsIndex::IDX_0]);
+ int16_t startY = IntegerOf(args[ArgsIndex::IDX_1]);
+ int16_t width = IntegerOf(args[ArgsIndex::IDX_2]);
+ int16_t height = IntegerOf(args[ArgsIndex::IDX_3]);
+
+ // STROKE_STYLE: stroke rect support draw borders only
+ component->paint_.SetStyle(component->paint_.STROKE_STYLE);
+
+ Point startPoint;
+ startPoint.x = startX;
+ startPoint.y = startY;
+ component->canvas_.DrawRect(startPoint, height, width, component->paint_);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::FillText(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_3) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of fillText method parameter error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("fillText method parameter error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ char *textValue = MallocStringOf(args[ArgsIndex::IDX_0]);
+ if (textValue == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get text value failed");
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("get text value failed"));
+ }
+
+ int16_t startX = IntegerOf(args[ArgsIndex::IDX_1]);
+ int16_t startY = IntegerOf(args[ArgsIndex::IDX_2]);
+ int16_t maxWidth = component->canvas_.GetWidth();
+
+ // FILL_STYLE: fillText support fill shapses only
+ component->paint_.SetStyle(component->paint_.FILL_STYLE);
+
+ Point startPoint;
+ const int8_t half = 2;
+ startPoint.x = startX;
+ startPoint.y = startY;
+
+ // if textAlign=left, not need transfer startX, if textAlign=right or center, need transfer startX
+ if (component->fontStyle_.align == TEXT_ALIGNMENT_RIGHT) {
+ startPoint.x = startX - maxWidth;
+ } else if (component->fontStyle_.align == TEXT_ALIGNMENT_CENTER) {
+ startPoint.x = (startX + startX - maxWidth) / half;
+ } else {
+ startPoint.x = startX;
+ }
+
+ component->canvas_.DrawLabel(startPoint, textValue, maxWidth, component->fontStyle_, component->paint_);
+
+ ACE_FREE(textValue);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::BeginPath(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ (void)argsNum;
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ component->canvas_.BeginPath();
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::MoveTo(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_2) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of moveTo method parameter error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("moveTo method parameter error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ int16_t x = IntegerOf(args[ArgsIndex::IDX_0]);
+ int16_t y = IntegerOf(args[ArgsIndex::IDX_1]);
+
+ Point point;
+ point.x = x;
+ point.y = y;
+ component->canvas_.MoveTo(point);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::LineTo(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_2) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of lineTo method parameter error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("lineTo method parameter error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ int16_t x = IntegerOf(args[ArgsIndex::IDX_0]);
+ int16_t y = IntegerOf(args[ArgsIndex::IDX_1]);
+
+ Point point;
+ point.x = x;
+ point.y = y;
+ component->canvas_.LineTo(point);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::Rect(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_4) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of rect method parameter error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("rect method parameter error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ int16_t x = IntegerOf(args[ArgsIndex::IDX_0]);
+ int16_t y = IntegerOf(args[ArgsIndex::IDX_1]);
+ int16_t width = IntegerOf(args[ArgsIndex::IDX_2]);
+ int16_t height = IntegerOf(args[ArgsIndex::IDX_3]);
+
+ Point point;
+ point.x = x;
+ point.y = y;
+ component->canvas_.AddRect(point, height, width);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::Arc(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ if (argsNum != ArgsCount::NUM_5 && argsNum != ArgsCount::NUM_6) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: the number of arc method parameter error!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("arc method parameter error"));
+ }
+
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ int16_t centerX = IntegerOf(args[ArgsIndex::IDX_0]);
+ int16_t centerY = IntegerOf(args[ArgsIndex::IDX_1]);
+ int16_t radius = IntegerOf(args[ArgsIndex::IDX_2]);
+ double sAngle = jerry_get_number_value(args[ArgsIndex::IDX_3]);
+ double eAngle = jerry_get_number_value(args[ArgsIndex::IDX_4]);
+
+ bool counterClockwise = false;
+ if (argsNum == ArgsCount::NUM_6) {
+ if (jerry_value_is_boolean(args[ArgsIndex::IDX_5])) {
+ counterClockwise = BoolOf(args[ArgsIndex::IDX_5]);
+ }
+ }
+
+ Point centerPoint;
+ centerPoint.x = centerX;
+ centerPoint.y = centerY;
+ int16_t startAngle = 0;
+ int16_t endAngle = 0;
+
+ bool result = component->FormatArcAngle(sAngle, eAngle, startAngle, endAngle, counterClockwise);
+ if (!result) {
+ return jerry_create_error(JERRY_ERROR_TYPE, reinterpret_cast("arc angle error"));
+ }
+
+ // 0 degree is at the 3 o'clock position of the arc's circle at JS layer,
+ // but which is at the 12 o'clock position at Native layer.
+ constexpr int16_t DEGREES_OFFSET = 90;
+ constexpr int16_t DEGREES_360 = 360;
+ if (((startAngle + DEGREES_OFFSET) <= INT16_MAX) && ((endAngle + DEGREES_OFFSET) <= INT16_MAX)) {
+ startAngle = startAngle + DEGREES_OFFSET;
+ endAngle = endAngle + DEGREES_OFFSET;
+ } else {
+ startAngle = startAngle + DEGREES_OFFSET - DEGREES_360;
+ endAngle = endAngle + DEGREES_OFFSET - DEGREES_360;
+ }
+
+ component->canvas_.ArcTo(centerPoint, radius, startAngle, endAngle);
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::ClosePath(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ (void)argsNum;
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ component->canvas_.ClosePath();
+ return UNDEFINED;
+}
+
+jerry_value_t CanvasComponent::Stroke(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum)
+{
+ (void)func;
+ (void)args;
+ (void)argsNum;
+ CanvasComponent *component = static_cast(ComponentUtils::GetComponentFromBindingObject(context));
+ if (component == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get canvas component from js object failed!");
+ return jerry_create_error(JERRY_ERROR_TYPE,
+ reinterpret_cast("get canvas component from js object failed"));
+ }
+
+ component->canvas_.DrawPath(component->paint_);
+ return UNDEFINED;
+}
+
+void CanvasComponent::GetSubFont(const char *font, const uint8_t index, char *&subFont) const
+{
+ if (font == nullptr || *font == '\0') {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: get font attribute failed");
+ return;
+ }
+
+ if (strlen(font) >= UINT16_MAX) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: font size overflow.");
+ return;
+ }
+
+ // skip space character at the head of string.
+ while ((*font != '\0') && (*font == ' ')) {
+ font++;
+ }
+
+ uint8_t currentIndex = 0;
+ const char *currentPos = font;
+ const char *endPos = font;
+ while (*currentPos != '\0') {
+ // find the sub font string
+ if (currentIndex == index) {
+ if (*endPos != ' ' && *endPos != '\0') {
+ endPos++;
+ continue;
+ }
+ uint16_t len = endPos - currentPos;
+ uint16_t startIndex = currentPos - font;
+ subFont = static_cast(ace_malloc(len + 1));
+ if (subFont == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: malloc buffer failed for subFont");
+ return;
+ }
+ errno_t error = strncpy_s(subFont, len + 1, font + startIndex, len);
+ if (error != 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: copy string failed");
+ ace_free(subFont);
+ subFont = nullptr;
+ return;
+ }
+ subFont[len] = '\0';
+ break;
+ }
+ // go forward to next sub font string.
+ if (*(currentPos) == ' ' && *(currentPos + 1) != ' ') {
+ currentIndex = currentIndex + 1;
+ endPos = currentPos + 1;
+ }
+ currentPos++;
+ }
+}
+
+bool CanvasComponent::FormatArcAngle(double sAngle,
+ double eAngle,
+ int16_t &startAngle,
+ int16_t &endAngle,
+ bool counterClockwise) const
+{
+ constexpr int16_t DEGREES_180 = 180;
+ constexpr int16_t DEGREES_360 = 360;
+
+ // calculate start-angle and end-angle degrees
+ if (((DEGREES_180 * sAngle / UI_PI) > INT16_MAX) || ((DEGREES_180 * sAngle / UI_PI) < INT16_MIN) ||
+ ((DEGREES_180 * eAngle / UI_PI) > INT16_MAX) || ((DEGREES_180 * eAngle / UI_PI) < INT16_MIN)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "canvas_component: startAngle or endAngle overflow.");
+ return false;
+ }
+
+ startAngle = DEGREES_180 * sAngle / UI_PI;
+ endAngle = DEGREES_180 * eAngle / UI_PI;
+
+ if (!counterClockwise) {
+ // reset end-angle degrees when (endAngle - startAngle) > 360
+ if ((endAngle - startAngle) > DEGREES_360) {
+ endAngle = startAngle + DEGREES_360;
+ }
+ // reset start-angle or end-angle degrees when startAngle > endAngle
+ if (startAngle <= endAngle) {
+ return true;
+ }
+ while (startAngle >= endAngle) {
+ if ((endAngle + DEGREES_360) > INT16_MAX) {
+ startAngle = startAngle - DEGREES_360;
+ break;
+ }
+ endAngle = endAngle + DEGREES_360;
+ }
+ } else {
+ // reset end-angle degrees when (endAngle - startAngle) > 360
+ if ((startAngle - endAngle) > DEGREES_360) {
+ endAngle = startAngle - DEGREES_360;
+ }
+ // reset start-angle or end-angle degrees when startAngle < endAngle
+ if (startAngle >= endAngle) {
+ return true;
+ }
+ while (startAngle <= endAngle) {
+ if ((endAngle - DEGREES_360) < INT16_MIN) {
+ startAngle = startAngle + DEGREES_360;
+ break;
+ }
+ endAngle = endAngle - DEGREES_360;
+ }
+ }
+
+ return true;
+}
+
+void CanvasComponent::RegisterAttributeFunc(jerry_value_t canvas2dContext,
+ const char *attributeName,
+ jerry_external_handler_t setterHandler,
+ jerry_external_handler_t getterHandler)
+{
+ // register canvas js attribute setter property via the jerry_define_own_property method
+ jerry_value_t propName = jerry_create_string(reinterpret_cast(attributeName));
+ jerry_property_descriptor_t desc;
+ jerry_init_property_descriptor_fields(&desc);
+ desc.is_set_defined = true;
+ desc.setter = jerry_create_external_function(setterHandler);
+ desc.is_get_defined = true;
+ desc.getter = jerry_create_external_function(getterHandler);
+ jerry_value_t returnValue = jerry_define_own_property(canvas2dContext, propName, &desc);
+ jerry_free_property_descriptor_fields(&desc);
+ ReleaseJerryValue(propName, returnValue, VA_ARG_END_FLAG);
+}
+
+void CanvasComponent::RegisterDrawMethodFunc(jerry_value_t canvas2dContext,
+ const char *drawMethodName,
+ jerry_external_handler_t handler)
+{
+ JerrySetFuncProperty(canvas2dContext, drawMethodName, handler);
+}
+} // namespace ACELite
+} // namespace OHOS
+#endif // FEATURE_COMPONENT_CANVAS
diff --git a/src/core/components/canvas_component.h b/frameworks/src/core/components/canvas_component.h
old mode 100755
new mode 100644
similarity index 62%
rename from src/core/components/canvas_component.h
rename to frameworks/src/core/components/canvas_component.h
index 335ee18..46ec159
--- a/src/core/components/canvas_component.h
+++ b/frameworks/src/core/components/canvas_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -25,6 +25,8 @@
namespace OHOS {
namespace ACELite {
+enum ArgsCount : uint8_t { NUM_1 = 1, NUM_2, NUM_3, NUM_4, NUM_5, NUM_6 };
+enum ArgsIndex : uint8_t { IDX_0, IDX_1, IDX_2, IDX_3, IDX_4, IDX_5 };
struct AttrMap {
ACE_DISALLOW_COPY_AND_MOVE(AttrMap);
const char *attrName;
@@ -51,6 +53,11 @@ protected:
private:
void GetSubFont(const char *font, const uint8_t index, char *&subFont) const;
+ bool FormatArcAngle(double sAngle,
+ double eAngle,
+ int16_t &startAngle,
+ int16_t &endAngle,
+ bool counterClockwise) const;
static void RegisterAttributeFunc(jerry_value_t canvas2dContext,
const char *attributeName,
@@ -61,10 +68,10 @@ private:
const char *drawMethodName,
jerry_external_handler_t handler);
- static jerry_value_t CanvasGetContext(const jerry_value_t func,
- const jerry_value_t dom,
- const jerry_value_t args[],
- const jerry_length_t argsNum);
+ static jerry_value_t GetContext(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
static jerry_value_t FillStyleSetter(const jerry_value_t func,
const jerry_value_t dom,
@@ -116,23 +123,58 @@ private:
const jerry_value_t args[],
const jerry_length_t argsNum);
- static jerry_value_t CanvasFillRect(const jerry_value_t func,
- const jerry_value_t dom,
- const jerry_value_t args[],
- const jerry_length_t argsNum);
+ static jerry_value_t FillRect(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
- static jerry_value_t CanvasStrokeRect(const jerry_value_t func,
- const jerry_value_t dom,
- const jerry_value_t args[],
- const jerry_length_t argsNum);
+ static jerry_value_t StrokeRect(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
- static jerry_value_t CanvasFillText(const jerry_value_t func,
- const jerry_value_t context,
- const jerry_value_t args[],
- const jerry_length_t argsNum);
+ static jerry_value_t FillText(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
- UICanvas *canvas_;
- jerry_value_t canvas2dContext_;
+ static jerry_value_t BeginPath(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
+
+ static jerry_value_t MoveTo(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
+
+ static jerry_value_t LineTo(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
+
+ static jerry_value_t Rect(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
+
+ static jerry_value_t Arc(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
+
+ static jerry_value_t ClosePath(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
+
+ static jerry_value_t Stroke(const jerry_value_t func,
+ const jerry_value_t context,
+ const jerry_value_t args[],
+ const jerry_length_t argsNum);
+
+ UICanvas canvas_;
+ jerry_value_t context_;
Paint paint_;
UICanvas::FontStyle fontStyle_;
char *fillStyleValue_;
@@ -142,17 +184,9 @@ private:
int16_t lineWidthValue_;
static const char * const DEFAULT_FILLSTYLE;
static const char * const DEFAULT_STROKESTYLE;
- static const char * const DEFAULT_FONT;
static const char * const DEFAULT_TEXTALIGN;
static const AttrMap attrMap_[];
static const MethodMap methodMap_[];
- static const uint8_t ARGS_COUNT_ONE;
- static const uint8_t ARGS_COUNT_THREE;
- static const uint8_t ARGS_COUNT_FOUR;
- static const uint8_t ARGS_INDEX_0;
- static const uint8_t ARGS_INDEX_1;
- static const uint8_t ARGS_INDEX_2;
- static const uint8_t ARGS_INDEX_3;
static const char * const ATTR_FILLSTYLE;
static const char * const ATTR_STROKESTYLE;
static const char * const ATTR_LINEWIDTH;
@@ -162,6 +196,13 @@ private:
static const char * const FUNC_FILLRECT;
static const char * const FUNC_STROKERECT;
static const char * const FUNC_FILLTEXT;
+ static const char * const FUNC_BEGINPATH;
+ static const char * const FUNC_MOVETO;
+ static const char * const FUNC_LINETO;
+ static const char * const FUNC_RECT;
+ static const char * const FUNC_ARC;
+ static const char * const FUNC_CLOSEPATH;
+ static const char * const FUNC_STROKE;
};
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/chart_component.cpp b/frameworks/src/core/components/chart_component.cpp
similarity index 87%
rename from src/core/components/chart_component.cpp
rename to frameworks/src/core/components/chart_component.cpp
index fa80556..5d1dfcb 100755
--- a/src/core/components/chart_component.cpp
+++ b/frameworks/src/core/components/chart_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -17,10 +17,10 @@
#include "ace_log.h"
#include "ace_mem_base.h"
#include "flex_layout.h"
+#include "font/ui_font_header.h"
#include "keys.h"
#include "ui_chart.h"
#include "ui_circle_progress.h"
-#include "font/ui_font_header.h"
namespace OHOS {
namespace ACELite {
@@ -69,7 +69,9 @@ ChartComponent::ChartComponent(jerry_value_t options, jerry_value_t children, Ap
chartType_(const_cast(LINE)),
headPointStyle_(nullptr),
topPointStyle_(nullptr),
- bottomPointStyle_(nullptr){}
+ bottomPointStyle_(nullptr)
+{
+}
bool ChartComponent::CreateNativeViews()
{
@@ -94,10 +96,7 @@ bool ChartComponent::CreateNativeViews()
HILOG_ERROR(HILOG_MODULE_ACE, "create chart view error");
return false;
}
- if (!Init()) {
- return false;
- }
- return true;
+ return Init();
}
bool ChartComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
@@ -111,7 +110,7 @@ bool ChartComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrV
dataSetsRecord_ = attrValue;
break;
}
- case K_OPATIONS: {
+ case K_OPTIONS: {
SetOptions(attrValue);
break;
}
@@ -122,7 +121,7 @@ bool ChartComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrV
return false;
}
-void ChartComponent::PostUpdate(uint16_t attrKeyId, bool updateResult)
+void ChartComponent::PostUpdate(uint16_t attrKeyId)
{
chartView_->ClearDataSerial();
chartView_->Invalidate();
@@ -201,54 +200,54 @@ void ChartComponent::UpdateStrokeSmoothToSerial(UIChartDataSerial& dataserial)
dataserial.EnableSmooth(seriesOptions_->smooth);
}
+UIChartDataSerial::PointStyle *ChartComponent::UpdatePointStyle(UIChartDataSerial::PointStyle *pointStyle,
+ uint32_t fillColor, uint32_t strokeColor, uint32_t radius, uint32_t strokeWidth)
+{
+ if (pointStyle == nullptr) {
+ pointStyle = new UIChartDataSerial::PointStyle();
+ if (pointStyle == nullptr) {
+ return nullptr;
+ }
+ }
+ pointStyle->fillColor = GetRGBColor(fillColor);
+ pointStyle->strokeColor = GetRGBColor(strokeColor);
+ pointStyle->strokeWidth = 1;
+ pointStyle->radius = radius;
+ pointStyle->strokeWidth = strokeWidth;
+ return pointStyle;
+}
+
bool ChartComponent::UpdatePointToSerial(UIChartDataSerial* dataserial, PointType type)
{
switch (type) {
case PointType::HEAD: {
+ headPointStyle_ = UpdatePointStyle(headPointStyle_, seriesOptions_->head->fillColor,
+ seriesOptions_->head->strokeColor, seriesOptions_->head->size, seriesOptions_->head->strokeWidth);
if (headPointStyle_ == nullptr) {
- headPointStyle_ = new UIChartDataSerial::PointStyle();
- if (headPointStyle_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "malloc headPointStyle heap error");
- return false;
- }
+ HILOG_ERROR(HILOG_MODULE_ACE, "malloc headPointStyle heap error");
+ return false;
}
- headPointStyle_->fillColor = GetRGBColor(seriesOptions_->head->fillColor);
- headPointStyle_->strokeColor = GetRGBColor(seriesOptions_->head->strokeColor);
- headPointStyle_->strokeWidth = 1;
- headPointStyle_->radius = seriesOptions_->head->size;
- headPointStyle_->strokeWidth = seriesOptions_->head->strokeWidth;
dataserial->SetHeadPointStyle(*headPointStyle_);
break;
}
case PointType::TOP: {
+ topPointStyle_ = UpdatePointStyle(topPointStyle_, seriesOptions_->top->fillColor,
+ seriesOptions_->top->strokeColor, seriesOptions_->top->size, seriesOptions_->top->strokeWidth);
if (topPointStyle_ == nullptr) {
- topPointStyle_ = new UIChartDataSerial::PointStyle();
- if (topPointStyle_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "malloc topPointStyle heap error");
- return false;
- }
+ HILOG_ERROR(HILOG_MODULE_ACE, "malloc topPointStyle heap error");
+ return false;
}
- topPointStyle_->fillColor = GetRGBColor(seriesOptions_->top->fillColor);
- topPointStyle_->strokeColor = GetRGBColor(seriesOptions_->top->strokeColor);
- topPointStyle_->strokeWidth = 1;
- topPointStyle_->radius = seriesOptions_->top->size;
- topPointStyle_->strokeWidth = seriesOptions_->top->strokeWidth;
dataserial->SetTopPointStyle(*topPointStyle_);
break;
}
case PointType::BOTTOM: {
+ bottomPointStyle_ = UpdatePointStyle(bottomPointStyle_,
+ seriesOptions_->bottom->fillColor, seriesOptions_->bottom->strokeColor,
+ seriesOptions_->bottom->size, seriesOptions_->bottom->strokeWidth);
if (bottomPointStyle_ == nullptr) {
- bottomPointStyle_ = new UIChartDataSerial::PointStyle();
- if (bottomPointStyle_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "malloc bottomPointStyle heap error");
- return false;
- }
+ HILOG_ERROR(HILOG_MODULE_ACE, "malloc bottomPointStyle heap error");
+ return false;
}
- bottomPointStyle_->fillColor = GetRGBColor(seriesOptions_->bottom->fillColor);
- bottomPointStyle_->strokeColor = GetRGBColor(seriesOptions_->bottom->strokeColor);
- bottomPointStyle_->strokeWidth = 1;
- bottomPointStyle_->radius = seriesOptions_->bottom->size;
- bottomPointStyle_->strokeWidth = seriesOptions_->bottom->strokeWidth;
dataserial->SetBottomPointStyle(*bottomPointStyle_);
break;
}
@@ -262,29 +261,26 @@ bool ChartComponent::UpdatePointToSerial(UIChartDataSerial* dataserial, PointTyp
bool ChartComponent::UpdatePoints(UIChartDataSerial* dataserial)
{
if (seriesOptions_->isTopSet) {
- if (UpdatePointToSerial(dataserial, PointType::TOP)) {
- dataserial->EnableTopPoint(true);
- } else {
+ if (!UpdatePointToSerial(dataserial, PointType::TOP)) {
return false;
}
+ dataserial->EnableTopPoint(true);
} else {
dataserial->EnableTopPoint(false);
}
if (seriesOptions_->isHeadSet) {
- if (UpdatePointToSerial(dataserial, PointType::HEAD)) {
- dataserial->EnableHeadPoint(true);
- } else {
+ if (!UpdatePointToSerial(dataserial, PointType::HEAD)) {
return false;
}
+ dataserial->EnableHeadPoint(true);
} else {
dataserial->EnableHeadPoint(false);
}
if (seriesOptions_->isBottomSet) {
- if (UpdatePointToSerial(dataserial, PointType::BOTTOM)) {
- dataserial->EnableBottomPoint(true);
- } else {
+ if (!UpdatePointToSerial(dataserial, PointType::BOTTOM)) {
return false;
}
+ dataserial->EnableBottomPoint(true);
} else {
dataserial->EnableBottomPoint(false);
}
@@ -318,7 +314,7 @@ bool ChartComponent::UpdateValuesToSerial(jerry_value_t dataSet, UIChartDataSeri
if ((xMaxValue_ >= (UINT16_MAX - 1)) || (dataLen < xMinValue_)) {
HILOG_WARN(HILOG_MODULE_ACE, "customMaxCount or customMinValue is set out of boundary");
}
- uint16_t customMaxCount = xMaxValue_ + 1; // the max data count speciafied by user
+ uint16_t customMaxCount = xMaxValue_ + 1; // the max data count specified by user
uint16_t actualMaxCount = dataLen - xMinValue_; // the actual max data count setted in data array
len = (customMaxCount < actualMaxCount) ? customMaxCount : actualMaxCount;
}
@@ -346,8 +342,7 @@ bool ChartComponent::UpdateValuesToSerial(jerry_value_t dataSet, UIChartDataSeri
}
ReleaseJerryValue(hasDataProp, jData, VA_ARG_END_FLAG);
// need to set after datas setted
- isSetOk = isSetOk ? UpdatePoints(dataserial) : false;
- return isSetOk;
+ return (isSetOk ? UpdatePoints(dataserial) : false);
}
bool ChartComponent::AppendValuesToSerial(jerry_value_t dataSet, UIChartDataSerial* dataserial, uint16_t dataLen)
@@ -475,7 +470,7 @@ jerry_value_t ChartComponent::AppendDatas(const jerry_value_t func,
const jerry_value_t *args,
const jerry_length_t argsNum)
{
- uint8_t functionParamsNum = 1; // js append function just recieve 1 number params
+ uint8_t functionParamsNum = 1; // js append function just receive 1 number params
if (argsNum != functionParamsNum) {
HILOG_ERROR(HILOG_MODULE_ACE, "append function params error");
} else {
@@ -519,7 +514,7 @@ void ChartComponent::UpdateData(jerry_value_t dataSets, jerry_value_t keyName, u
bool isSetOk = false;
for (uint8_t index = 0; index < serialsCount; index++) { // every data set
jerry_value_t dataSet = jerry_get_property_by_index(dataSets, index);
- // check data is set correctlly, if the data is not set correctly, need not to set other attribute left
+ // check data is set correctly, if the data is not set correctly, need not to set other attribute left
jerry_value_t dataValue = jerry_get_property(dataSet, keyName);
if ((!jerry_value_is_undefined(dataValue)) && jerry_value_is_array(dataValue)) {
uint16_t dataLen = jerry_get_array_length(dataValue);
@@ -566,8 +561,7 @@ bool ChartComponent::UpdataDataInOrder(jerry_value_t dataSet, UIChartDataSerial&
UpdateFillColorToSerial(dataSet, dataserial);
UpdateGradientToSerial(dataSet, &dataserial);
UpdateStrokeSmoothToSerial(dataserial);
- bool isSetOk = UpdateValuesToSerial(dataSet, &dataserial, dataLen);
- return isSetOk;
+ return UpdateValuesToSerial(dataSet, &dataserial, dataLen);
}
void ChartComponent::AppendData(jerry_value_t dataSet, DataSerials* dataSerialNode)
@@ -597,7 +591,7 @@ void ChartComponent::UpdateColorToSerial(jerry_value_t dataSet, UIChartDataSeria
isColorSet = true;
}
}
- uint32_t defaultColorVal = 0xFF6384; // pink
+ const uint32_t defaultColorVal = 0xFF6384; // pink
uint32_t colorVal = defaultColorVal;
if (isColorSet) {
colorVal = GetColor(dataSet, const_cast(styleName), defaultColorVal);
@@ -613,12 +607,7 @@ void ChartComponent::UpdateColorToSerial(jerry_value_t dataSet, UIChartDataSeria
bool ChartComponent::SetOptionsAxis(jerry_value_t attrValue, bool isXAxis)
{
bool isSetOk = false;
- jerry_value_t jAxisName;
- if (isXAxis) {
- jAxisName = jerry_create_string(reinterpret_cast(X_AXIS));
- } else {
- jAxisName = jerry_create_string(reinterpret_cast(Y_AXIS));
- }
+ jerry_value_t jAxisName = jerry_create_string(reinterpret_cast(isXAxis ? X_AXIS : Y_AXIS));
jerry_value_t hasXAxisProp = jerry_has_property(attrValue, jAxisName);
if (!jerry_get_boolean_value(hasXAxisProp)) {
HILOG_ERROR(HILOG_MODULE_ACE, "xAxis and yAxis param must set");
@@ -641,12 +630,21 @@ bool ChartComponent::SetOptionsAxis(jerry_value_t attrValue, bool isXAxis)
bool ChartComponent::SetOptionsAxisDataRange(jerry_value_t xAxisValue, bool isXAxis)
{
bool isSetOk = true;
- uint8_t defaultMinValue = 0;
- uint8_t defaultMaxValue = 100;
+ const uint8_t defaultMinValue = 0;
+ const uint8_t defaultMaxValue = 100;
jerry_value_t jMinValue = jerryx_get_property_str(xAxisValue, MIN);
jerry_value_t jMaxValue = jerryx_get_property_str(xAxisValue, MAX);
- uint16_t minValue = (uint16_t)(jerry_get_number_value(jMinValue));
- uint16_t maxValue = (uint16_t)(jerry_get_number_value(jMaxValue));
+ double tempMinVal = jerry_get_number_value(jMinValue);
+ double tempMaxVal = jerry_get_number_value(jMaxValue);
+ uint16_t minValue = defaultMinValue;
+ uint16_t maxValue = defaultMaxValue;
+ if ((tempMinVal >= 0) && (tempMinVal <= UINT16_MAX)) {
+ minValue = static_cast(tempMinVal);
+ }
+ if ((tempMaxVal >= 0) && (tempMaxVal <= UINT16_MAX)) {
+ maxValue = static_cast(tempMaxVal);
+ }
+
if (maxValue == 0) {
if (!jerryx_has_property_str(xAxisValue, "max")) {
HILOG_WARN(HILOG_MODULE_ACE,
@@ -706,12 +704,15 @@ bool ChartComponent::SetOptionsAxisDataRange(uint16_t minValue, uint16_t maxValu
void ChartComponent::SetOptionsAxisTick(jerry_value_t xAxisValue, bool isXAxis)
{
jerry_value_t jAxisTickValue = jerryx_get_property_str(xAxisValue, "axisTick");
- int16_t axisTickValue = (int16_t)(jerry_get_number_value(jAxisTickValue));
+ double tempAxisTickVal = jerry_get_number_value(jAxisTickValue);
+ int16_t axisTickValue;
const int8_t minTickValue = 1;
const int8_t maxTickValue = 20;
- if ((axisTickValue < minTickValue) || (axisTickValue > maxTickValue)) {
+ if ((tempAxisTickVal < minTickValue) || (tempAxisTickVal > maxTickValue)) {
int16_t defaultValue = 10; // default value, means total number of ticks
axisTickValue = defaultValue;
+ } else {
+ axisTickValue = static_cast(tempAxisTickVal);
}
jerry_release_value(jAxisTickValue);
if (isXAxis) {
@@ -725,12 +726,15 @@ bool ChartComponent::SetOptionsAxisDisplay(jerry_value_t xAxisValue, bool isXAxi
{
bool displayValue = false; // default value, means not show axis
jerry_value_t jDisplayValue = jerryx_get_property_str(xAxisValue, DISPLAY);
- displayValue = jerry_get_boolean_value(jDisplayValue);
+ if (!jerry_value_is_undefined(jDisplayValue)) {
+ displayValue = jerry_get_boolean_value(jDisplayValue);
+ }
if (isXAxis) {
xAxis_->SetVisible(displayValue);
} else {
yAxis_->SetVisible(displayValue);
}
+ jerry_release_value(jDisplayValue);
return true;
}
@@ -755,9 +759,7 @@ void ChartComponent::SetOptionsAxisColor(jerry_value_t xAxisValue, bool isXAxis)
void ChartComponent::RecordOptionsSeries(jerry_value_t options)
{
- if (!jerryx_has_property_str(options, SERIES)) {
- return;
- } else {
+ if (jerryx_has_property_str(options, SERIES)) {
jerry_value_t jSeriesVal = jerryx_get_property_str(options, SERIES);
RecordOptionsSeriesLineStyle(jSeriesVal);
RecordOptionsSeriesPoint(jSeriesVal, PointType::HEAD);
@@ -773,20 +775,19 @@ void ChartComponent::RecordOptionsSeriesLineStyle(jerry_value_t jSeriesVal)
char* styleName = const_cast(LINE_STYLE);
if (!jerryx_has_property_str(jSeriesVal, styleName)) {
return;
- } else {
- jerry_value_t jLineStyleVal = jerryx_get_property_str(jSeriesVal, styleName);
- styleName = const_cast(WIDTH);
- uint16_t widthVal = GetSizeVal(jLineStyleVal, styleName, 1);
- chartView_->SetStyle(STYLE_LINE_WIDTH, widthVal); // chart width set can affect all the series
- seriesOptions_->width = widthVal;
- styleName = const_cast(SMOOTH);
- if (jerryx_has_property_str(jLineStyleVal, styleName)) {
- jerry_value_t jSmoothVal = jerryx_get_property_str(jLineStyleVal, styleName);
- seriesOptions_->smooth = jerry_get_boolean_value(jSmoothVal);
- jerry_release_value(jSmoothVal);
- }
- jerry_release_value(jLineStyleVal);
}
+ jerry_value_t jLineStyleVal = jerryx_get_property_str(jSeriesVal, styleName);
+ styleName = const_cast(WIDTH);
+ uint16_t widthVal = GetSizeVal(jLineStyleVal, styleName, 1);
+ chartView_->SetStyle(STYLE_LINE_WIDTH, widthVal); // chart width set can affect all the series
+ seriesOptions_->width = widthVal;
+ styleName = const_cast(SMOOTH);
+ if (jerryx_has_property_str(jLineStyleVal, styleName)) {
+ jerry_value_t jSmoothVal = jerryx_get_property_str(jLineStyleVal, styleName);
+ seriesOptions_->smooth = jerry_get_boolean_value(jSmoothVal);
+ jerry_release_value(jSmoothVal);
+ }
+ jerry_release_value(jLineStyleVal);
}
void ChartComponent::RecordOptionsSeriesPoint(jerry_value_t jSeriesVal, PointType type)
@@ -816,14 +817,14 @@ void ChartComponent::RecordOptionsSeriesPoint(jerry_value_t jSeriesVal, PointTyp
styleName = const_cast(SIZE);
uint8_t defaultValue = 4;
uint8_t size = GetSizeVal(jPointStyleVal, styleName, defaultValue);
- uint32_t defalutColorVal = 0xff0000;
+ uint32_t defaultColorVal = 0xff0000;
styleName = const_cast(STROKE_COLOR);
- uint32_t strokeColor = GetColor(jPointStyleVal, styleName, defalutColorVal);
+ uint32_t strokeColor = GetColor(jPointStyleVal, styleName, defaultColorVal);
defaultValue = 1;
styleName = const_cast(STROKE_WIDTH);
uint8_t strokeWidth = GetSizeVal(jPointStyleVal, styleName, defaultValue);
styleName = const_cast(FILL_COLOR);
- uint32_t fillColor = GetColor(jPointStyleVal, styleName, defalutColorVal);
+ uint32_t fillColor = GetColor(jPointStyleVal, styleName, defaultColorVal);
bool isDisplay = GetDisplayStatus(jPointStyleVal);
jerry_release_value(jPointStyleVal);
@@ -931,17 +932,16 @@ void ChartComponent::ClearDataSerialsNode(DataSerials* serial)
{
if (serial == nullptr) {
return;
- } else {
- if (serial->next) {
- ClearDataSerialsNode(serial->next);
- }
- if (serial->dataSerial) {
- delete (serial->dataSerial);
- serial->dataSerial = nullptr;
- }
- delete (serial);
- serial = nullptr;
}
+ if (serial->next) {
+ ClearDataSerialsNode(serial->next);
+ }
+ if (serial->dataSerial) {
+ delete (serial->dataSerial);
+ serial->dataSerial = nullptr;
+ }
+ delete (serial);
+ serial = nullptr;
}
void ChartComponent::ClearAllDataSerials()
@@ -984,10 +984,9 @@ bool ChartComponent::GetDisplayStatus(jerry_value_t obj)
{
if (!jerryx_has_property_str(obj, DISPLAY)) {
return true;
- } else {
- jerry_value_t jDisplayValue = jerryx_get_property_str(obj, DISPLAY);
- return jerry_get_boolean_value(jDisplayValue);
}
+ jerry_value_t jDisplayValue = jerryx_get_property_str(obj, DISPLAY);
+ return jerry_get_boolean_value(jDisplayValue);
}
bool ChartComponent::Init()
diff --git a/src/core/components/chart_component.h b/frameworks/src/core/components/chart_component.h
similarity index 95%
rename from src/core/components/chart_component.h
rename to frameworks/src/core/components/chart_component.h
index 1713656..5f5a9fc 100755
--- a/src/core/components/chart_component.h
+++ b/frameworks/src/core/components/chart_component.h
@@ -30,7 +30,7 @@ struct DataSerials : public MemoryHeap {
DataSerials() : dataSerial(nullptr), next(nullptr) {}
};
-enum class PointType { HEAD, TOP, BOTTOM };
+enum class PointType : uint8_t { HEAD, TOP, BOTTOM };
struct PointOptions : public MemoryHeap {
uint8_t size;
@@ -65,7 +65,7 @@ public:
~ChartComponent() {}
virtual bool CreateNativeViews() override;
virtual bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
- virtual void PostUpdate(uint16_t attrKeyId, bool updateResult) override;
+ virtual void PostUpdate(uint16_t attrKeyId) override;
virtual void PostRender() override;
virtual void ReleaseNativeViews() override;
@@ -96,6 +96,8 @@ private:
void SetOptionsAxisTick(jerry_value_t options, bool isXAxis);
bool SetOptionsAxisDisplay(jerry_value_t options, bool isXAxis);
void SetOptionsAxisColor(jerry_value_t options, bool isXAxis);
+ UIChartDataSerial::PointStyle *UpdatePointStyle(UIChartDataSerial::PointStyle *pointStyle, uint32_t fillColor,
+ uint32_t strokeColor, uint32_t radius, uint32_t strokeWidth);
/**
* @brief record series options in seriesOptions_
*
diff --git a/frameworks/src/core/components/circle_progress_component.cpp b/frameworks/src/core/components/circle_progress_component.cpp
new file mode 100644
index 0000000..77a27c1
--- /dev/null
+++ b/frameworks/src/core/components/circle_progress_component.cpp
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "circle_progress_component.h"
+
+namespace OHOS {
+namespace ACELite {
+CircleProgressComponent::CircleProgressComponent(jerry_value_t options,
+ jerry_value_t children, AppStyleManager *styleManager)
+ : Component(options, children, styleManager),
+ centerX_(INT16_MAX),
+ centerY_(INT16_MAX),
+ radius_(INT16_MAX),
+ startAngle_(DEFAULT_START_ANGLE),
+ totalAngle_(DEFAULT_TOTAL_ANGLE)
+{
+}
+
+bool CircleProgressComponent::CreateNativeViews()
+{
+ // set default value
+ progressView_.SetBackgroundStyle(StyleDefault::GetBrightStyle());
+ const int8_t defaultLineWidth = 32;
+ progressView_.SetBackgroundStyle(STYLE_LINE_WIDTH, defaultLineWidth); // Compatible with rich devices
+ progressView_.SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND);
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ const char * const defaultBackgroundColor = "rgba(255,255,255,0.15)";
+ if (ParseColor(defaultBackgroundColor, color, alpha)) {
+ progressView_.SetBackgroundStyle(STYLE_LINE_COLOR, GetRGBColor(color).full);
+ }
+ progressView_.SetForegroundStyle(StyleDefault::GetBrightColorStyle());
+ progressView_.SetForegroundStyle(STYLE_BACKGROUND_OPA, 0);
+ progressView_.SetForegroundStyle(STYLE_BORDER_OPA, 0);
+ progressView_.SetForegroundStyle(STYLE_LINE_WIDTH, defaultLineWidth);
+ progressView_.SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND);
+ const char * const defaultColor = "#5EA1FF";
+ if (ParseColor(defaultColor, color, alpha)) {
+ progressView_.SetForegroundStyle(STYLE_LINE_COLOR, GetRGBColor(color).full);
+ progressView_.SetForegroundStyle(STYLE_LINE_OPA, OPA_OPAQUE);
+ }
+ return true;
+}
+
+bool CircleProgressComponent::ApplyPrivateStyle(const AppStyleItem *style)
+{
+ return SetArcProgressStyle(style);
+}
+
+UIView *CircleProgressComponent::GetComponentRootView() const
+{
+ return const_cast(&progressView_);
+}
+
+bool CircleProgressComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
+{
+ switch (attrKeyId) {
+ case K_PERCENT: {
+ // set the specific attribute of this progress view
+ int16_t rangeMax = 100;
+ int16_t rangeMin = 0;
+ progressView_.SetRange(rangeMax, rangeMin);
+ progressView_.SetValue(IntegerOf(attrValue));
+ return true;
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+void CircleProgressComponent::SetAngles()
+{
+ if (centerX_ == INT16_MAX) {
+ centerX_ = static_cast(progressView_.GetWidth()) >> 1;
+ }
+ if (centerY_ == INT16_MAX) {
+ centerY_ = static_cast(progressView_.GetHeight()) >> 1;
+ }
+ if (radius_ == INT16_MAX) {
+ if (progressView_.GetWidth() <= progressView_.GetHeight()) {
+ radius_ = static_cast(progressView_.GetWidth()) >> 1;
+ } else {
+ radius_ = static_cast(progressView_.GetHeight()) >> 1;
+ }
+ }
+
+ progressView_.SetCenterPosition(centerX_, centerY_);
+ progressView_.SetRadius(radius_);
+ progressView_.SetStartAngle(startAngle_);
+ progressView_.SetEndAngle(startAngle_ + totalAngle_);
+}
+
+void CircleProgressComponent::SetStartAngle(const AppStyleItem *style)
+{
+ const int16_t minStartAngle = 0;
+ const int16_t maxStartAngle = 360;
+ startAngle_ = GetStyleDegValue(style); // Compatible with rich devices, value should between -180 and 0
+ if (startAngle_ > maxStartAngle) {
+ startAngle_ = maxStartAngle;
+ } else if (startAngle_ < minStartAngle) {
+ startAngle_ = minStartAngle;
+ }
+}
+
+void CircleProgressComponent::SetTotalAngle(const AppStyleItem *style)
+{
+ const int16_t minStartAngle = -360;
+ const int16_t maxStartAngle = 360;
+ totalAngle_ = GetStyleDegValue(style); // Compatible with rich devices, value should between 0 and 180
+ if (totalAngle_ < minStartAngle) {
+ totalAngle_ = minStartAngle;
+ } else if (totalAngle_ > maxStartAngle) {
+ totalAngle_ = maxStartAngle;
+ }
+}
+
+bool CircleProgressComponent::SetArcColor(const AppStyleItem *style)
+{
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ if (!GetStyleColorValue(style, color, alpha)) {
+ return false;
+ }
+ progressView_.SetForegroundStyle(STYLE_LINE_COLOR, GetRGBColor(color).full);
+ progressView_.SetForegroundStyle(STYLE_LINE_OPA, alpha);
+ return true;
+}
+
+bool CircleProgressComponent::SetArcBackgroundColor(const AppStyleItem *style)
+{
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ if (!GetStyleColorValue(style, color, alpha)) {
+ return false;
+ }
+ progressView_.SetBackgroundStyle(STYLE_LINE_COLOR, GetRGBColor(color).full);
+ progressView_.SetBackgroundStyle(STYLE_LINE_OPA, alpha);
+ return true;
+}
+
+bool CircleProgressComponent::SetArcProgressStyle(const AppStyleItem *style)
+{
+ uint16_t stylePropNameId = GetStylePropNameId(style);
+ switch (stylePropNameId) {
+ case K_CENTER_X: {
+ centerX_ = GetStylePixelValue(style);
+ return true;
+ }
+ case K_CENTER_Y: {
+ centerY_ = GetStylePixelValue(style);
+ return true;
+ }
+ case K_RADIUS: {
+ radius_ = GetStylePixelValue(style);
+ return true;
+ }
+ case K_START_ANGLE: {
+ SetStartAngle(style);
+ return true;
+ }
+ case K_TOTAL_ANGLE: {
+ SetTotalAngle(style);
+ return true;
+ }
+ case K_COLOR: {
+ return SetArcColor(style);
+ }
+ case K_STROKE_WIDTH: {
+ progressView_.SetBackgroundStyle(STYLE_LINE_WIDTH, GetStylePixelValue(style));
+ progressView_.SetForegroundStyle(STYLE_LINE_WIDTH, GetStylePixelValue(style));
+ return true;
+ }
+ case K_BACKGROUND_COLOR: {
+ return SetArcBackgroundColor(style);
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+void CircleProgressComponent::OnViewAttached()
+{
+ HandleExtraUpdate();
+}
+
+void CircleProgressComponent::PostUpdate(uint16_t attrKeyId)
+{
+ UNUSED(attrKeyId);
+ HandleExtraUpdate();
+}
+
+void CircleProgressComponent::HandleExtraUpdate()
+{
+ SetAngles();
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/src/core/components/progress_component.h b/frameworks/src/core/components/circle_progress_component.h
old mode 100755
new mode 100644
similarity index 56%
rename from src/core/components/progress_component.h
rename to frameworks/src/core/components/circle_progress_component.h
index 4609e0e..6f660f6
--- a/src/core/components/progress_component.h
+++ b/frameworks/src/core/components/circle_progress_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -13,48 +13,44 @@
* limitations under the License.
*/
-#ifndef OHOS_ACELITE_PROGRESS_COMPONENT_H
-#define OHOS_ACELITE_PROGRESS_COMPONENT_H
+#ifndef OHOS_ACELITE_CIRCLE_PROGRESS_COMPONENT_H
+#define OHOS_ACELITE_CIRCLE_PROGRESS_COMPONENT_H
+
#include "component.h"
#include "non_copyable.h"
-#include "ui_abstract_progress.h"
+#include "ui_circle_progress.h"
namespace OHOS {
namespace ACELite {
-enum ProgressType { ARC = 0x01, HORIZONTAL = 0x02 };
-
constexpr int16_t DEFAULT_START_ANGLE = 240;
constexpr int16_t DEFAULT_TOTAL_ANGLE = 240;
constexpr int16_t DEFAULT_STROKE_WIDTH = 32;
-class ProgressComponent final : public Component {
+class CircleProgressComponent final : public Component {
public:
- ACE_DISALLOW_COPY_AND_MOVE(ProgressComponent);
- ProgressComponent() = delete;
- ProgressComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager);
- ~ProgressComponent() override {}
+ ACE_DISALLOW_COPY_AND_MOVE(CircleProgressComponent);
+ CircleProgressComponent() = delete;
+ CircleProgressComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager);
+ ~CircleProgressComponent() override {}
protected:
- bool CreateNativeViews() override;
- void ReleaseNativeViews() override;
UIView *GetComponentRootView() const override;
bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
bool ApplyPrivateStyle(const AppStyleItem* style) override;
- void PostRender() override;
- void PostUpdate(uint16_t attrKeyId, bool updateResult) override;
+ void PostUpdate(uint16_t attrKeyId) override;
+ void OnViewAttached() override;
+ void HandleExtraUpdate();
+ bool CreateNativeViews() override;
private:
- ProgressType GetType() const;
- char* GetStringAttrByName(const char * const name, uint16_t* len) const;
void SetAngles();
- void HorizonProgressPostDeal() const;
bool SetArcProgressStyle(const AppStyleItem* style);
- bool SetHorizonProgressStyle(const AppStyleItem* style);
- jerry_value_t options_;
- UIAbstractProgress* progressView_;
- ProgressType type_;
- int16_t hStrokeWidth_;
+ void SetStartAngle(const AppStyleItem *style);
+ void SetTotalAngle(const AppStyleItem *style);
+ bool SetArcColor(const AppStyleItem *style);
+ bool SetArcBackgroundColor(const AppStyleItem *style);
+ UICircleProgress progressView_;
int16_t centerX_;
int16_t centerY_;
int16_t radius_;
@@ -64,4 +60,4 @@ private:
} // namespace ACELite
} // namespace OHOS
-#endif // OHOS_ACELITE_PROGRESS_COMPONENT_H
+#endif // OHOS_ACELITE_CIRCLE_PROGRESS_COMPONENT_H
diff --git a/src/core/components/clock_hand_component.cpp b/frameworks/src/core/components/clock_hand_component.cpp
old mode 100755
new mode 100644
similarity index 99%
rename from src/core/components/clock_hand_component.cpp
rename to frameworks/src/core/components/clock_hand_component.cpp
index c2cc253..c0af38f
--- a/src/core/components/clock_hand_component.cpp
+++ b/frameworks/src/core/components/clock_hand_component.cpp
@@ -100,6 +100,7 @@ void ClockHandComponent::PostRender()
jerry_value_t nativeObj = GetNativeElement();
if (jerry_value_is_undefined(nativeObj)) {
+ ReleaseJerryValue(pivotXValue, pivotYValue, typeIdValue, VA_ARG_END_FLAG);
return;
}
SetNamedProperty(nativeObj, stylePivotX, pivotXValue);
diff --git a/src/core/components/clock_hand_component.h b/frameworks/src/core/components/clock_hand_component.h
old mode 100755
new mode 100644
similarity index 98%
rename from src/core/components/clock_hand_component.h
rename to frameworks/src/core/components/clock_hand_component.h
index 2af26c3..ef784a2
--- a/src/core/components/clock_hand_component.h
+++ b/frameworks/src/core/components/clock_hand_component.h
@@ -46,7 +46,7 @@ protected:
*
* @brief Values that represent different clock-hand layout types
*/
- enum class LayoutType {
+ enum class LayoutType : uint8_t {
// UIImageView layout
IMAGE,
// Rectangle layout
diff --git a/src/core/components/component.cpp b/frameworks/src/core/components/component.cpp
similarity index 66%
rename from src/core/components/component.cpp
rename to frameworks/src/core/components/component.cpp
index c81b189..e0df537 100755
--- a/src/core/components/component.cpp
+++ b/frameworks/src/core/components/component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -25,13 +25,12 @@
#include "js_router.h"
#include "key_parser.h"
#include "keys.h"
+#include "lazy_load_manager.h"
+#include "securec.h"
#include "stylemgr/app_style.h"
#include "stylemgr/app_style_manager.h"
#include "time_util.h"
#include "wrapper/js.h"
-#if ENABLED(SECURE_C_FUNCTION)
-#include "securec.h"
-#endif // ENABLED(SECURE_C_FUNCTION)
namespace OHOS {
namespace ACELite {
@@ -40,7 +39,7 @@ static bool g_isAnimatorStarted = false;
void Component::HandlerAnimations()
{
Component::AnimationsNode *point = g_animationListHead;
- while (point != nullptr) {
+ while (point != nullptr && point->transitionImpl != nullptr) {
point->transitionImpl->Start();
point = point->next;
}
@@ -54,6 +53,7 @@ void Component::ReleaseAnimations()
Component::AnimationsNode *temp = point->next;
if (point->transitionImpl) {
delete (point->transitionImpl);
+ point->transitionImpl = nullptr;
}
delete (point);
point = temp;
@@ -63,7 +63,10 @@ void Component::ReleaseAnimations()
}
Component::Component(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager)
- : styleManager_(styleManager),
+ : childHead_(nullptr),
+ nextSibling_(nullptr),
+ parent_(nullptr),
+ styleManager_(styleManager),
options_(options),
children_(UNDEFINED),
onClickListener_(nullptr),
@@ -84,21 +87,20 @@ Component::Component(jerry_value_t options, jerry_value_t children, AppStyleMana
trans_(nullptr),
descriptors_(jerry_acquire_value(children)),
watchersHead_(nullptr),
- height_(-1),
- width_(-1)
+ height_(-1, DimensionType::TYPE_UNKNOWN),
+ width_(-1, DimensionType::TYPE_UNKNOWN),
+ top_(-1, DimensionType::TYPE_UNKNOWN),
+ left_(-1, DimensionType::TYPE_UNKNOWN),
+ marginTop_(-1, DimensionType::TYPE_UNKNOWN),
+ marginLeft_(-1, DimensionType::TYPE_UNKNOWN),
+ marginRight_(-1, DimensionType::TYPE_UNKNOWN),
+ marginBottom_(-1, DimensionType::TYPE_UNKNOWN)
{
// create native element object before combining styles, as style data binding need it
nativeElement_ = jerry_create_object();
jerry_value_t global = jerry_get_global_object();
viewModel_ = jerryx_get_property_str(global, ATTR_ROOT);
jerry_release_value(global);
- if (styleManager_) {
- // combine app style for this component by app style list.
- // style apply priority: inline(static style) > #id > .class
- START_TRACING_WITH_COMPONENT_NAME(RENDER_COMBINE_STYLE, componentName_);
- styleManager_->CombineStylesForCurrentTag(options_, *this);
- STOP_TRACING();
- }
}
/**
@@ -120,15 +122,16 @@ bool Component::Render()
}
PreRender();
- bool renderResult = false;
// step1: create native view/views
START_TRACING_WITH_COMPONENT_NAME(RENDER_CREATE_COMPONENT, componentName_);
- renderResult = CreateNativeViews();
+ bool renderResult = CreateNativeViews();
if (!renderResult) {
return false;
}
STOP_TRACING();
+ SetViewExtraMsg();
+
// step2: binding js object with this component
jerry_set_object_native_pointer(nativeElement_, this, nullptr);
@@ -136,7 +139,7 @@ bool Component::Render()
ParseOptions();
// step4: apply styles
START_TRACING_WITH_COMPONENT_NAME(RENDER_APPLY_STYLE, componentName_);
- ApplyStyles();
+ ApplyStyles(options_, *this);
STOP_TRACING();
// step5:process this component's children
@@ -145,23 +148,55 @@ bool Component::Render()
STOP_TRACING();
if (!renderResult) {
return false;
- } else {
- RecordAnimation();
}
+ RecordAnimation();
PostRender();
rendered_ = true;
return renderResult;
}
+void Component::SetViewExtraMsg()
+{
+ UIView *view = GetComponentRootView();
+ if (view == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "failed to set the extra message for view.");
+ return;
+ }
+ UIView::ViewExtraMsg *extraMsg = new UIView::ViewExtraMsg();
+ if (extraMsg == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Failed to mapping native view with DOM element.");
+ return;
+ }
+ extraMsg->elementPtr = (void *)&nativeElement_;
+ view->SetExtraMsg(extraMsg);
+}
+
+void Component::ReleaseViewExtraMsg()
+{
+ UIView *view = GetComponentRootView();
+ if (view == nullptr) {
+ return;
+ }
+ UIView::ViewExtraMsg *extraMsg = view->GetExtraMsg();
+ ACE_DELETE(extraMsg);
+ view->SetExtraMsg(nullptr);
+}
+
void Component::Release()
{
// detach self from fatal handler monitoring
FatalHandler::GetInstance().DetachComponentNode(this);
+ if (parent_ != nullptr) {
+ parent_->RemoveChild(this);
+ }
+
// stop view animation
if (curTransitionImpl_) {
curTransitionImpl_->Stop();
}
+ ReleaseViewExtraMsg();
+ jerry_delete_object_native_pointer(nativeElement_, nullptr);
// release all native views
ReleaseNativeViews();
// release transition param
@@ -200,11 +235,17 @@ bool Component::UpdateView(uint16_t attrKeyId, jerry_value_t attrValue)
}
}
- RefreshRect();
+ if (parent_ != nullptr) {
+ ConstrainedParameter parentParam;
+ parent_->GetConstrainedParam(parentParam);
+ AlignDimensions(parentParam);
+ }
+ AdaptBoxSizing();
// force parent to relayout the children in case component's area is changed
InvalidateIfNeeded(attrKeyId, false);
-
- PostUpdate(attrKeyId, updateResult);
+ if (updateResult) {
+ PostUpdate(attrKeyId);
+ }
StartAnimation();
STOP_TRACING();
@@ -240,6 +281,7 @@ bool Component::SetCommonAttribute(UIView &view, const uint16_t attrKeyId, const
ACE_FREE(viewId_);
viewId_ = MallocStringOf(attrValue);
if (viewId_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "failed to set `id` attribute.");
return false;
}
view.SetViewId(viewId_);
@@ -253,7 +295,8 @@ bool Component::SetCommonAttribute(UIView &view, const uint16_t attrKeyId, const
uint16_t length = 0;
char *refName = MallocStringOf(attrValue, &length);
if (refName == nullptr) {
- break;
+ HILOG_ERROR(HILOG_MODULE_ACE, "failed to set `ref` attribute.");
+ return false;
}
if (length != 0) {
jerry_value_t refs = jerryx_get_property_str(viewModel_, ATTR_REFS);
@@ -278,66 +321,174 @@ bool Component::SetCommonAttribute(UIView &view, const uint16_t attrKeyId, const
return true;
}
-void Component::ApplyStyles()
+void Component::ApplyStyles(const jerry_value_t options, Component &curr) const
{
- const AppStyle *combinedStyle = GetStyleManager()->GetCombinedStyle();
- if (combinedStyle != nullptr) {
- const AppStyleItem *style = combinedStyle->GetFirst();
- while (style != nullptr) {
- START_TRACING_WITH_EXTRA_INFO(APPLY_STYLE_ITEM, componentName_, GetStylePropNameId(style));
- // call children's apply method
- ApplyStyle(style);
- STOP_TRACING();
- style = style->GetNext();
- }
+ if (jerry_value_is_undefined(options)) {
+ return;
}
- RefreshRect();
+ styleManager_->ApplyComponentStyles(options, curr);
}
-bool Component::RefreshRect() const
+void Component::GetDimensionFromStyle(Dimension &dimension, const AppStyleItem &styleItem) const
+{
+ if (styleItem.GetValueType() == STYLE_PROP_VALUE_TYPE_PERCENT) {
+ // percent format
+ dimension.value.percentage = styleItem.GetPercentValue();
+ dimension.type = DimensionType::TYPE_PERCENT;
+ return;
+ }
+ // number or string format
+ // use INT32_MIN as the impossible default value
+ int32_t pixelValue = GetStylePixelValue(&styleItem, INT32_MIN);
+ if (pixelValue == INT32_MIN) {
+ // get pixel failed, reset to unknown type
+ dimension.type = DimensionType::TYPE_UNKNOWN;
+ return;
+ }
+ dimension.value.pixel = (int16_t)(pixelValue);
+ dimension.type = DimensionType::TYPE_PIXEL;
+}
+
+void Component::CalculateDimensionPixel(Dimension &dimension, int16_t base) const
+{
+ const uint8_t hundred = 100;
+ if (dimension.type == DimensionType::TYPE_PERCENT) {
+ dimension.value.pixel = (int16_t)((dimension.value.percentage * base) / hundred);
+ dimension.type = DimensionType::TYPE_PIXEL;
+ }
+}
+
+const Dimension &Component::GetDimension(uint16_t keyNameId) const
+{
+ const static Dimension unknownDimension = {0, DimensionType::TYPE_UNKNOWN};
+ switch (keyNameId) {
+ case K_WIDTH:
+ return width_;
+ case K_HEIGHT:
+ return height_;
+ case K_TOP:
+ return top_;
+ case K_LEFT:
+ return left_;
+ case K_MARGIN_TOP:
+ return marginTop_;
+ case K_MARGIN_BOTTOM:
+ return marginBottom_;
+ case K_MARGIN_RIGHT:
+ return marginRight_;
+ case K_MARGIN_LEFT:
+ return marginLeft_;
+ default: {
+ return unknownDimension;
+ }
+ }
+}
+
+void Component::AlignDimensions(const ConstrainedParameter ¶m)
+{
+ // width
+ CalculateDimensionPixel(width_, param.maxWidth);
+ CalculateDimensionPixel(height_, param.maxHeight);
+ // top & left
+ CalculateDimensionPixel(top_, param.maxHeight);
+ CalculateDimensionPixel(left_, param.maxWidth);
+ // margin
+ CalculateDimensionPixel(marginTop_, param.maxHeight);
+ CalculateDimensionPixel(marginLeft_, param.maxHeight);
+ CalculateDimensionPixel(marginRight_, param.maxHeight);
+ CalculateDimensionPixel(marginBottom_, param.maxHeight);
+ // notify
+ OnDimensionsAligned();
+}
+
+void Component::GetConstrainedParam(ConstrainedParameter ¶m) const
+{
+ param.maxWidth = width_.value.pixel;
+ param.maxHeight = height_.value.pixel;
+}
+
+void Component::ApplyAlignedMargin(UIView &uiView) const
+{
+ if (marginTop_.type == DimensionType::TYPE_PIXEL) {
+ uiView.SetStyle(STYLE_MARGIN_TOP, marginTop_.value.pixel);
+ }
+ if (marginBottom_.type == DimensionType::TYPE_PIXEL) {
+ uiView.SetStyle(STYLE_MARGIN_BOTTOM, marginBottom_.value.pixel);
+ }
+ if (marginLeft_.type == DimensionType::TYPE_PIXEL) {
+ uiView.SetStyle(STYLE_MARGIN_LEFT, marginLeft_.value.pixel);
+ }
+ if (marginRight_.type == DimensionType::TYPE_PIXEL) {
+ uiView.SetStyle(STYLE_MARGIN_RIGHT, marginRight_.value.pixel);
+ }
+}
+
+void Component::ApplyAlignedPosition(UIView &uiView) const
+{
+ if (top_.type == DimensionType::TYPE_PIXEL) {
+ uiView.SetY(top_.value.pixel);
+ }
+ if (left_.type == DimensionType::TYPE_PIXEL) {
+ uiView.SetX(left_.value.pixel);
+ }
+}
+
+void Component::AdapteBoxRectArea(UIView &uiView) const
+{
+ // set view height and width
+ uint8_t borderNum = 2;
+ int16_t height = (height_.type == DimensionType::TYPE_PIXEL) ? height_.value.pixel : -1;
+ int16_t width = (width_.type == DimensionType::TYPE_PIXEL) ? width_.value.pixel : -1;
+ if (height >= 0) {
+ // as uiView->GetStyle(STYLE_PADDING_TOP) and uiView->GetStyle(STYLE_PADDING_BOTTOM) is defined
+ // as uint16_t, so do not need to judge whether less than 0
+ if (uiView.GetStyle(STYLE_BORDER_WIDTH) < 0) {
+ HILOG_WARN(HILOG_MODULE_ACE, "border and padding size should not less than 0");
+ }
+ int16_t contentHeight = height - (uiView.GetStyle(STYLE_BORDER_WIDTH) * borderNum) -
+ uiView.GetStyle(STYLE_PADDING_TOP) - uiView.GetStyle(STYLE_PADDING_BOTTOM);
+ if (contentHeight <= 0) {
+ HILOG_WARN(HILOG_MODULE_ACE,
+ "component height can not include padding and border width, padding and border will be set 0");
+ uiView.SetStyle(STYLE_BORDER_WIDTH, 0);
+ uiView.SetStyle(STYLE_PADDING_TOP, 0);
+ uiView.SetStyle(STYLE_PADDING_BOTTOM, 0);
+ uiView.SetHeight(height);
+ } else {
+ uiView.SetHeight(contentHeight);
+ }
+ }
+ if (width >= 0) {
+ if (uiView.GetStyle(STYLE_BORDER_WIDTH) < 0) {
+ HILOG_WARN(HILOG_MODULE_ACE, "border and padding size should not less than 0");
+ }
+ int16_t contentWidth = width - (uiView.GetStyle(STYLE_BORDER_WIDTH) * borderNum) -
+ uiView.GetStyle(STYLE_PADDING_LEFT) - uiView.GetStyle(STYLE_PADDING_RIGHT);
+ if (contentWidth <= 0) {
+ HILOG_WARN(HILOG_MODULE_ACE,
+ "component width can not include padding and border width, padding and border will be set 0");
+ uiView.SetStyle(STYLE_BORDER_WIDTH, 0);
+ uiView.SetStyle(STYLE_PADDING_LEFT, 0);
+ uiView.SetStyle(STYLE_PADDING_RIGHT, 0);
+ uiView.SetWidth(width);
+ } else {
+ uiView.SetWidth(contentWidth);
+ }
+ }
+}
+
+bool Component::AdaptBoxSizing() const
{
UIView *uiView = GetComponentRootView();
if (uiView == nullptr) {
return false;
}
- // set view height and width
- uint8_t borderNum = 2;
- if (height_ >= 0) {
- // as uiView->GetStyle(STYLE_PADDING_TOP) and uiView->GetStyle(STYLE_PADDING_BOTTOM) is defined
- // as uint16_t, so do not need to judge whether less than 0
- if (uiView->GetStyle(STYLE_BORDER_WIDTH) < 0) {
- HILOG_WARN(HILOG_MODULE_ACE, "border and padding size should not less than 0");
- }
- int16_t contentHeight = height_ - (uiView->GetStyle(STYLE_BORDER_WIDTH) * borderNum) -
- uiView->GetStyle(STYLE_PADDING_TOP) - uiView->GetStyle(STYLE_PADDING_BOTTOM);
- if (contentHeight <= 0) {
- HILOG_WARN(HILOG_MODULE_ACE,
- "component height can not include padding and border width, padding and border will be set 0");
- uiView->SetStyle(STYLE_BORDER_WIDTH, 0);
- uiView->SetStyle(STYLE_PADDING_TOP, 0);
- uiView->SetStyle(STYLE_PADDING_BOTTOM, 0);
- uiView->SetHeight(height_);
- } else {
- uiView->SetHeight(contentHeight);
- }
- }
- if (width_ >= 0) {
- if (uiView->GetStyle(STYLE_BORDER_WIDTH) < 0) {
- HILOG_WARN(HILOG_MODULE_ACE, "border and padding size should not less than 0");
- }
- int16_t contentWidth = width_ - (uiView->GetStyle(STYLE_BORDER_WIDTH) * borderNum) -
- uiView->GetStyle(STYLE_PADDING_LEFT) - uiView->GetStyle(STYLE_PADDING_RIGHT);
- if (contentWidth <= 0) {
- HILOG_WARN(HILOG_MODULE_ACE,
- "component width can not include padding and border width, padding and border will be set 0");
- uiView->SetStyle(STYLE_BORDER_WIDTH, 0);
- uiView->SetStyle(STYLE_PADDING_LEFT, 0);
- uiView->SetStyle(STYLE_PADDING_RIGHT, 0);
- uiView->SetWidth(width_);
- } else {
- uiView->SetWidth(contentWidth);
- }
- }
+ // apply aligned top and left
+ ApplyAlignedPosition(*uiView);
+ // apply aligned magin
+ ApplyAlignedMargin(*uiView);
+ // adjust the box sizing
+ AdapteBoxRectArea(*uiView);
return true;
}
@@ -354,8 +505,7 @@ bool Component::ApplyStyle(const AppStyleItem *style)
// one private style get matched, no need to try private style ones
return true;
}
- applyResult = ApplyCommonStyle(*uiView, style);
- return applyResult;
+ return ApplyCommonStyle(*uiView, style);
}
/*
@@ -393,11 +543,11 @@ bool Component::ApplyCommonStyle(UIView &view, const AppStyleItem *style)
switch (styleNameId) {
case K_HEIGHT: {
- SetHeight(style);
+ GetDimensionFromStyle(height_, *style);
break;
}
case K_WIDTH: {
- SetWidth(style);
+ GetDimensionFromStyle(width_, *style);
break;
}
case K_DISPLAY: {
@@ -405,23 +555,26 @@ bool Component::ApplyCommonStyle(UIView &view, const AppStyleItem *style)
break;
}
case K_MARGIN: {
- SetMargin(view, *style);
+ GetDimensionFromStyle(marginBottom_, *style);
+ GetDimensionFromStyle(marginLeft_, *style);
+ GetDimensionFromStyle(marginRight_, *style);
+ GetDimensionFromStyle(marginTop_, *style);
break;
}
case K_MARGIN_BOTTOM: {
- SetBottomMargin(view, *style);
+ GetDimensionFromStyle(marginBottom_, *style);
break;
}
case K_MARGIN_LEFT: {
- SetLeftMargin(view, *style);
+ GetDimensionFromStyle(marginLeft_, *style);
break;
}
case K_MARGIN_RIGHT: {
- SetRightMargin(view, *style);
+ GetDimensionFromStyle(marginRight_, *style);
break;
}
case K_MARGIN_TOP: {
- SetTopMargin(view, *style);
+ GetDimensionFromStyle(marginTop_, *style);
break;
}
case K_PADDING:
@@ -465,11 +618,11 @@ bool Component::ApplyCommonStyle(UIView &view, const AppStyleItem *style)
break;
}
case K_LEFT: {
- SetLeft(view, style);
+ GetDimensionFromStyle(left_, *style);
break;
}
case K_TOP: {
- SetTop(view, style);
+ GetDimensionFromStyle(top_, *style);
break;
}
case K_ANIMATION_DURATION: {
@@ -496,6 +649,10 @@ bool Component::ApplyCommonStyle(UIView &view, const AppStyleItem *style)
SetAnimationKeyFrames(view, style);
break;
}
+ case K_OPACITY: {
+ SetOpacity(view, *style);
+ break;
+ }
default: {
return false;
}
@@ -524,29 +681,18 @@ void Component::ParseOptions()
return;
}
- jerry_value_t attrsPropValue = jerryx_get_property_str(options_, ATTR_ATTRS);
- const char * const attrEvent = "on";
- jerry_value_t eventPropValue = jerryx_get_property_str(options_, attrEvent);
-
- if (!jerry_value_is_undefined(attrsPropValue)) {
- START_TRACING(RENDER_PARSE_ATTR);
- ParseAttrs(attrsPropValue);
- STOP_TRACING();
- }
-
- if (!jerry_value_is_undefined(eventPropValue)) {
- START_TRACING(RENDER_PARSE_EVENT);
- ParseEvent(eventPropValue);
- STOP_TRACING();
- }
- ReleaseJerryValue(eventPropValue, attrsPropValue, VA_ARG_END_FLAG);
+ START_TRACING(RENDER_PARSE_ATTR);
+ ParseAttrs();
+ STOP_TRACING();
+ START_TRACING(RENDER_PARSE_EVENT);
+ ParseEvents();
+ STOP_TRACING();
}
void Component::SetAnimationKeyFrames(const UIView &view, const AppStyleItem *styleItem)
{
if (trans_ == nullptr) {
trans_ = new TransitionParams();
-
if (trans_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "create TransitionParams object error");
return;
@@ -594,7 +740,7 @@ void Component::SetAnimationKeyFrames(const AppStyleItem *item)
return;
}
size_t valLength = strlen(itemValue);
- if ((valLength <= 0) || (valLength >= UINT8_MAX)) {
+ if ((valLength == 0) || (valLength >= UINT8_MAX)) {
item = item->GetNext();
continue;
}
@@ -784,7 +930,7 @@ void Component::RecordAnimation()
AddAnimationToList(curTransitionImpl_);
isAnimationKeyFramesSet_ = false;
// special for "if" situation, if g_isAnimatorStarted is started means the page has started all the
- // animators, and the current component is created by "if" situation, so the animator can start immediattly
+ // animators, and the current component is created by "if" situation, so the animator can start immediately
if (g_isAnimatorStarted) {
curTransitionImpl_->Start();
}
@@ -851,8 +997,7 @@ int32_t Component::GetAnimatorValue(char *animatorValue, const int8_t index, boo
return 0;
}
- long convertedValue = isOpacity ? (long)((strtod(value, nullptr) * ALPHA_MAX)) :
- strtol(value, nullptr, DEC);
+ long convertedValue = isOpacity ? (long)((strtod(value, nullptr) * ALPHA_MAX)) : strtol(value, nullptr, DEC);
if (TransitionImpl::IsEndWith(value, "rad")) {
uint8_t degConversionRate = 57;
convertedValue = convertedValue * degConversionRate;
@@ -860,12 +1005,11 @@ int32_t Component::GetAnimatorValue(char *animatorValue, const int8_t index, boo
return convertedValue;
}
-/**
- * check if the pass-in attrValue is an Expression, if it is, calculate it and bind watcher instance.
- * if it's not, just return the passed-in attrValue itself.
- */
-jerry_value_t Component::ParseExpression(jerry_value_t attrKey, jerry_value_t attrValue)
+jerry_value_t Component::AddWatcherItem(const jerry_value_t attrKey, const jerry_value_t attrValue, bool isLazyLoading)
{
+#ifdef FEATURE_LAZY_LOADING_MODULE
+ isLazyLoading = true;
+#endif
jerry_value_t options = jerry_create_object();
JerrySetNamedProperty(options, ARG_WATCH_EL, nativeElement_);
JerrySetNamedProperty(options, ARG_WATCH_ATTR, attrKey);
@@ -875,17 +1019,25 @@ jerry_value_t Component::ParseExpression(jerry_value_t attrKey, jerry_value_t at
HILOG_ERROR(HILOG_MODULE_ACE, "Failed to create Watcher instance.");
} else {
InsertWatcherCommon(watchersHead_, watcher);
- propValue = jerryx_get_property_str(watcher, "_lastValue");
+ if (!isLazyLoading) {
+ propValue = jerryx_get_property_str(watcher, "_lastValue");
+ }
}
jerry_release_value(options);
return propValue;
}
-void Component::ParseAttrs(jerry_value_t attrs)
+void Component::ParseAttrs()
{
+ jerry_value_t attrs = jerryx_get_property_str(options_, ATTR_ATTRS);
+ if (jerry_value_is_undefined(attrs)) {
+ return;
+ }
+
jerry_value_t attrKeys = jerry_get_object_keys(attrs);
if (jerry_value_is_undefined(attrKeys)) {
HILOG_ERROR(HILOG_MODULE_ACE, "None attributes to parse.");
+ jerry_release_value(attrs);
return;
}
@@ -898,7 +1050,14 @@ void Component::ParseAttrs(jerry_value_t attrs)
if (jerry_value_is_function(attrValue)) {
START_TRACING_WITH_COMPONENT_NAME(SET_ATTR_PARSE_EXPRESSION, componentName_);
- newAttrValue = ParseExpression(attrKey, attrValue);
+#ifdef FEATURE_LAZY_LOADING_MODULE
+ newAttrValue = CallJSFunction(attrValue, viewModel_, nullptr, 0);
+ JsAppContext *context = JsAppContext::GetInstance();
+ LazyLoadManager *lazyLoadManager = const_cast(context->GetLazyLoadManager());
+ lazyLoadManager->AddLazyLoadWatcher(nativeElement_, attrKey, attrValue);
+#else
+ newAttrValue = AddWatcherItem(attrKey, attrValue);
+#endif
STOP_TRACING();
}
@@ -921,11 +1080,12 @@ void Component::ParseAttrs(jerry_value_t attrs)
ReleaseJerryValue(attrKey, attrValue, VA_ARG_END_FLAG);
}
jerry_release_value(attrKeys);
+ jerry_release_value(attrs);
}
-void Component::SetClickEventListener(UIView &view, const jerry_value_t eventFunc, const uint16_t eventTypeId)
+void Component::SetClickEventListener(UIView &view, const jerry_value_t eventFunc, bool isStopPropagation)
{
- onClickListener_ = new ViewOnClickListener(eventFunc, eventTypeId);
+ onClickListener_ = new ViewOnClickListener(eventFunc, isStopPropagation);
if (onClickListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "click listener create failed");
return;
@@ -1002,9 +1162,9 @@ void Component::SetKeyBoardEventListener(jerry_value_t eventFunc, uint16_t event
}
#endif
-void Component::SetLongPressEventListener(UIView &view, const jerry_value_t eventFunc, const uint16_t eventTypeId)
+void Component::SetLongPressEventListener(UIView &view, const jerry_value_t eventFunc, bool isStopPropagation)
{
- onLongPressListener_ = new ViewOnLongPressListener(eventFunc, eventTypeId);
+ onLongPressListener_ = new ViewOnLongPressListener(eventFunc, isStopPropagation);
if (onLongPressListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "long press listener create failed");
return;
@@ -1014,9 +1174,9 @@ void Component::SetLongPressEventListener(UIView &view, const jerry_value_t even
view.SetTouchable(true);
}
-void Component::SetSwipeEventListener(UIView &view, jerry_value_t eventFunc)
+void Component::SetSwipeEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation)
{
- onSwipeListener_ = new ViewOnSwipeListener(eventFunc);
+ onSwipeListener_ = new ViewOnSwipeListener(eventFunc, isStopPropagation);
if (onSwipeListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "swipe listener create failed");
return;
@@ -1029,30 +1189,43 @@ void Component::SetSwipeEventListener(UIView &view, jerry_value_t eventFunc)
}
// default implementation
-bool Component::RegisterEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
+bool Component::RegisterEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation)
{
- UIView *uiView = GetComponentRootView();
- if ((uiView == nullptr) || !KeyParser::IsKeyValid(eventTypeId) || IS_UNDEFINED(funcValue)) {
+ if (!KeyParser::IsKeyValid(eventTypeId) || IS_UNDEFINED(funcValue)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "register event listener failed cause by invalid attribute name or value.");
return false;
}
- bool registerResult = RegisterPrivateEventListener(eventTypeId, funcValue);
+ UIView *uiView = GetComponentRootView();
+ if (uiView == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "register event listener failed cause by empty view.");
+ return false;
+ }
+
+ bool registerResult = RegisterPrivateEventListener(eventTypeId, funcValue, isStopPropagation);
if (registerResult) {
return true;
}
- return RegisterCommonEventListener(*uiView, eventTypeId, funcValue);
+ return RegisterCommonEventListener(*uiView, eventTypeId, funcValue, isStopPropagation);
}
-bool Component::RegisterCommonEventListener(UIView &view, const uint16_t eventTypeId, const jerry_value_t funcValue)
+bool Component::RegisterCommonEventListener(UIView &view,
+ const uint16_t eventTypeId,
+ const jerry_value_t funcValue,
+ bool isStopPropagation)
{
switch (eventTypeId) {
case K_CLICK: {
- SetClickEventListener(view, funcValue, eventTypeId);
+ SetClickEventListener(view, funcValue, isStopPropagation);
break;
}
case K_LONGPRESS: {
- SetLongPressEventListener(view, funcValue, eventTypeId);
+ SetLongPressEventListener(view, funcValue, isStopPropagation);
+ break;
+ }
+ case K_SWIPE: {
+ SetSwipeEventListener(view, funcValue, isStopPropagation);
break;
}
#ifdef JS_TOUCH_EVENT_SUPPORT
@@ -1077,10 +1250,6 @@ bool Component::RegisterCommonEventListener(UIView &view, const uint16_t eventTy
break;
}
#endif
- case K_SWIPE: {
- SetSwipeEventListener(view, funcValue);
- break;
- }
default: {
return false;
}
@@ -1102,13 +1271,13 @@ void Component::ReleaseCommonEventListeners()
ACE_DELETE(onSwipeListener_);
}
-void Component::AppendDescriptorOrElements(UIViewGroup *viewGroup, const JSValue descriptorOrElements)
+void Component::AppendDescriptorOrElements(Component *parent, const JSValue descriptorOrElements)
{
if (!JSUndefined::Is(descriptorOrElements)) {
uint16_t size = JSArray::Length(descriptorOrElements);
for (uint16_t idx = 0; idx < size; ++idx) {
JSValue descriptorOrElement = JSArray::Get(descriptorOrElements, idx);
- AppendDescriptorOrElement(viewGroup, descriptorOrElement);
+ AppendDescriptorOrElement(parent, descriptorOrElement);
JSRelease(descriptorOrElement);
}
}
@@ -1138,65 +1307,73 @@ void Component::InvalidateIfNeeded(uint16_t attrKeyId, bool invalidateSelf) cons
}
}
-void Component::ParseEvent(jerry_value_t events)
+void Component::ParseEvents()
{
- jerry_value_t eventKeys = jerry_get_object_keys(events);
- if (jerry_value_is_undefined(eventKeys)) {
- HILOG_ERROR(HILOG_MODULE_ACE, "None event to parse.");
+ /*
+ New JS bundle:
+ _c('div', {
+ catchBubbleEvents: {
+ longpress: _vm.handleLongPress
+ },
+ onBubbleEvents: {
+ swipe: _vm.handleSwipe
+ }
+ });
+
+ The events bound to 'catchBubbleEvents' field should be stoped propagation,
+ but the events bound to 'onBubbleEvents' field should not.
+
+ Old JS bundle:
+ _('div', {
+ on: {
+ click: _vm.handleClick
+ },
+ });
+ The old framework does not support the event bubble mechanism.
+ Therefore, the events bound to 'on' field are processed as bound to 'onBubbleEvents' field.
+ */
+ BindEvents("on", true);
+ BindEvents("catchBubbleEvents", true);
+ BindEvents("onBubbleEvents", false);
+}
+
+void Component::BindEvents(const char *type, bool isStopPropagation)
+{
+ JSValue events = JSObject::Get(options_, type);
+ if (JSUndefined::Is(events)) {
+ JSRelease(events);
return;
}
-
- uint16_t length = jerry_get_array_length(eventKeys);
+ JSValue keys = JSObject::Keys(events);
+ if (JSUndefined::Is(keys)) {
+ JSRelease(keys);
+ JSRelease(events);
+ return;
+ }
+ uint16_t length = JSArray::Length(keys);
if (length == 0) {
- HILOG_ERROR(HILOG_MODULE_ACE, "None event to parse.");
- jerry_release_value(eventKeys);
+ JSRelease(keys);
+ JSRelease(events);
return;
}
+ for (uint16_t idx = 0; idx < length; ++idx) {
+ JSValue key = JSArray::Get(keys, idx);
+ JSValue func = JSObject::Get(events, key);
- uint16_t eventTypeStrLen = 0;
- for (uint16_t index = 0; index < length; ++index) {
- jerry_value_t eventKey = jerry_get_property_by_index(eventKeys, index);
- jerry_value_t eventFunc = jerry_get_property(events, eventKey);
-
- char *eventType = MallocStringOf(eventKey, &eventTypeStrLen);
- if (eventType != nullptr) {
- if (eventTypeStrLen != 0) {
- uint16_t eventTypeId = KeyParser::ParseKeyId(eventType, eventTypeStrLen);
- bool isSuccess = RegisterEventListener(eventTypeId, eventFunc);
- if (!isSuccess) {
- HILOG_ERROR(HILOG_MODULE_ACE, "Register event listener error.");
- }
+ uint16_t keyLength = 0;
+ char *keyName = MallocStringOf(key, &keyLength);
+ if (keyLength != 0) {
+ uint16_t keyId = KeyParser::ParseKeyId(keyName, keyLength);
+ if (!RegisterEventListener(keyId, func, isStopPropagation)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Register event listener error.");
}
- ace_free(eventType);
- eventType = nullptr;
}
- ReleaseJerryValue(eventKey, eventFunc, VA_ARG_END_FLAG);
+ ACE_FREE(keyName);
+ JSRelease(func);
+ JSRelease(key);
}
- jerry_release_value(eventKeys);
-}
-
-// set component's left coordinate relative to its parent
-void Component::SetLeft(UIView &view, const AppStyleItem *styleItem) const
-{
- int16_t left = GetStylePixelValue(styleItem);
- view.SetX(left);
-}
-
-// set component's top coordinate relative to its parent
-void Component::SetTop(UIView &view, const AppStyleItem *styleItem) const
-{
- int16_t top = GetStylePixelValue(styleItem);
- view.SetY(top);
-}
-
-void Component::SetHeight(const AppStyleItem *styleItem)
-{
- height_ = GetStylePixelValue(styleItem);
-}
-
-void Component::SetWidth(const AppStyleItem *styleItem)
-{
- width_ = GetStylePixelValue(styleItem);
+ JSRelease(keys);
+ JSRelease(events);
}
void Component::SetVisible(UIView &view, const AppStyleItem *styleItem) const
@@ -1211,7 +1388,7 @@ void Component::SetVisible(UIView &view, const AppStyleItem *styleItem) const
}
uint16_t valueId = KeyParser::ParseKeyId(strValue, GetStyleStrValueLen(styleItem));
- view.SetVisible((valueId == K_NONE) ? false : true);
+ view.SetVisible(valueId != K_NONE);
}
void Component::SetBackgroundColor(UIView &view, const AppStyleItem &styleItem) const
@@ -1232,38 +1409,50 @@ void Component::SetOpacity(UIView &view, const AppStyleItem &styleItem) const
return;
}
double opacity = styleItem.GetFloatingValue();
- view.SetStyle(STYLE_BACKGROUND_OPA, view.GetStyle(STYLE_BACKGROUND_OPA) * opacity);
- view.SetStyle(STYLE_IMAGE_OPA, view.GetStyle(STYLE_IMAGE_OPA) * opacity);
- view.SetStyle(STYLE_LINE_OPA, view.GetStyle(STYLE_LINE_OPA) * opacity);
- view.SetStyle(STYLE_TEXT_OPA, view.GetStyle(STYLE_TEXT_OPA) * opacity);
+ const double opacityMin = 0.0;
+ const double opacityMax = 1.0;
+ if (opacity < opacityMin) {
+ opacity = opacityMin;
+ } else if (opacity > opacityMax) {
+ opacity = opacityMax;
+ }
+ view.SetOpaScale(opacity * OPA_OPAQUE);
}
-void Component::SetMargin(UIView &view, const AppStyleItem &styleItem) const
+void Component::SetMargin(UIView &view) const
{
- SetLeftMargin(view, styleItem);
- SetTopMargin(view, styleItem);
- SetRightMargin(view, styleItem);
- SetBottomMargin(view, styleItem);
+ SetLeftMargin(view);
+ SetTopMargin(view);
+ SetRightMargin(view);
+ SetBottomMargin(view);
}
-void Component::SetLeftMargin(UIView &view, const AppStyleItem &styleItem) const
+void Component::SetLeftMargin(UIView &view) const
{
- view.SetStyle(STYLE_MARGIN_LEFT, GetStylePixelValue(&styleItem));
+ if (marginLeft_.type == DimensionType::TYPE_PIXEL) {
+ view.SetStyle(STYLE_MARGIN_LEFT, marginLeft_.value.pixel);
+ }
}
-void Component::SetTopMargin(UIView &view, const AppStyleItem &styleItem) const
+void Component::SetTopMargin(UIView &view) const
{
- view.SetStyle(STYLE_MARGIN_TOP, GetStylePixelValue(&styleItem));
+ if (marginTop_.type == DimensionType::TYPE_PIXEL) {
+ view.SetStyle(STYLE_MARGIN_TOP, marginTop_.value.pixel);
+ }
}
-void Component::SetRightMargin(UIView &view, const AppStyleItem &styleItem) const
+void Component::SetRightMargin(UIView &view) const
{
- view.SetStyle(STYLE_MARGIN_RIGHT, GetStylePixelValue(&styleItem));
+ if (marginRight_.type == DimensionType::TYPE_PIXEL) {
+ view.SetStyle(STYLE_MARGIN_RIGHT, marginRight_.value.pixel);
+ }
}
-void Component::SetBottomMargin(UIView &view, const AppStyleItem &styleItem) const
+void Component::SetBottomMargin(UIView &view) const
{
- view.SetStyle(STYLE_MARGIN_BOTTOM, GetStylePixelValue(&styleItem));
+ if (marginBottom_.type == DimensionType::TYPE_PIXEL) {
+ view.SetStyle(STYLE_MARGIN_BOTTOM, marginBottom_.value.pixel);
+ }
}
void Component::SetPadding(UIView &view, const AppStyleItem &styleItem) const
@@ -1357,7 +1546,7 @@ void Component::HandleListForDireactive()
}
}
-void Component::AppendChildren(UIViewGroup *viewGroup)
+void Component::AppendChildren(Component *parent)
{
if (JSUndefined::Is(descriptors_)) {
return;
@@ -1368,7 +1557,7 @@ void Component::AppendChildren(UIViewGroup *viewGroup)
for (uint16_t index = 0; index < size; ++index) {
JSValue descriptorOrElement = JSArray::Get(descriptors_, index);
if (!JSUndefined::Is(descriptorOrElement)) {
- bool isDescriptor = AppendDescriptorOrElement(viewGroup, descriptorOrElement);
+ bool isDescriptor = AppendDescriptorOrElement(parent, descriptorOrElement);
if (isDescriptor) {
CreateDirectiveWatcher(descriptorOrElement);
}
@@ -1377,34 +1566,34 @@ void Component::AppendChildren(UIViewGroup *viewGroup)
}
}
-bool Component::AppendDescriptorOrElement(UIViewGroup *viewGroup, const jerry_value_t descriptorOrElement)
+bool Component::AppendDescriptorOrElement(Component *parent, const jerry_value_t descriptorOrElement)
{
if (DescriptorUtils::IsIfDescriptor(descriptorOrElement)) {
- AppendIfDescriptor(viewGroup, descriptorOrElement);
+ AppendIfDescriptor(parent, descriptorOrElement);
return true;
}
if (DescriptorUtils::IsForDescriptor(descriptorOrElement)) {
- AppendForDescriptor(viewGroup, descriptorOrElement);
+ AppendForDescriptor(parent, descriptorOrElement);
return true;
}
- AppendElement(viewGroup, descriptorOrElement);
+ AppendElement(parent, descriptorOrElement);
return false;
}
-void Component::AppendIfDescriptor(UIViewGroup *viewGroup, const jerry_value_t descriptor)
+void Component::AppendIfDescriptor(Component *parent, const jerry_value_t descriptor)
{
bool isShown = DescriptorUtils::IsIfDescriptorShown(descriptor);
if (isShown) {
JSValue decriptorOrElement = DescriptorUtils::GetDescriptorRendered(descriptor);
if (!JSUndefined::Is(decriptorOrElement)) {
- AppendDescriptorOrElement(viewGroup, decriptorOrElement);
+ AppendDescriptorOrElement(parent, decriptorOrElement);
JSRelease(decriptorOrElement);
} else {
// Don't release decriptorOrElement
// because decriptorOrElement is the result of jerry_create_object but jerry_get_property
decriptorOrElement = DescriptorUtils::RenderIfDescriptor(descriptor);
- AppendDescriptorOrElement(viewGroup, decriptorOrElement);
+ AppendDescriptorOrElement(parent, decriptorOrElement);
// does decriptorOrElement need to be release if decriptorOrElement is descriptor
}
@@ -1412,21 +1601,24 @@ void Component::AppendIfDescriptor(UIViewGroup *viewGroup, const jerry_value_t d
DescriptorUtils::DelIfDescriptorRendered(descriptor);
}
}
-void Component::AppendForDescriptor(UIViewGroup *viewGroup, const jerry_value_t descriptor)
+void Component::AppendForDescriptor(Component *parent, const jerry_value_t descriptor)
{
JSValue descriptorOrelements = DescriptorUtils::GetDescriptorRendered(descriptor);
if (!JSUndefined::Is(descriptorOrelements)) {
- AppendDescriptorOrElements(viewGroup, descriptorOrelements);
+ AppendDescriptorOrElements(parent, descriptorOrelements);
JSRelease(descriptorOrelements);
} else {
// Don't release decriptorOrElements
// because decriptorOrElements is the result of jerry_create_object but jerry_get_property
descriptorOrelements = DescriptorUtils::RenderForDescriptor(descriptor);
- AppendDescriptorOrElements(viewGroup, descriptorOrelements);
+ AppendDescriptorOrElements(parent, descriptorOrelements);
}
}
-void Component::AppendElement(UIViewGroup *viewGroup, const jerry_value_t element)
+void Component::AppendElement(Component *parent, const jerry_value_t element)
{
+ if (parent == nullptr) {
+ return;
+ }
Component *component = nullptr;
if (!JSObject::GetNativePointer(element, reinterpret_cast(&component))) {
// if get binding component native pointer failed from a child element, just release that element
@@ -1436,8 +1628,93 @@ void Component::AppendElement(UIViewGroup *viewGroup, const jerry_value_t elemen
return;
}
JSArray::Push(children_, element);
- viewGroup->Add(component->GetComponentRootView());
+ parent->AddChild(component);
}
+
+/*
+ * NOTE: add one child will not attach the native view immediately, but
+ * when removing one child, the child native view will be detached immediately
+ */
+void Component::AddChild(Component *childNode)
+{
+ if (childNode == nullptr) {
+ return;
+ }
+
+ if (childHead_ == nullptr) {
+ childNode->SetParent(this);
+ childNode->SetNextSibling(nullptr);
+ childHead_ = childNode;
+ return;
+ }
+
+ // find the tail
+ Component *temp = childHead_;
+ while ((temp != nullptr) && (temp->GetNextSibling() != nullptr)) {
+ if (temp == childNode) {
+ // already added in the list, drop
+ return;
+ }
+ temp = const_cast(temp->GetNextSibling());
+ }
+ childNode->SetParent(this);
+ temp->SetNextSibling(childNode);
+ childNode->SetNextSibling(nullptr);
+}
+
+void Component::RemoveChild(Component *childNode)
+{
+ if ((childNode == nullptr) || (childHead_ == nullptr)) {
+ return;
+ }
+
+ UIView *childNativeView = childNode->GetComponentRootView();
+ UIViewGroup *parentView = reinterpret_cast(GetComponentRootView());
+ if (childNativeView == nullptr || parentView == nullptr) {
+ return;
+ }
+
+ if (childNode == childHead_) {
+ // it is the head
+ Component *next = const_cast(childHead_->GetNextSibling());
+ childNode->SetNextSibling(nullptr);
+ childNode->SetParent(nullptr);
+ childHead_ = next;
+ parentView->Remove(childNativeView);
+ return;
+ }
+
+ // find the target node's pre one
+ Component *temp = childHead_;
+ while (temp != nullptr) {
+ if (temp->GetNextSibling() == childNode) {
+ // found it
+ break;
+ }
+ temp = const_cast(temp->GetNextSibling());
+ }
+ if (temp == nullptr) {
+ // not found
+ return;
+ }
+
+ // the head itself is the last one
+ if (temp == childHead_) {
+ childHead_ = nullptr;
+ }
+ temp->SetNextSibling(nullptr);
+ childNode->SetNextSibling(nullptr);
+ childNode->SetParent(nullptr);
+ parentView->Remove(childNativeView);
+}
+
+void Component::RemoveAllChildren()
+{
+ while (childHead_ != nullptr) {
+ RemoveChild(childHead_);
+ }
+}
+
void Component::CreateDirectiveWatcher(jerry_value_t descriptor)
{
JSValue watcher = DescriptorUtils::CreateDescriptorWatcher(nativeElement_, descriptor);
@@ -1445,17 +1722,42 @@ void Component::CreateDirectiveWatcher(jerry_value_t descriptor)
InsertWatcherCommon(watchersHead_, watcher);
}
}
-void Component::HandleChildrenChange(jerry_value_t descriptor)
-{
- UIViewGroup *viewGroup = reinterpret_cast(GetComponentRootView());
- if (viewGroup != nullptr) {
- viewGroup->RemoveAll();
- } else {
- HILOG_ERROR(HILOG_MODULE_ACE, "Get root component error");
+void Component::BuildViewTree(Component *currComponent, Component *parent, ConstrainedParameter &parentParameter)
+{
+ if (currComponent == nullptr) {
return;
}
+ // align self dimension
+ currComponent->AlignDimensions(parentParameter);
+ // refresh rect (border box sizing -> content box sizing)
+ currComponent->AdaptBoxSizing();
+ // attach to parent
+ if (parent != nullptr) {
+ parent->AttachView(currComponent);
+ // notify view has been attached to tree, it means the parent's size is already calculated out
+ currComponent->OnViewAttached();
+ }
+
+ Component *child = const_cast(currComponent->GetChildHead());
+ if (child == nullptr) {
+ return;
+ }
+ // the child only can layout in the content area of parent
+ ConstrainedParameter alignParameter;
+ currComponent->GetConstrainedParam(alignParameter);
+ while (child != nullptr) {
+ BuildViewTree(child, currComponent, alignParameter);
+ child = const_cast(child->GetNextSibling());
+ }
+ // consider how to avoid layout repeatly, for example: div - div -- div
+ currComponent->LayoutChildren();
+}
+
+void Component::HandleChildrenChange(jerry_value_t descriptor)
+{
+ RemoveAllChildren();
if (!JSUndefined::Is(children_)) {
JSRelease(children_);
children_ = JSArray::Create(0);
@@ -1468,49 +1770,54 @@ void Component::HandleChildrenChange(jerry_value_t descriptor)
continue;
}
if (descriptorOrElement == descriptor) {
- UpdateDescriptor(viewGroup, descriptorOrElement);
+ UpdateDescriptor(this, descriptorOrElement);
} else {
- ReappendDescriptorOrElement(viewGroup, descriptorOrElement);
+ ReappendDescriptorOrElement(this, descriptorOrElement);
}
JSRelease(descriptorOrElement);
}
- viewGroup->LayoutChildren();
- viewGroup->Invalidate();
+ Component *parent = const_cast(GetParent());
+ ConstrainedParameter parentParam;
+ Component *target = (parent == nullptr) ? this : parent;
+ target->GetConstrainedParam(parentParam);
+ BuildViewTree(this, nullptr, parentParam);
+ target->LayoutChildren();
+ target->Invalidate();
}
-void Component::UpdateDescriptor(UIViewGroup *viewGroup, const jerry_value_t descriptor)
+void Component::UpdateDescriptor(Component *parent, const jerry_value_t descriptor)
{
if (DescriptorUtils::IsIfDescriptor(descriptor)) {
- AppendIfDescriptor(viewGroup, descriptor);
+ AppendIfDescriptor(parent, descriptor);
} else if (DescriptorUtils::IsForDescriptor(descriptor)) {
// Release descriptor last rendered
DescriptorUtils::DelForDescriptorRendered(descriptor);
// Re-render descriptor
JSValue descriptorOrElements = DescriptorUtils::RenderForDescriptor(descriptor);
- AppendDescriptorOrElements(viewGroup, descriptorOrElements);
+ AppendDescriptorOrElements(parent, descriptorOrElements);
} else {
// never
}
}
-void Component::ReappendDescriptorOrElement(UIViewGroup *viewGroup, const jerry_value_t descriptor)
+void Component::ReappendDescriptorOrElement(Component *parent, const jerry_value_t descriptor)
{
if (DescriptorUtils::IsIfDescriptor(descriptor)) {
JSValue descriptorOrElement = DescriptorUtils::GetDescriptorRendered(descriptor);
if (!JSUndefined::Is(descriptorOrElement)) {
- AppendDescriptorOrElement(viewGroup, descriptor);
+ AppendDescriptorOrElement(parent, descriptor);
}
JSRelease(descriptorOrElement);
} else if (DescriptorUtils::IsForDescriptor(descriptor)) {
JSValue descriptorOrElements = DescriptorUtils::GetDescriptorRendered(descriptor);
if (!JSUndefined::Is(descriptorOrElements)) {
- AppendDescriptorOrElements(viewGroup, descriptorOrElements);
+ AppendDescriptorOrElements(parent, descriptorOrElements);
}
JSRelease(descriptorOrElements);
} else {
- AppendElement(viewGroup, descriptor);
+ AppendElement(parent, descriptor);
}
}
@@ -1550,12 +1857,77 @@ bool Component::GetStyleColorValue(const AppStyleItem *style, uint32_t &color, u
color = style->GetNumValue();
alpha = OPA_OPAQUE;
return true;
- } else if (style->GetValueType() == STYLE_PROP_VALUE_TYPE_STRING) {
- return ParseColor(style->GetStrValue(), color, alpha);
- } else {
- HILOG_ERROR(HILOG_MODULE_ACE, "invalid color format!");
- return false;
}
+ if (style->GetValueType() == STYLE_PROP_VALUE_TYPE_STRING) {
+ return ParseColor(style->GetStrValue(), color, alpha);
+ }
+ HILOG_ERROR(HILOG_MODULE_ACE, "invalid color format!");
+ return false;
}
+
+bool Component::HandleBackgroundImg(const AppStyleItem &styleItem, char *&pressedImage, char *&normalImage) const
+{
+ bool result = false;
+ if (styleItem.GetValueType() == STYLE_PROP_VALUE_TYPE_STRING) {
+ const char * const url = styleItem.GetStrValue();
+ char *filePath = CreatePathStrFromUrl(url);
+ if (filePath != nullptr) {
+ char *imagePath = JsAppContext::GetInstance()->GetResourcePath(filePath);
+ if (imagePath == nullptr) {
+ ace_free(filePath);
+ filePath = nullptr;
+ return result;
+ }
+#ifdef OHOS_ACELITE_PRODUCT_WATCH
+ // convert .png/jpeg/bmp to .bin subfix
+ CureImagePath(imagePath);
+#endif // OHOS_ACELITE_PRODUCT_WATCH
+ if ((styleItem.GetPseudoClassType() == PSEUDO_CLASS_ACTIVE) ||
+ (styleItem.GetPseudoClassType() == PSEUDO_CLASS_CHECKED)) {
+ // in case we don't free the buffer after using
+ ACE_FREE(pressedImage);
+ pressedImage = imagePath;
+ } else {
+ // in case we don't free the buffer after using
+ ACE_FREE(normalImage);
+ normalImage = imagePath;
+ }
+ ace_free(filePath);
+ filePath = nullptr;
+ result = true;
+ }
+ }
+ return result;
+}
+
+#ifdef FEATURE_ROTATION_API
+jerry_value_t Component::HandleRotationRequest(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t size)
+{
+ UNUSED(func);
+ UIView *bindedView = ComponentUtils::GetViewFromBindingObject(dom);
+ if (bindedView == nullptr) {
+ return UNDEFINED;
+ }
+
+ // default action is to request the focus even user do not pass the argument
+ bool focusRequest = true;
+ if (args != nullptr && size > 0) {
+ if (!JerryGetBoolProperty(args[0], ATTR_NAME_FOCUS, focusRequest)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "not bool argument passed, will clear the focus!");
+ focusRequest = false;
+ }
+ }
+ if (focusRequest) {
+ bindedView->RequestFocus();
+ } else {
+ bindedView->ClearFocus();
+ }
+
+ return UNDEFINED;
+}
+#endif // FEATURE_ROTATION_API
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/component.h b/frameworks/src/core/components/component.h
similarity index 69%
rename from src/core/components/component.h
rename to frameworks/src/core/components/component.h
index 705ff8f..d15dbb9 100755
--- a/src/core/components/component.h
+++ b/frameworks/src/core/components/component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -27,6 +27,41 @@
namespace OHOS {
namespace ACELite {
+enum DimensionType : uint8_t {
+ TYPE_UNKNOWN = 0,
+ TYPE_PIXEL,
+ TYPE_PERCENT,
+};
+
+union DimensionValue {
+ float percentage;
+ int16_t pixel;
+};
+
+struct Dimension : public MemoryHeap {
+ Dimension() : type(DimensionType::TYPE_UNKNOWN)
+ {
+ value.percentage = -1;
+ }
+ Dimension(float dValue, DimensionType dType)
+ {
+ value.percentage = dValue;
+ type = dType;
+ }
+ DimensionValue value;
+ DimensionType type;
+};
+
+/**
+ * @brief The ConstrainedParameter struct record the content rang limitation
+ */
+struct ConstrainedParameter : public MemoryHeap {
+ ConstrainedParameter() : maxWidth(0), maxHeight(0) {}
+ ConstrainedParameter(int16_t width, int16_t height) : maxWidth(width), maxHeight(height) {}
+ int16_t maxWidth;
+ int16_t maxHeight;
+};
+
class Component : public MemoryHeap {
public:
ACE_DISALLOW_COPY_AND_MOVE(Component);
@@ -72,6 +107,18 @@ public:
*/
virtual UIView *GetComponentRootView() const = 0;
+ /**
+ * @brief This is the entry to set all combined styles into one specific component, one default
+ * implementation is provided, which calls ApplyPrivateStyle() to try the component's private special
+ * style first, if one gets matched, the appling process ends, if not, common styles will be
+ * tried by calling ApplyCommonStyle() method.
+ *
+ * NOTE: The default implementation just apply styles into the ui view returned by GetComponentRootView(),
+ * if this doesn't meet your requirement, go ahead to override this whole function as you want.
+ *
+ * @return true if the given style gets matched and is set properly, false for otherwise.
+ */
+ virtual bool ApplyStyle(const AppStyleItem *style);
/**
* Call this to invalidate the views this component is holding, the default implementation is just to
* invalidate the root view of the component, if the child class has special requirement, override this
@@ -104,10 +151,39 @@ public:
return descriptors_;
}
- jerry_value_t ParseExpression(jerry_value_t attrKey, jerry_value_t attrValue);
+ jerry_value_t AddWatcherItem(const jerry_value_t attrKey, const jerry_value_t attrValue,
+ bool isLazyLoading = false);
void HandleChildrenChange(jerry_value_t descriptor);
+ /**
+ * @brief AttachView call this function to link native views together to the tree
+ */
+ virtual void AttachView(const Component *child)
+ {
+ UNUSED(child);
+ }
+ /**
+ * @brief OnViewAttached called when the native view is attached to the tree
+ */
+ virtual void OnViewAttached() {}
+ virtual void LayoutChildren() {}
+ static void BuildViewTree(Component *currComponent, Component *parent, ConstrainedParameter &alignParameter);
+
+ const Component *GetParent() const
+ {
+ return parent_;
+ }
+
+ const Component *GetChildHead() const
+ {
+ return childHead_;
+ }
+
+ const Component *GetNextSibling() const
+ {
+ return nextSibling_;
+ }
struct AnimationsNode : public MemoryHeap {
TransitionImpl *transitionImpl;
AnimationsNode *next;
@@ -117,6 +193,12 @@ public:
static void HandlerAnimations();
static void ReleaseAnimations();
+ /**
+ * @brief GetDimension return the dimension data, only width, height, margin, top and left are supported
+ * @param keyNameId the key ID for representing which dimension data is wanted
+ * @return the requested dimension data
+ */
+ const Dimension &GetDimension(uint16_t keyNameId) const;
protected:
void SetComponentName(uint16_t name)
@@ -128,7 +210,7 @@ protected:
/**
* @brief The child class can implement this function to do some initialization before the whole render process
- * begining. See PostRender() also. The default implementation just does nothing.
+ * beginning. See PostRender() also. The default implementation just does nothing.
*/
virtual void PreRender() {}
/**
@@ -147,7 +229,7 @@ protected:
* @brief This function will be called when UpdateView execute finished. See PreUpdate() also.
* The default implementation just does nothing.
*/
- virtual void PostUpdate(uint16_t attrKeyId, bool updateResult) {}
+ virtual void PostUpdate(uint16_t attrKeyId) {}
/**
* @brief step1: inherited class must override this method to create the native views, it's the child class's
* responsibility to record the native views it creates out, and they should be released properly in release
@@ -159,12 +241,20 @@ protected:
*
* @return true for success, false for failure
*/
- virtual bool CreateNativeViews() = 0;
+ virtual bool CreateNativeViews()
+ {
+ return true;
+ }
/**
* @brief This function must be implemented by child classes. Should release all the native views it
* creates out in CreateNativeViews() function.
*/
- virtual void ReleaseNativeViews() = 0;
+ virtual void ReleaseNativeViews() {}
+ /**
+ * @brief Mapping native view with DOM element.
+ */
+ virtual void SetViewExtraMsg();
+ virtual void ReleaseViewExtraMsg();
/**
* @brief This is the entry to set all attributes into one specific component, one default
* implementation is provided, which calls SetPrivateAttribute() to try the component's private special
@@ -204,35 +294,26 @@ protected:
*
* @return true if the given event gets matched and is set properly, false for otherwise.
*/
- virtual bool RegisterEventListener(uint16_t eventTypeId, jerry_value_t funcValue);
+ virtual bool RegisterEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation);
/**
* @brief Child class should call this to set common event listener to a given native view.
*
* @return true if any common event type matchs successfully, false if no match at all
*/
- bool RegisterCommonEventListener(UIView& view, const uint16_t eventTypeId, const jerry_value_t funcValue);
+ bool RegisterCommonEventListener(UIView& view,
+ const uint16_t eventTypeId,
+ const jerry_value_t funcValue,
+ bool isStopPropagation);
/**
* @brief Child class should call this to set own special event setting/update actions.
*
* @return true if any common event type matchs successfully, false if no match at all
*/
- virtual bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
+ virtual bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation)
{
return false;
}
- /**
- * @brief This is the entry to set all combined styles into one specific component, one default
- * implementation is provided, which calls ApplyPrivateStyle() to try the component's private special
- * style first, if one gets matched, the appling process ends, if not, common styles will be
- * tried by calling ApplyCommonStyle() method.
- *
- * NOTE: The default implementation just apply styles into the ui view returned by GetComponentRootView(),
- * if this doesn't meet your requirement, go ahead to override this whole function as you want.
- *
- * @return true if the given style gets matched and is set properly, false for otherwise.
- */
- virtual bool ApplyStyle(const AppStyleItem *style);
/**
* @brief Used to set all common styles for all kinds of component.
*
@@ -284,14 +365,14 @@ protected:
jerry_value_t SetListForWatcher(jerry_value_t getter, jerry_value_t children);
void HandleListForDireactive();
- void AppendChildren(UIViewGroup *viewGroup);
- bool AppendDescriptorOrElement(UIViewGroup *viewGroup, const jerry_value_t descriptorOrElement);
- void AppendIfDescriptor(UIViewGroup *viewGroup, const jerry_value_t descriptor);
- void AppendForDescriptor(UIViewGroup *viewGroup, const jerry_value_t descriptor);
- void AppendElement(UIViewGroup *viewGroup, const jerry_value_t element);
+ void AppendChildren(Component *parent);
+ bool AppendDescriptorOrElement(Component *parent, const jerry_value_t descriptorOrElement);
+ void AppendIfDescriptor(Component *parent, const jerry_value_t descriptor);
+ void AppendForDescriptor(Component *parent, const jerry_value_t descriptor);
+ void AppendElement(Component *parent, const jerry_value_t element);
void CreateDirectiveWatcher(jerry_value_t descriptor);
- void UpdateDescriptor(UIViewGroup *viewGroup, const jerry_value_t descriptor);
- void ReappendDescriptorOrElement(UIViewGroup *viewGroup, const jerry_value_t descriptor);
+ void UpdateDescriptor(Component *parent, const jerry_value_t descriptor);
+ void ReappendDescriptorOrElement(Component *parent, const jerry_value_t descriptor);
int32_t GetStyleNumValue(const AppStyleItem *style) const
{
return style->GetNumValue();
@@ -318,11 +399,16 @@ protected:
}
int16_t GetHeight() const
{
- return height_;
+ return (height_.type == TYPE_PIXEL) ? height_.value.pixel : INVALID_PIXEL_VALUE;
}
int16_t GetWidth() const
{
- return width_;
+ return (width_.type == TYPE_PIXEL) ? width_.value.pixel : INVALID_PIXEL_VALUE;
+ }
+
+ jerry_value_t *GetDomElementPointer()
+ {
+ return &nativeElement_;
}
int32_t GetStylePixelValue(const AppStyleItem *style, int32_t defaultValue = 0) const;
@@ -333,21 +419,49 @@ protected:
void SetTopPadding(UIView &view, const AppStyleItem& styleItem) const;
void SetRightPadding(UIView &view, const AppStyleItem& styleItem) const;
void SetBottomPadding(UIView &view, const AppStyleItem& styleItem) const;
- void SetLeftMargin(UIView &view, const AppStyleItem& styleItem) const;
- void SetTopMargin(UIView &view, const AppStyleItem& styleItem) const;
- void SetRightMargin(UIView &view, const AppStyleItem& styleItem) const;
- void SetBottomMargin(UIView &view, const AppStyleItem& styleItem) const;
- void SetMargin(UIView &view, const AppStyleItem& styleItem) const;
void SetBorderWidth(UIView &view, const AppStyleItem& styleItem) const;
void SetBorderColor(UIView &view, const AppStyleItem& styleItem) const;
void SetBorderRadius(UIView &view, const AppStyleItem& styleItem) const;
void SetBackgroundColor(UIView &view, const AppStyleItem& styleItem) const;
void SetOpacity(UIView &view, const AppStyleItem &styleItem) const;
+ /**
+ * @brief GetConstrainedParam return the align parameter the children can be refer to
+ */
+ void GetConstrainedParam(ConstrainedParameter ¶m) const;
+ void SetLeftMargin(UIView &view) const;
+ void SetTopMargin(UIView &view) const;
+ void SetRightMargin(UIView &view) const;
+ void SetBottomMargin(UIView &view) const;
+ void SetMargin(UIView &view) const;
+ virtual void ApplyAlignedMargin(UIView &uiView) const;
+ /**
+ * @brief get the pressedImage url and the normal image url
+ * @param styleItem the style item which contains image info
+ * @param pressedImage the pseudo value in style item
+ * @param normalImage the normal image url
+ * @return if get the image url success return true, else false
+ */
+ bool HandleBackgroundImg(const AppStyleItem &styleItem, char *&pressedImage, char *&normalImage) const;
+
+#ifdef FEATURE_ROTATION_API
+ /**
+ * @brief the rotation API handling function, the child component can register it for rotation API supporting
+ * @param func function object
+ * @param dom the context of function execution
+ * @param args the list of arguments
+ * @param size the length of arguments list
+ * @return the handling result to caller
+ */
+ static jerry_value_t HandleRotationRequest(const jerry_value_t func,
+ const jerry_value_t dom,
+ const jerry_value_t args[],
+ const jerry_length_t size);
+#endif // FEATURE_ROTATION_API
private:
/**
* @brief Used to set animation keyframes, such as transform, background-color, height etc.
- * it is set as attribute, and support binding to data, so it can be changed dynamiclly.
+ * it is set as attribute, and support binding to data, so it can be changed dynamically.
*
* the following three functions will called in order
*/
@@ -378,36 +492,35 @@ private:
int32_t GetAnimatorValue(char *animatorValue, const int8_t index, bool isOpacity = false) const;
void ParseOptions();
- void ParseAttrs(jerry_value_t attrs);
- void ParseEvent(jerry_value_t events);
+ void ParseAttrs();
+ void ParseEvents();
+ void BindEvents(const char *type, bool isStopPropagation);
/**
* @brief Apply combined styles into native view.
*/
- void ApplyStyles();
+ void ApplyStyles(const jerry_value_t options, Component& currentComponent) const;
/**
* @brief This function will be called after the ApplyCommonStyle, make padding style work.
*/
- bool RefreshRect() const;
- void SetHeight(const AppStyleItem *styleItem);
- void SetWidth(const AppStyleItem *styleItem);
+ bool AdaptBoxSizing() const;
+ void ApplyAlignedPosition(UIView &uiView) const;
+ void AdapteBoxRectArea(UIView &uiView) const;
void SetVisible(UIView& view, const AppStyleItem *styleItem) const;
- void SetLeft(UIView& view, const AppStyleItem *styleItem) const;
- void SetTop(UIView& view, const AppStyleItem *styleItem) const;
- void SetClickEventListener(UIView& view, const jerry_value_t eventFunc, const uint16_t eventTypeId);
- void SetLongPressEventListener(UIView& view, const jerry_value_t eventFunc, const uint16_t eventTypeId);
- void SetSwipeEventListener(UIView& view, jerry_value_t eventFunc);
+ void SetClickEventListener(UIView& view, const jerry_value_t eventFunc, bool isStopPropagation);
+ void SetLongPressEventListener(UIView& view, const jerry_value_t eventFunc, bool isStopPropagation);
+ void SetSwipeEventListener(UIView& view, jerry_value_t eventFunc, bool isStopPropagation);
#ifdef JS_TOUCH_EVENT_SUPPORT
- void SetTouchStartEventListener(UIView &view, jerry_value_t eventFunc, const uint16_t eventTypeId);
- void SetTouchMoveEventListener(UIView &view, jerry_value_t eventFunc, const uint16_t eventTypeId);
- void SetTouchEndEventListener(UIView &view, jerry_value_t eventFunc, const uint16_t eventTypeId);
- void SetTouchCancelEventListener(UIView &view, jerry_value_t eventFunc, const uint16_t eventTypeId);
- void SetKeyBoardEventListener(jerry_value_t eventFunc, const uint16_t eventTypeId);
+ void SetTouchStartEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation);
+ void SetTouchMoveEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation);
+ void SetTouchEndEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation);
+ void SetTouchCancelEventListener(UIView &view, jerry_value_t eventFunc, bool isStopPropagation);
+ void SetKeyBoardEventListener(jerry_value_t eventFunc, bool isStopPropagation);
#endif
/**
* @brief release common event listeners if any is set
*/
void ReleaseCommonEventListeners();
- void AppendDescriptorOrElements(UIViewGroup *viewGroup, const JSValue descriptorOrElements);
+ void AppendDescriptorOrElements(Component *parent, const JSValue descriptorOrElements);
/**
* @brief For some situations, if the component's rect(position, width, height and so on) area is changed, need
* to force the parent container to relayout all children, and need to invalided self before the changes are
@@ -419,6 +532,54 @@ private:
void InvalidateIfNeeded(uint16_t attrKeyId, bool invalidateSelf = false) const;
void AddAnimationToList(const TransitionImpl *transitionImpl) const;
+ void GetDimensionFromStyle(Dimension &dimension, const AppStyleItem &styleItem) const;
+ void CalculateDimensionPixel(Dimension &dimension, int16_t base) const;
+ void AlignDimensions(const ConstrainedParameter ¶m);
+ virtual void OnDimensionsAligned() {}
+
+ /**
+ * @brief SetParent assign parent node
+ * @param parent current component's parent
+ */
+ void SetParent(Component *parent)
+ {
+ parent_ = parent;
+ }
+ void SetNextSibling(Component *next)
+ {
+ nextSibling_ = next;
+ }
+ /**
+ * @brief AddChild insert one child
+ * @param childNode child component
+ *
+ * NOTE: add one child will not attach the native view immediately, but
+ * when removing one child, the child native view will be detached immediately
+ */
+ void AddChild(Component *childNode);
+ /**
+ * @brief RemoveChild cut off the specific child from current component
+ * @param childNode the child component
+ */
+ void RemoveChild(Component *childNode);
+ /**
+ * @brief RemoveAllChildren clean all children
+ */
+ void RemoveAllChildren();
+
+ /**
+ * @brief childHead_ the child list
+ */
+ Component *childHead_;
+ /**
+ * @brief nextSibling_ next neighbor
+ */
+ Component *nextSibling_;
+ /**
+ * @brief parent_ parent component node
+ */
+ Component *parent_;
+
AppStyleManager *styleManager_;
jerry_value_t nativeElement_;
jerry_value_t viewModel_;
@@ -445,8 +606,14 @@ private:
TransitionParams *trans_;
jerry_value_t descriptors_;
Watcher *watchersHead_;
- int16_t height_;
- int16_t width_;
+ Dimension height_;
+ Dimension width_;
+ Dimension top_;
+ Dimension left_;
+ Dimension marginTop_;
+ Dimension marginLeft_;
+ Dimension marginRight_;
+ Dimension marginBottom_;
};
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/component_factory.h b/frameworks/src/core/components/component_factory.h
similarity index 77%
rename from src/core/components/component_factory.h
rename to frameworks/src/core/components/component_factory.h
index bcc1862..c686ee8 100755
--- a/src/core/components/component_factory.h
+++ b/frameworks/src/core/components/component_factory.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -28,11 +28,16 @@
#include "canvas_component.h"
#endif // FEATURE_COMPONENT_CANVAS
#include "chart_component.h"
+#include "circle_progress_component.h"
#include "component.h"
#include "div_component.h"
#include "fatal_handler.h"
+#include "horizon_progress_component.h"
+#include "image_animator_component.h"
#include "image_component.h"
-#include "input_component.h"
+#include "input_button_component.h"
+#include "input_checkbox_component.h"
+#include "input_radio_component.h"
#include "js_fwk_common.h"
#include "key_parser.h"
#include "keys.h"
@@ -40,11 +45,13 @@
#include "marquee_component.h"
#include "non_copyable.h"
#include "picker_view_component.h"
-#include "progress_component.h"
+#ifdef FEATURE_COMPONENT_QRCODE
+#include "qrcode_component.h"
+#endif
#include "slider_component.h"
+#include "stack_component.h"
#include "swiper_component.h"
#include "switch_component.h"
-#include "image_animator_component.h"
#ifdef FEATURE_COMPONENT_TABS
#include "tab_bar_component.h"
#include "tab_content_component.h"
@@ -84,10 +91,10 @@ public:
break;
#endif // FEATURE_COMPONENT_CANVAS
case K_DIV:
- component = new DivComponent(options, children, styleManager, DivComponent::LayoutType::FLEX);
+ component = new DivComponent(options, children, styleManager);
break;
case K_STACK:
- component = new DivComponent(options, children, styleManager, DivComponent::LayoutType::POSITION);
+ component = new StackComponent(options, children, styleManager);
break;
case K_IMAGE:
component = new ImageComponent(options, children, styleManager);
@@ -95,9 +102,16 @@ public:
case K_IMAGE_ANIMATOR:
component = new ImageAnimatorComponent(options, children, styleManager);
break;
- case K_PROGRESS:
- component = new ProgressComponent(options, children, styleManager);
+ case K_PROGRESS: {
+ uint16_t id = ComponentUtils::GetComponentType(options);
+ if (id == K_ARC) {
+ component = new CircleProgressComponent(options, children, styleManager);
+ } else {
+ // default type is horizon progress
+ component = new HorizonProgressComponent(options, children, styleManager);
+ }
break;
+ }
#ifdef FEATURE_COMPONENT_TABS
case K_TAB_BAR:
component = new TabBarComponent(options, children, styleManager);
@@ -125,7 +139,7 @@ public:
component = new ListComponent(options, children, styleManager);
break;
case K_LIST_ITEM:
- component = new DivComponent(options, children, styleManager, DivComponent::LayoutType::FLEX);
+ component = new DivComponent(options, children, styleManager);
break;
#ifdef FEATURE_COMPONENT_ANALOG_CLOCK
case K_CLOCK_HAND:
@@ -135,9 +149,18 @@ public:
component = new AnalogClockComponent(options, children, styleManager);
break;
#endif // FEATURE_COMPONENT_ANALOG_CLOCK
- case K_INPUT:
- component = new InputComponent(options, children, styleManager);
+ case K_INPUT: {
+ uint16_t id = ComponentUtils::GetComponentType(options);
+ if (id == K_CHECKBOX) {
+ component = new InputCheckboxComponent(options, children, styleManager);
+ } else if (id == K_RADIO) {
+ component = new InputRadioComponent(options, children, styleManager);
+ } else {
+ // default type is input button
+ component = new InputButtonComponent(options, children, styleManager);
+ }
break;
+ }
case K_MARQUEE:
component = new MarqueeComponent(options, children, styleManager);
break;
@@ -147,6 +170,11 @@ public:
case K_PICKER_VIEW:
component = new PickerViewComponent(options, children, styleManager);
break;
+#ifdef FEATURE_COMPONENT_QRCODE
+ case K_QRCODE:
+ component = new QrcodeComponent(options, children, styleManager);
+ break;
+#endif // FEATURE_COMPONENT_QRCODE
#ifdef FEATURE_COMPONENT_VIDEO
case K_VIDEO:
component = new VideoComponent(options, children, styleManager);
diff --git a/frameworks/src/core/components/component_utils.cpp b/frameworks/src/core/components/component_utils.cpp
new file mode 100755
index 0000000..b144e11
--- /dev/null
+++ b/frameworks/src/core/components/component_utils.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "component_utils.h"
+#include "ace_log.h"
+#include "component.h"
+#include "descriptor_utils.h"
+
+namespace OHOS {
+namespace ACELite {
+UIView* ComponentUtils::GetViewFromBindingObject(jerry_value_t value)
+{
+ Component* component = GetComponentFromBindingObject(value);
+ return component ? component->GetComponentRootView() : nullptr;
+}
+
+Component* ComponentUtils::GetComponentFromBindingObject(jerry_value_t value)
+{
+ if (IS_UNDEFINED(value)) {
+ return nullptr;
+ }
+
+ Component* component = nullptr;
+ bool isBinded = jerry_get_object_native_pointer(value, reinterpret_cast(&component), nullptr);
+ if (!isBinded || (component == nullptr)) {
+ return nullptr;
+ }
+ return component;
+}
+
+void ComponentUtils::ReleaseComponents(Component *rootComponent)
+{
+ if (rootComponent == nullptr) {
+ return;
+ }
+ // for list component, release all the list items first
+ if (rootComponent->GetComponentName() != K_LIST) {
+ JSValue descriptors = rootComponent->GetDescriptors();
+ if (!JSUndefined::Is(descriptors)) {
+ DescriptorUtils::ReleaseDescriptorOrElements(descriptors);
+ }
+ }
+ Component *child = const_cast(rootComponent->GetChildHead());
+ if (child == nullptr) {
+ // has no children, can be released directly
+ rootComponent->Release();
+ delete rootComponent;
+ return;
+ }
+ while (child != nullptr) {
+ ReleaseComponents(child);
+ child = const_cast(child->GetNextSibling());
+ }
+}
+
+uint16_t ComponentUtils::GetComponentType(jerry_value_t options)
+{
+ if (IS_UNDEFINED(options)) {
+ return 0;
+ }
+ jerry_value_t attrsPropValue = jerryx_get_property_str(options, ATTR_ATTRS);
+ // create component according to attribute type
+ const char * const attrType = "type";
+ jerry_value_t typeValHandler = jerryx_get_property_str(attrsPropValue, attrType);
+ uint16_t typeId = 0;
+ if (!jerry_value_is_undefined(typeValHandler)) {
+ uint16_t len = 0;
+ char *type = MallocStringOf(typeValHandler, &len);
+ typeId = KeyParser::ParseKeyId(type, len);
+ ACE_FREE(type);
+ }
+ ReleaseJerryValue(typeValHandler, attrsPropValue, VA_ARG_END_FLAG);
+ return typeId;
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/src/core/components/component_utils.h b/frameworks/src/core/components/component_utils.h
old mode 100755
new mode 100644
similarity index 84%
rename from src/core/components/component_utils.h
rename to frameworks/src/core/components/component_utils.h
index fff9c61..8b7ee02
--- a/src/core/components/component_utils.h
+++ b/frameworks/src/core/components/component_utils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -36,6 +36,11 @@ public:
* @brief Easy method to get the the component binded to the given JS object.
*/
static Component* GetComponentFromBindingObject(jerry_value_t value);
+ static void ReleaseComponents(Component *rootComponent);
+ /**
+ * @brief Easy method to get the the component type.
+ */
+ static uint16_t GetComponentType(jerry_value_t options);
};
} // namespace ACELite
} // namespace OHOS
diff --git a/frameworks/src/core/components/div_component.cpp b/frameworks/src/core/components/div_component.cpp
new file mode 100644
index 0000000..5468ca5
--- /dev/null
+++ b/frameworks/src/core/components/div_component.cpp
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "div_component.h"
+#include "ace_log.h"
+#include "key_parser.h"
+#include "keys.h"
+
+namespace OHOS {
+namespace ACELite {
+DivComponent::DivComponent(jerry_value_t options,
+ jerry_value_t children,
+ AppStyleManager* styleManager)
+ : Component(options, children, styleManager),
+ isSecondaryAxisAlignSet_(false)
+{
+ SetComponentName(K_DIV);
+ nativeView_.SetStyle(STYLE_BACKGROUND_OPA, 0);
+}
+
+
+inline UIView *DivComponent::GetComponentRootView() const
+{
+ return const_cast(&nativeView_);
+}
+
+bool DivComponent::ApplyPrivateStyle(const AppStyleItem* style)
+{
+ // Set default value
+ if (!isSecondaryAxisAlignSet_) {
+ nativeView_.SetSecondaryAxisAlign(OHOS::ALIGN_START);
+ }
+ uint16_t stylePropNameId = GetStylePropNameId(style);
+ if (!KeyParser::IsKeyValid(stylePropNameId)) {
+ return false;
+ }
+ const char * const strValue = GetStyleStrValue(style);
+ if (strValue == nullptr) {
+ return false;
+ }
+
+ bool applyResult = true;
+ uint16_t valueId = KeyParser::ParseKeyId(strValue, GetStyleStrValueLen(style));
+ switch (stylePropNameId) {
+ case K_FLEX_DIRECTION: {
+ switch (valueId) {
+ case K_COLUMN:
+ nativeView_.SetLayoutDirection(LAYOUT_VER);
+ break;
+ case K_ROW:
+ nativeView_.SetLayoutDirection(LAYOUT_HOR);
+ break;
+ case K_ROW_REVERSE:
+ nativeView_.SetLayoutDirection(LAYOUT_HOR_R);
+ break;
+ case K_COLUMN_REVERSE:
+ nativeView_.SetLayoutDirection(LAYOUT_VER_R);
+ break;
+ default:
+ applyResult = false;
+ break;
+ }
+ break;
+ }
+ case K_JUSTIFY_CONTENT: {
+ switch (valueId) {
+ case K_FLEX_START:
+ nativeView_.SetMajorAxisAlign(OHOS::ALIGN_START);
+ break;
+ case K_FLEX_END:
+ nativeView_.SetMajorAxisAlign(OHOS::ALIGN_END);
+ break;
+ case K_CENTER:
+ nativeView_.SetMajorAxisAlign(OHOS::ALIGN_CENTER);
+ break;
+ case K_SPACE_BETWEEN:
+ nativeView_.SetMajorAxisAlign(OHOS::ALIGN_BETWEEN);
+ break;
+ case K_SPACE_AROUND:
+ nativeView_.SetMajorAxisAlign(OHOS::ALIGN_EVENLY);
+ break;
+ default:
+ applyResult = false;
+ break;
+ }
+ break;
+ }
+ case K_ALIGN_ITEMS: {
+ switch (valueId) {
+ case K_FLEX_START:
+ nativeView_.SetSecondaryAxisAlign(OHOS::ALIGN_START);
+ break;
+ case K_FLEX_END:
+ nativeView_.SetSecondaryAxisAlign(OHOS::ALIGN_END);
+ break;
+ case K_CENTER:
+ nativeView_.SetSecondaryAxisAlign(OHOS::ALIGN_CENTER);
+ break;
+ default:
+ applyResult = false;
+ break;
+ }
+ if (applyResult)
+ isSecondaryAxisAlignSet_ = true;
+ break;
+ }
+ case K_FLEX_WRAP: {
+ if (valueId == K_WRAP) {
+ nativeView_.SetFlexWrap(FlexLayout::WRAP);
+ } else {
+ nativeView_.SetFlexWrap(FlexLayout::NOWRAP);
+ }
+ break;
+ }
+ default:
+ applyResult = false;
+ break;
+ }
+
+ return applyResult;
+}
+
+bool DivComponent::ProcessChildren()
+{
+ // add all children to this container
+ AppendChildren(this);
+
+ return true;
+}
+
+void DivComponent::PostUpdate(uint16_t attrKeyId)
+{
+ nativeView_.LayoutChildren();
+}
+
+void DivComponent::AttachView(const Component *child)
+{
+ if (child == nullptr) {
+ return;
+ }
+ nativeView_.Add(child->GetComponentRootView());
+}
+
+void DivComponent::LayoutChildren()
+{
+ nativeView_.LayoutChildren();
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/src/core/components/div_component.h b/frameworks/src/core/components/div_component.h
old mode 100755
new mode 100644
similarity index 75%
rename from src/core/components/div_component.h
rename to frameworks/src/core/components/div_component.h
index 8055685..ec97481
--- a/src/core/components/div_component.h
+++ b/frameworks/src/core/components/div_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,29 +23,23 @@ namespace OHOS {
namespace ACELite {
class DivComponent final : public Component {
public:
- enum LayoutType {
- POSITION,
- FLEX
- };
ACE_DISALLOW_COPY_AND_MOVE(DivComponent);
DivComponent() = delete;
- DivComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager, const LayoutType type);
+ DivComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager);
~DivComponent() override {}
protected:
- bool CreateNativeViews() override;
- void ReleaseNativeViews() override;
UIView *GetComponentRootView() const override;
bool ApplyPrivateStyle(const AppStyleItem* style) override;
bool ProcessChildren() override;
- void PostUpdate(uint16_t attrKeyId, bool updateResult) override;
+ void PostUpdate(uint16_t attrKeyId) override;
+ void AttachView(const Component *child) override;
+ void LayoutChildren() override;
private:
bool isSecondaryAxisAlignSet_;
- const AppStyle* combinedStyle_;
- UIViewGroup* nativeView_;
- LayoutType layoutType_;
+ FlexLayout nativeView_;
};
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/event_listener.cpp b/frameworks/src/core/components/event_listener.cpp
similarity index 67%
rename from src/core/components/event_listener.cpp
rename to frameworks/src/core/components/event_listener.cpp
index e670351..220f1ec 100755
--- a/src/core/components/event_listener.cpp
+++ b/frameworks/src/core/components/event_listener.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -115,51 +115,26 @@ bool ViewOnTouchCancelListener::OnCancel(UIView &view, const CancelEvent &event)
}
#endif // JS_TOUCH_EVENT_SUPPORT
-bool ViewOnSwipeListener::OnDragStart(UIView &view, const DragEvent &event)
+bool ViewOnSwipeListener::OnDragStart(UIView& view, const DragEvent &event)
{
- UNUSED(view);
UNUSED(event);
HILOG_DEBUG(HILOG_MODULE_ACE, "OnDragStart received");
- return true;
+ return isStopPropagation_;
}
-bool ViewOnSwipeListener::OnDragEnd(UIView &view, const DragEvent &event)
+bool ViewOnSwipeListener::OnDragEnd(UIView& view, const DragEvent &event)
{
- UNUSED(view);
- if (jerry_value_is_undefined(fn_)) {
+ if (JSUndefined::Is(fn_)) {
HILOG_ERROR(HILOG_MODULE_ACE, "OnDragEnd received, but no JS function to call");
- return false;
+ return isStopPropagation_;
}
HILOG_DEBUG(HILOG_MODULE_ACE, "OnDragEnd received");
- jerry_value_t directionValue;
- switch (event.GetDragDirection()) {
- case DragEvent::DIRECTION_LEFT_TO_RIGHT:
- directionValue = jerry_create_string(reinterpret_cast(SWIPE_RIGHT));
- break;
- case DragEvent::DIRECTION_RIGHT_TO_LEFT:
- directionValue = jerry_create_string(reinterpret_cast(SWIPE_LEFT));
- break;
- case DragEvent::DIRECTION_TOP_TO_BOTTOM:
- directionValue = jerry_create_string(reinterpret_cast(SWIPE_DOWN));
- break;
- case DragEvent::DIRECTION_BOTTOM_TO_TOP:
- directionValue = jerry_create_string(reinterpret_cast(SWIPE_UP));
- break;
- default:
- directionValue = UNDEFINED;
- break;
- }
+ JSValue arg = EventUtil::CreateSwipeEvent(view, event);
+ EventUtil::InvokeCallback(JSUndefined::Create(), fn_, arg);
- jerry_value_t args[1] = {jerry_create_object()};
- const char * const directionName = "direction";
- jerry_value_t result = jerryx_set_property_str(args[0], directionName, directionValue);
- if (!jerry_value_is_error(result)) {
- CallJSFunctionAutoRelease(fn_, UNDEFINED, args, 1);
- }
- ReleaseJerryValue(result, args[0], directionValue, VA_ARG_END_FLAG);
- return true;
+ return isStopPropagation_;
}
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/event_listener.h b/frameworks/src/core/components/event_listener.h
similarity index 64%
rename from src/core/components/event_listener.h
rename to frameworks/src/core/components/event_listener.h
index 7ff5ecf..78de13a 100755
--- a/src/core/components/event_listener.h
+++ b/frameworks/src/core/components/event_listener.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,6 +16,8 @@
#ifndef OHOS_ACELITE_EVENT_LISTENER_H
#define OHOS_ACELITE_EVENT_LISTENER_H
+#include "ace_log.h"
+#include "event_util.h"
#include "js_fwk_common.h"
#include "keys.h"
#include "non_copyable.h"
@@ -31,43 +33,29 @@ namespace ACELite {
class StateChangeListener final : public UICheckBox::OnChangeListener {
public:
ACE_DISALLOW_COPY_AND_MOVE(StateChangeListener);
- StateChangeListener(jerry_value_t fn, uint16_t componentId)
+ StateChangeListener(jerry_value_t fn)
{
fn_ = jerry_acquire_value(fn);
- componentId_ = componentId;
isChanging_ = false;
- radio_ = nullptr;
- value_ = nullptr;
- state_ = UICheckBox::UICheckBoxState::UNSELECTED;
+ state_ = false;
}
bool OnChange(UICheckBox::UICheckBoxState state) override
{
- if (radio_ != nullptr) {
- state_ = state;
+ bool stateRes = (state == UICheckBox::UICheckBoxState::SELECTED);
+ if (stateRes == state_) {
+ return true;
}
+ state_ = stateRes;
if (isChanging_) {
return false;
}
isChanging_ = true;
jerry_value_t args[1];
- bool result = (UICheckBox::UICheckBoxState::SELECTED == state) ? true : false;
- jerry_value_t resultProp = jerry_create_boolean(result);
+ jerry_value_t resultProp = jerry_create_boolean(state_);
args[0] = jerry_create_object();
const char * const checked = "checked";
ReleaseJerryValue(jerryx_set_property_str(args[0], checked, resultProp), resultProp, VA_ARG_END_FLAG);
- if (radio_ != nullptr) {
- const char * const name = "name";
- if (radio_->GetName() != nullptr) {
- jerry_value_t nameVal = jerry_create_string(reinterpret_cast(radio_->GetName()));
- ReleaseJerryValue(jerryx_set_property_str(args[0], name, nameVal), nameVal, VA_ARG_END_FLAG);
- }
- }
- if (value_ != nullptr) {
- const char * const valueName = "value";
- jerry_value_t valueProp = jerry_create_string(reinterpret_cast(value_));
- ReleaseJerryValue(jerryx_set_property_str(args[0], valueName, valueProp), valueProp, VA_ARG_END_FLAG);
- }
jerry_value_t globalObject = jerry_get_global_object();
jerry_value_t appViewModel = jerryx_get_property_str(globalObject, ATTR_APP);
if (jerry_value_is_function(fn_)) {
@@ -78,37 +66,9 @@ public:
return true;
}
- void TriggerChange(UIView *view)
+ void SetState(bool state)
{
- UICheckBox::UICheckBoxState state = UICheckBox::UICheckBoxState::UNSELECTED;
- if (componentId_ == K_SWITCH) {
- UIToggleButton *toggleButton = reinterpret_cast(view);
- if (toggleButton) {
- state = (toggleButton->GetState()) ? UICheckBox::UICheckBoxState::SELECTED
- : UICheckBox::UICheckBoxState::UNSELECTED;
- }
- } else if (componentId_ == K_CHECKBOX) {
- UICheckBox *checkbox = reinterpret_cast(view);
- if (checkbox) {
- state = checkbox->GetState();
- }
- } else if (radio_ != nullptr) {
- state = radio_->GetState();
- if (state == state_) {
- return;
- }
- }
- OnChange(state);
- }
-
- void SetView(UIRadioButton* radioButton)
- {
- radio_ = radioButton;
- }
-
- void SetValue(char* value)
- {
- value_ = value;
+ state_ = state;
}
~StateChangeListener()
@@ -118,43 +78,37 @@ public:
private:
jerry_value_t fn_;
- uint16_t componentId_;
- char* value_;
- UIRadioButton* radio_;
- UICheckBox::UICheckBoxState state_;
+ bool state_;
bool isChanging_; // the flag to avoid change event cycle execute
};
class ViewOnClickListener final : public UIView::OnClickListener {
public:
ACE_DISALLOW_COPY_AND_MOVE(ViewOnClickListener);
- explicit ViewOnClickListener(jerry_value_t fn, const uint16_t id)
- : fn_(jerry_acquire_value(fn)),
-#ifdef JS_TOUCH_EVENT_SUPPORT
- id_(id),
-#endif
- changeListener_(nullptr) {}
+
+ ViewOnClickListener(jerry_value_t fn, bool isStopPropagation)
+ : changeListener_(nullptr),
+ fn_(jerry_acquire_value(fn)),
+ isStopPropagation_(isStopPropagation) {}
+
~ViewOnClickListener()
{
jerry_release_value(fn_);
}
- bool OnClick(UIView &view, const ClickEvent &event) override
+ bool OnClick(UIView& view, const ClickEvent &event) override
{
if (changeListener_) {
- changeListener_->TriggerChange(&view);
+ UICheckBox *checkbox = reinterpret_cast(&view);
+ changeListener_->OnChange(checkbox->GetState());
}
- if (jerry_value_is_undefined(fn_)) {
- return false;
+ if (JSUndefined::Is(fn_)) {
+ return isStopPropagation_;
}
-#ifdef JS_TOUCH_EVENT_SUPPORT
- jerry_value_t *args = ConvertBaseEventInfo(event, id_);
- jerry_release_value(CallJSFunctionOnRoot(fn_, args, 1));
- ClearEventListener(args, 1);
-#else
- jerry_release_value(CallJSFunctionOnRoot(fn_, nullptr, 0));
-#endif
- return true;
+ JSValue arg = EventUtil::CreateEvent(EventUtil::EVENT_CLICK, view, event);
+ EventUtil::InvokeCallback(JSUndefined::Create(), fn_, arg);
+
+ return isStopPropagation_;
}
void SetComponentListener(StateChangeListener *changeListener)
@@ -163,54 +117,42 @@ public:
}
private:
- jerry_value_t fn_;
-#ifdef JS_TOUCH_EVENT_SUPPORT
- uint16_t id_;
-#endif
StateChangeListener *changeListener_;
+ jerry_value_t fn_;
+ bool isStopPropagation_;
};
class ViewOnLongPressListener final : public UIView::OnLongPressListener {
public:
ACE_DISALLOW_COPY_AND_MOVE(ViewOnLongPressListener);
- explicit ViewOnLongPressListener(jerry_value_t fn, const uint16_t id) :
-#ifdef JS_TOUCH_EVENT_SUPPORT
- id_(id),
-#endif
- fn_(jerry_acquire_value(fn)) {}
+ ViewOnLongPressListener(jerry_value_t fn, bool isStopPropagation)
+ : fn_(jerry_acquire_value(fn)), isStopPropagation_(isStopPropagation) {}
~ViewOnLongPressListener()
{
jerry_release_value(fn_);
}
- bool OnLongPress(UIView &view, const LongPressEvent &event) override
+ bool OnLongPress(UIView& view, const LongPressEvent &event) override
{
if (jerry_value_is_undefined(fn_)) {
- return false;
+ return isStopPropagation_;
}
-#ifdef JS_TOUCH_EVENT_SUPPORT
- jerry_value_t *args = ConvertBaseEventInfo(event, id_);
- jerry_release_value(CallJSFunctionOnRoot(fn_, args, 1));
- ClearEventListener(args, 1);
-#else
- jerry_release_value(CallJSFunctionOnRoot(fn_, nullptr, 0));
-#endif
- return true;
- }
-private:
-#ifdef JS_TOUCH_EVENT_SUPPORT
- uint16_t id_;
-#endif
+ JSValue arg = EventUtil::CreateEvent(EventUtil::EVENT_LONGPRESS, view, event);
+ EventUtil::InvokeCallback(JSUndefined::Create(), fn_, arg);
+
+ return isStopPropagation_;
+ }
jerry_value_t fn_;
+ bool isStopPropagation_;
};
#ifdef JS_TOUCH_EVENT_SUPPORT
class ViewOnTouchStartListener final : public UIView::OnTouchListener {
public:
ACE_DISALLOW_COPY_AND_MOVE(ViewOnTouchStartListener);
- explicit ViewOnTouchStartListener(jerry_value_t fn, const uint16_t id);
+ ViewOnTouchStartListener(jerry_value_t fn, const uint16_t id);
~ViewOnTouchStartListener();
bool OnPress(UIView &view, const PressEvent &event) override;
@@ -258,7 +200,7 @@ private:
class KeyBoardEventListener final : public RootView::OnKeyActListener {
public:
ACE_DISALLOW_COPY_AND_MOVE(KeyBoardEventListener);
- explicit KeyBoardEventListener(jerry_value_t fn, const uint16_t id);
+ KeyBoardEventListener(jerry_value_t fn, const uint16_t id);
~KeyBoardEventListener();
bool OnKeyAct(UIView &view, const KeyEvent &event) override;
@@ -271,10 +213,9 @@ private:
class ViewOnSwipeListener final : public UIView::OnDragListener {
public:
ACE_DISALLOW_COPY_AND_MOVE(ViewOnSwipeListener);
- explicit ViewOnSwipeListener(jerry_value_t fn)
- : SWIPE_LEFT("left"), SWIPE_RIGHT("right"), SWIPE_UP("up"), SWIPE_DOWN("down")
+ ViewOnSwipeListener(jerry_value_t fn, bool isStopPropagation)
+ : fn_(jerry_acquire_value(fn)), isStopPropagation_(isStopPropagation)
{
- fn_ = jerry_acquire_value(fn);
}
~ViewOnSwipeListener()
@@ -283,14 +224,11 @@ public:
}
bool OnDragStart(UIView& view, const DragEvent& event) override;
- bool OnDragEnd(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView& view, const DragEvent &event) override;
private:
jerry_value_t fn_;
- const char * const SWIPE_LEFT;
- const char * const SWIPE_RIGHT;
- const char * const SWIPE_UP;
- const char * const SWIPE_DOWN;
+ bool isStopPropagation_;
};
class SliderEventListener final : public UISlider::UISliderEventListener {
@@ -301,17 +239,18 @@ public:
{
jerry_release_value(bindChangeFunc_);
}
- void OnChange(int16_t progress) override
+ void OnChange(int32_t progress) override
{
jerry_value_t knobValue = jerry_create_number(progress);
jerry_value_t args[1];
args[0] = jerry_create_object();
- constexpr char sliderAttrProgress[] = "progress";
- jerry_value_t result = jerryx_set_property_str(args[0], sliderAttrProgress, knobValue);
- if (!jerry_value_is_error(result)) {
+ jerry_value_t result1 = jerryx_set_property_str(args[0], "value", knobValue);
+ // progress will be deprecated in next versions.
+ jerry_value_t result2 = jerryx_set_property_str(args[0], "progress", knobValue);
+ if (!jerry_value_is_error(result1) && !jerry_value_is_error(result2)) {
CallJSFunctionAutoRelease(bindChangeFunc_, UNDEFINED, args, 1);
}
- ReleaseJerryValue(result, args[0], knobValue, VA_ARG_END_FLAG);
+ ReleaseJerryValue(result1, result2, args[0], knobValue, VA_ARG_END_FLAG);
}
void SetBindChangeFuncName(jerry_value_t bindChageFunc)
diff --git a/frameworks/src/core/components/horizon_progress_component.cpp b/frameworks/src/core/components/horizon_progress_component.cpp
new file mode 100644
index 0000000..f55d54e
--- /dev/null
+++ b/frameworks/src/core/components/horizon_progress_component.cpp
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "horizon_progress_component.h"
+
+namespace OHOS {
+namespace ACELite {
+HorizonProgressComponent::HorizonProgressComponent(jerry_value_t options,
+ jerry_value_t children, AppStyleManager *styleManager)
+ : Component(options, children, styleManager),
+ hStrokeWidth_(0)
+{
+}
+
+bool HorizonProgressComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
+{
+ if (attrKeyId == K_PERCENT) {
+ int16_t rangeMax = 100;
+ int16_t rangeMin = 0;
+ progressView_.SetRange(rangeMax, rangeMin);
+ progressView_.SetValue(IntegerOf(attrValue));
+ return true;
+ }
+
+ return false;
+}
+
+bool HorizonProgressComponent::ApplyPrivateStyle(const AppStyleItem *style)
+{
+ return SetHorizonProgressStyle(style);
+}
+
+bool HorizonProgressComponent::CreateNativeViews()
+{
+ // set default style for progress & background
+ Style progressStyle = StyleDefault::GetBrightColorStyle();
+ Style backStyle = StyleDefault::GetBrightStyle();
+ progressView_.SetForegroundStyle(progressStyle);
+ progressView_.SetBackgroundStyle(backStyle);
+
+ // set default progress self border width
+ progressView_.SetForegroundStyle(STYLE_BORDER_WIDTH, 0);
+ progressView_.SetBackgroundStyle(STYLE_BORDER_WIDTH, 0);
+ const double alpha = 0.15;
+ progressView_.SetBackgroundStyle(STYLE_BACKGROUND_COLOR,
+ Color::GetColorFromRGBA(0xFF, 0xFF, 0xFF, alpha * 0xFF).full);
+ // set defaut progress stroke width & canvas width & canvas height & border width
+ const int16_t width = 4;
+ hStrokeWidth_ = width;
+ return true;
+}
+
+
+UIView *HorizonProgressComponent::GetComponentRootView() const
+{
+ return const_cast(&progressView_);
+}
+
+bool HorizonProgressComponent::SetHorizonProgressStyle(const AppStyleItem *style)
+{
+ uint16_t stylePropNameId = GetStylePropNameId(style);
+
+ switch (stylePropNameId) {
+ // Get stroke width.
+ case K_STROKE_WIDTH: {
+ hStrokeWidth_ = GetStylePixelValue(style);
+ break;
+ }
+ // Set horizon progress style: color.
+ case K_COLOR: {
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ if (!GetStyleColorValue(style, color, alpha)) {
+ return false;
+ }
+ progressView_.SetForegroundStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
+ progressView_.SetForegroundStyle(STYLE_BACKGROUND_OPA, alpha);
+ break;
+ }
+ case K_BACKGROUND_COLOR: {
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ if (!GetStyleColorValue(style, color, alpha)) {
+ return false;
+ }
+ progressView_.SetBackgroundStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
+ progressView_.SetBackgroundStyle(STYLE_BACKGROUND_OPA, alpha);
+ break;
+ }
+ default: {
+ return false;
+ }
+ }
+ return true;
+}
+
+void HorizonProgressComponent::OnViewAttached()
+{
+ HandleExtraUpdate();
+}
+
+void HorizonProgressComponent::PostUpdate(uint16_t attrKeyId)
+{
+ UNUSED(attrKeyId);
+ HandleExtraUpdate();
+}
+
+void HorizonProgressComponent::HandleExtraUpdate()
+{
+ // set width & height of progress
+ if (progressView_.GetWidth() < 0) {
+ progressView_.SetValidWidth(0);
+ } else {
+ progressView_.SetValidWidth(progressView_.GetWidth());
+ }
+ progressView_.SetValidHeight(hStrokeWidth_);
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/components/horizon_progress_component.h b/frameworks/src/core/components/horizon_progress_component.h
new file mode 100644
index 0000000..774160e
--- /dev/null
+++ b/frameworks/src/core/components/horizon_progress_component.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_HORIZON_PROGRESS_COMPONENT_H
+#define OHOS_ACELITE_HORIZON_PROGRESS_COMPONENT_H
+
+#include "component.h"
+#include "non_copyable.h"
+#include "ui_abstract_progress.h"
+
+namespace OHOS {
+namespace ACELite {
+class HorizonProgressComponent final : public Component {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(HorizonProgressComponent);
+ HorizonProgressComponent() = delete;
+ HorizonProgressComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager);
+ ~HorizonProgressComponent() override {}
+
+protected:
+ UIView *GetComponentRootView() const override;
+ bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
+ bool ApplyPrivateStyle(const AppStyleItem* style) override;
+ void PostUpdate(uint16_t attrKeyId) override;
+ void OnViewAttached() override;
+ void HandleExtraUpdate();
+ bool CreateNativeViews() override;
+
+private:
+ bool SetHorizonProgressStyle(const AppStyleItem* style);
+ UIBoxProgress progressView_;
+ int16_t hStrokeWidth_;
+};
+} // namespace ACELite
+} // namespace OHOS
+
+#endif // OHOS_ACELITE_HORIZON_PROGRESS_COMPONENT_H
diff --git a/src/core/components/image_animator_component.cpp b/frameworks/src/core/components/image_animator_component.cpp
similarity index 86%
rename from src/core/components/image_animator_component.cpp
rename to frameworks/src/core/components/image_animator_component.cpp
index f06c194..6eacce0 100755
--- a/src/core/components/image_animator_component.cpp
+++ b/frameworks/src/core/components/image_animator_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -30,6 +30,8 @@ constexpr char FUNC_GET_STATE[] = "getState";
constexpr char STATUS_PLAYING[] = "playing";
constexpr char STATUS_PAUSED[] = "paused";
constexpr char STATUS_STOPED[] = "stopped";
+constexpr char FILL_MODE_FORWRADS[] = "forwards";
+constexpr char FILL_MODE_NONE[] = "none";
ImageAnimatorComponent::ImageAnimatorComponent(jerry_value_t options,
jerry_value_t children,
@@ -53,13 +55,12 @@ ImageAnimatorComponent::ImageAnimatorComponent(jerry_value_t options,
bool ImageAnimatorComponent::CreateNativeViews()
{
viewGroup_ = new UIViewGroup();
-
if (viewGroup_ == nullptr) {
return false;
}
viewGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
- imageAnimator_ = new UIImageAnimatorView();
+ imageAnimator_ = new UIImageAnimatorView();
if (imageAnimator_ == nullptr) {
delete (viewGroup_);
viewGroup_ = nullptr;
@@ -82,6 +83,19 @@ void ImageAnimatorComponent::ReleaseNativeViews()
ACE_DELETE(onStopListener_);
}
+void ImageAnimatorComponent::SetViewExtraMsg()
+{
+ jerry_value_t *elementPtr = GetDomElementPointer();
+ UIView::ViewExtraMsg *extraMsg = new UIView::ViewExtraMsg();
+ if (extraMsg == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Failed to mapping native view with DOM element.");
+ return;
+ }
+ extraMsg->elementPtr = (void *)elementPtr;
+ viewGroup_->SetExtraMsg(extraMsg);
+ imageAnimator_->SetExtraMsg(extraMsg);
+}
+
inline UIView *ImageAnimatorComponent::GetComponentRootView() const
{
return viewGroup_;
@@ -90,6 +104,8 @@ inline UIView *ImageAnimatorComponent::GetComponentRootView() const
bool ImageAnimatorComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
{
switch (attrKeyId) {
+ case K_FILL_MODE:
+ return ParseToFillMode(attrValue);
case K_FIXED_SIZE:
return ParseToFixedSize(attrValue);
case K_IMAGES:
@@ -110,14 +126,16 @@ void ImageAnimatorComponent::PostRender()
UpdateAnimator();
}
-void ImageAnimatorComponent::PostUpdate(uint16_t attrKeyId, bool updateResult)
+void ImageAnimatorComponent::PostUpdate(uint16_t attrKeyId)
{
if ((K_IMAGES == attrKeyId) || (K_DURATION == attrKeyId)) {
UpdateAnimator();
}
}
-bool ImageAnimatorComponent::RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
+bool ImageAnimatorComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation)
{
if (eventTypeId == K_STOP) {
onStopListener_ = new ImageAnimatorStopListener(funcValue);
@@ -132,6 +150,26 @@ bool ImageAnimatorComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
return false;
}
+bool ImageAnimatorComponent::ParseToFillMode(jerry_value_t value) const
+{
+ uint16_t size = 0;
+ char *fillMode = MallocStringOf(value, &size);
+ if (size == 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "fillmode is null or empty.");
+ ACE_FREE(fillMode);
+ return false;
+ }
+ if (!strcmp(fillMode, FILL_MODE_NONE)) {
+ imageAnimator_->SetFillMode(false);
+ } else if (!strcmp(fillMode, FILL_MODE_FORWRADS)) {
+ imageAnimator_->SetFillMode(true);
+ } else {
+ HILOG_ERROR(HILOG_MODULE_ACE, "fillmode is invalid.");
+ }
+ ACE_FREE(fillMode);
+ return true;
+}
+
bool ImageAnimatorComponent::ParseToFixedSize(jerry_value_t value) const
{
if (!jerry_value_is_boolean(value)) {
@@ -150,9 +188,9 @@ void ImageAnimatorComponent::ReleaseFrame()
for (uint8_t idx = 0; idx < framesSize_; ++idx) {
ImageAnimatorInfo frame = frames_[idx];
- if (frame.imageInfo != nullptr) {
- ace_free(const_cast(frame.imageInfo));
- frame.imageInfo = nullptr;
+ if (frame.imagePath != nullptr) {
+ ace_free(const_cast(frame.imagePath));
+ frame.imagePath = nullptr;
}
}
ACE_FREE(frames_);
@@ -194,7 +232,7 @@ bool ImageAnimatorComponent::ParseToFrames(jerry_value_t value)
}
ImageAnimatorInfo frame = {0};
- frame.imageInfo = ParseImageSrc(src);
+ frame.imagePath = ParseImageSrc(src);
jerry_release_value(src);
frame.width = JerryGetIntegerProperty(image, ATTR_WIDTH);
frame.height = JerryGetIntegerProperty(image, ATTR_HEIGHT);
@@ -202,6 +240,7 @@ bool ImageAnimatorComponent::ParseToFrames(jerry_value_t value)
point.x = JerryGetIntegerProperty(image, ATTR_LEFT);
point.y = JerryGetIntegerProperty(image, ATTR_TOP);
frame.pos = point;
+ frame.imageType = IMG_SRC_FILE_PATH;
jerry_release_value(image);
frames_[idx] = frame;
}
@@ -255,7 +294,7 @@ bool ImageAnimatorComponent::ParseToDuration(jerry_value_t value)
void ImageAnimatorComponent::UpdateAnimator() const
{
if (frames_ != nullptr && framesSize_ != 0 && duration_ != nullptr) {
- imageAnimator_->SetImageAnimatorSrc(reinterpret_cast(frames_), framesSize_);
+ imageAnimator_->SetImageAnimatorSrc(frames_, framesSize_);
int32_t millions = ParseToMilliseconds(duration_);
uint16_t timeOfUpdate = 0;
@@ -275,6 +314,7 @@ jerry_value_t ImageAnimatorComponent::StartAnimator(const jerry_value_t func,
const jerry_value_t args[],
const jerry_length_t size)
{
+ UNUSED(func);
ImageAnimatorComponent *component =
static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
if (component == nullptr) {
@@ -294,6 +334,7 @@ jerry_value_t ImageAnimatorComponent::PauseAnimator(const jerry_value_t func,
const jerry_value_t args[],
const jerry_length_t size)
{
+ UNUSED(func);
ImageAnimatorComponent *component =
static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
if (component == nullptr) {
@@ -313,6 +354,7 @@ jerry_value_t ImageAnimatorComponent::ResumeAnimator(const jerry_value_t func,
const jerry_value_t args[],
const jerry_length_t size)
{
+ UNUSED(func);
ImageAnimatorComponent *component =
static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
if (component == nullptr) {
@@ -332,6 +374,7 @@ jerry_value_t ImageAnimatorComponent::StopAnimator(const jerry_value_t func,
const jerry_value_t args[],
const jerry_length_t size)
{
+ UNUSED(func);
ImageAnimatorComponent *component =
static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
if (component == nullptr) {
@@ -352,6 +395,7 @@ jerry_value_t ImageAnimatorComponent::GetAnimatorState(const jerry_value_t func,
const jerry_value_t args[],
const jerry_length_t size)
{
+ UNUSED(func);
ImageAnimatorComponent *component =
static_cast(ComponentUtils::GetComponentFromBindingObject(dom));
if (component == nullptr) {
diff --git a/src/core/components/image_animator_component.h b/frameworks/src/core/components/image_animator_component.h
old mode 100755
new mode 100644
similarity index 94%
rename from src/core/components/image_animator_component.h
rename to frameworks/src/core/components/image_animator_component.h
index 3926576..a571d15
--- a/src/core/components/image_animator_component.h
+++ b/frameworks/src/core/components/image_animator_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -58,14 +58,16 @@ public:
protected:
bool CreateNativeViews() override;
void ReleaseNativeViews() override;
+ void SetViewExtraMsg() override;
UIView *GetComponentRootView() const override;
bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
void PostRender() override;
- void PostUpdate(uint16_t attrKeyId, bool updateResult) override;
- bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue) override;
+ void PostUpdate(uint16_t attrKeyId) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override;
private:
void ReleaseFrame();
+ bool ParseToFillMode(jerry_value_t value) const;
bool ParseToFixedSize(jerry_value_t value) const;
bool ParseToFrames(jerry_value_t value);
bool ParseToIteration(jerry_value_t value) const;
diff --git a/src/core/components/image_component.cpp b/frameworks/src/core/components/image_component.cpp
old mode 100755
new mode 100644
similarity index 62%
rename from src/core/components/image_component.cpp
rename to frameworks/src/core/components/image_component.cpp
index 9542ba0..244e550
--- a/src/core/components/image_component.cpp
+++ b/frameworks/src/core/components/image_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -24,37 +24,23 @@
namespace OHOS {
namespace ACELite {
ImageComponent::ImageComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager)
- : Component(options, children, styleManager), imageView_(nullptr)
+ : Component(options, children, styleManager)
{
SetComponentName(K_IMAGE);
}
bool ImageComponent::CreateNativeViews()
{
- imageView_ = new UIImageView();
-
- if (imageView_ == nullptr) {
- return false;
- } else {
- // set default value
- imageView_->SetAutoEnable(false);
- const int16_t defaultOpacity = 0;
- imageView_->SetStyle(STYLE_BACKGROUND_OPA, defaultOpacity);
- }
+ // set default value
+ imageView_.SetAutoEnable(false);
+ const int16_t defaultOpacity = 0;
+ imageView_.SetStyle(STYLE_BACKGROUND_OPA, defaultOpacity);
return true;
}
-void ImageComponent::ReleaseNativeViews()
-{
- if (imageView_) {
- delete imageView_;
- imageView_ = nullptr;
- }
-}
-
inline UIView *ImageComponent::GetComponentRootView() const
{
- return imageView_;
+ return const_cast(&imageView_);
}
bool ImageComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
@@ -63,7 +49,7 @@ bool ImageComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrV
switch (attrKeyId) {
case K_SRC: {
char *src = const_cast(ParseImageSrc(attrValue));
- imageView_->SetSrc(src);
+ imageView_.SetSrc(src);
ACE_FREE(src);
break;
}
@@ -74,18 +60,5 @@ bool ImageComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrV
return setResult;
}
-
-bool ImageComponent::ApplyPrivateStyle(const AppStyleItem *style)
-{
- uint16_t styleKey = style->GetPropNameId();
- switch (styleKey) {
- case K_OPACITY: {
- SetOpacity(*imageView_, *style);
- return true;
- }
- default:
- return false;
- }
-}
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/image_component.h b/frameworks/src/core/components/image_component.h
old mode 100755
new mode 100644
similarity index 88%
rename from src/core/components/image_component.h
rename to frameworks/src/core/components/image_component.h
index 3f1e2ee..7fe8633
--- a/src/core/components/image_component.h
+++ b/frameworks/src/core/components/image_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,13 +33,11 @@ public:
protected:
bool CreateNativeViews() override;
- void ReleaseNativeViews() override;
UIView *GetComponentRootView() const override;
bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
- bool ApplyPrivateStyle(const AppStyleItem *style) override;
private:
- UIImageView *imageView_;
+ UIImageView imageView_;
};
} // namespace ACELite
} // namespace OHOS
diff --git a/frameworks/src/core/components/input_button_component.cpp b/frameworks/src/core/components/input_button_component.cpp
new file mode 100755
index 0000000..6172a98
--- /dev/null
+++ b/frameworks/src/core/components/input_button_component.cpp
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "input_button_component.h"
+#include "ace_log.h"
+#include "ace_mem_base.h"
+#include "font/ui_font_header.h"
+#include "js_app_context.h"
+#include "js_fwk_common.h"
+#include "key_parser.h"
+#include "keys.h"
+#include "product_adapter.h"
+#include "ui_button.h"
+
+namespace OHOS {
+namespace ACELite {
+bool InputButtonComponent::CreateNativeViews()
+{
+ fontSize_ = ProductAdapter::GetDefaultFontSize();
+ // set font family
+ if (!CopyFontFamily(fontFamily_, ProductAdapter::GetDefaultFontFamilyName())) {
+ return false;
+ }
+ const uint8_t defaultWidth = 100;
+ const uint8_t defaultHeight = 50;
+ button_.SetWidth(defaultWidth);
+ button_.SetHeight(defaultHeight);
+ button_.SetStateForStyle(UIButton::ButtonState::PRESSED);
+ button_.SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+ button_.SetStateForStyle(UIButton::ButtonState::RELEASED);
+ button_.SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+ return true;
+}
+
+void InputButtonComponent::ReleaseNativeViews()
+{
+ if (clickListener_ != nullptr) {
+ delete clickListener_;
+ clickListener_ = nullptr;
+ }
+ ACE_FREE(textValue_);
+ ACE_FREE(fontFamily_);
+ ACE_FREE(normalBackGroundImg_);
+ ACE_FREE(pressedBackGroundImg_);
+}
+bool InputButtonComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
+{
+ switch (attrKeyId) {
+ case K_VALUE:
+ ACE_FREE(textValue_);
+ textValue_ = MallocStringOf(attrValue);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool InputButtonComponent::ApplyPrivateStyle(const AppStyleItem *style)
+{
+ bool result = true;
+ uint16_t styleKey = GetStylePropNameId(style);
+ switch (styleKey) {
+ case K_FONT_SIZE:
+ result = SetFontSize(style);
+ break;
+ case K_FONT_FAMILY:
+ if (IsStyleValueTypeString(style)) {
+ // the style would be freed after this method
+ result = CopyFontFamily(fontFamily_, GetStyleStrValue(style));
+ } else {
+ result = false;
+ }
+ break;
+ case K_TEXT_ALIGN:
+ result = SetTextAlign(style);
+ break;
+ case K_COLOR:
+ result = SetColor(*style);
+ break;
+ case K_BACKGROUND_COLOR:
+ result = SetBackgroundColor(*style);
+ break;
+ case K_BACKGROUND_IMAGE:
+ result = HandleBackgroundImg(*style, pressedBackGroundImg_, normalBackGroundImg_);
+ break;
+ case K_PADDING:
+ // fall through
+ case K_PADDING_BOTTOM:
+ // fall through
+ case K_PADDING_LEFT:
+ // fall through
+ case K_PADDING_RIGHT:
+ // fall through
+ case K_PADDING_TOP:
+ // fall through
+ case K_BORDER_BOTTOM_WIDTH:
+ // fall through
+ case K_BORDER_LEFT_WIDTH:
+ // fall through
+ case K_BORDER_RIGHT_WIDTH:
+ // fall through
+ case K_BORDER_TOP_WIDTH:
+ // fall through
+ case K_BORDER_WIDTH:
+ // fall through
+ case K_BORDER_BOTTOM_COLOR:
+ // fall through
+ case K_BORDER_LEFT_COLOR:
+ // fall through
+ case K_BORDER_RIGHT_COLOR:
+ // fall through
+ case K_BORDER_TOP_COLOR:
+ // fall through
+ case K_BORDER_COLOR:
+ // fall through
+ case K_BORDER_RADIUS: {
+ button_.SetStateForStyle(UIButton::ButtonState::PRESSED);
+ bool pressResult = ApplyCommonStyle(button_, style);
+ button_.SetStateForStyle(UIButton::ButtonState::RELEASED);
+ bool releaseResult = ApplyCommonStyle(button_, style);
+ result = pressResult && releaseResult;
+ break;
+ }
+ default:
+ result = false;
+ break;
+ }
+ return result;
+}
+
+bool InputButtonComponent::SetBackgroundColor(const AppStyleItem &style)
+{
+ if (style.GetPseudoClassType() != PSEUDO_CLASS_ACTIVE) {
+ // let parent handle the normal state background color style,
+ // will be set for released state style of ui button
+ button_.SetStateForStyle(UIButton::ButtonState::PRESSED);
+ Component::SetBackgroundColor(button_, style);
+ button_.SetStateForStyle(UIButton::ButtonState::RELEASED);
+ Component::SetBackgroundColor(button_, style);
+ return true;
+ }
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ if (!GetStyleColorValue(&style, color, alpha)) {
+ return false;
+ }
+ pressedBackGroundColorValue_ = color;
+ pressedOpacityValue_ = alpha;
+ return true;
+}
+
+bool InputButtonComponent::SetColor(const AppStyleItem &style)
+{
+ uint32_t color = 0;
+ uint8_t alpha = OPA_OPAQUE;
+ if (GetStyleColorValue(&style, color, alpha)) {
+ button_.SetLabelStyle(STYLE_TEXT_COLOR, GetRGBColor(color).full);
+ button_.SetLabelStyle(STYLE_TEXT_OPA, alpha);
+ return true;
+ }
+ return false;
+}
+
+bool InputButtonComponent::SetTextAlign(const AppStyleItem *style)
+{
+ if ((!IsStyleValueTypeString(style)) || (!GetStyleStrValue(style))) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "the type of style align is error");
+ return false;
+ }
+ uint16_t valueId = KeyParser::ParseKeyId(GetStyleStrValue(style), GetStyleStrValueLen(style));
+ switch (valueId) {
+ case K_LEFT:
+ button_.SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT);
+ return true;
+ case K_CENTER:
+ button_.SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER);
+ return true;
+ case K_RIGHT:
+ button_.SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_RIGHT);
+ return true;
+ default:
+ HILOG_ERROR(HILOG_MODULE_ACE, "the value of text-align in input component is error");
+ return false;
+ }
+}
+
+bool InputButtonComponent::SetFontSize(const AppStyleItem *style)
+{
+ fontSize_ = GetStylePixelValue(style);
+ return true;
+}
+void InputButtonComponent::PostRender()
+{
+ if (textValue_ != nullptr && fontFamily_ != nullptr) {
+ button_.SetFont(fontFamily_, fontSize_);
+ button_.SetText(textValue_);
+ }
+ if (clickListener_ != nullptr) {
+ button_.SetOnClickListener(clickListener_);
+ }
+ if (pressedBackGroundColorValue_ >= 0) {
+ button_.SetStateForStyle(UIButton::ButtonState::PRESSED);
+ button_.SetStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(pressedBackGroundColorValue_).full);
+ button_.SetStyle(STYLE_BACKGROUND_OPA, pressedOpacityValue_);
+ }
+ if (normalBackGroundImg_ != nullptr || pressedBackGroundImg_ != nullptr) {
+ // make sure the normal and pressed image same in case user only set one of them
+ char *normalImg = (normalBackGroundImg_ == nullptr) ? pressedBackGroundImg_ : normalBackGroundImg_;
+ char *pressedImg = (pressedBackGroundImg_ == nullptr) ? normalBackGroundImg_ : pressedBackGroundImg_;
+ button_.SetImageSrc(normalImg, pressedImg);
+ }
+ ACE_FREE(normalBackGroundImg_);
+ ACE_FREE(pressedBackGroundImg_);
+}
+
+void InputButtonComponent::PostUpdate(uint16_t attrKeyId)
+{
+ if (!KeyParser::IsKeyValid(attrKeyId)) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "input component post update check args failed");
+ return;
+ }
+ switch (attrKeyId) {
+ case K_VALUE:
+ if (textValue_ != nullptr) {
+ button_.SetText(textValue_);
+ }
+ break;
+ case K_FONT_SIZE:
+ case K_FONT_FAMILY:
+ if (fontFamily_ != nullptr) {
+ button_.SetFont(fontFamily_, fontSize_);
+ }
+ break;
+ default:
+ break;
+ }
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/src/core/components/input_component.h b/frameworks/src/core/components/input_button_component.h
similarity index 61%
rename from src/core/components/input_component.h
rename to frameworks/src/core/components/input_button_component.h
index 6030319..6c39371 100755
--- a/src/core/components/input_component.h
+++ b/frameworks/src/core/components/input_button_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -12,28 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef OHOS_ACELITE_INPUT_COMPONENT_H
-#define OHOS_ACELITE_INPUT_COMPONENT_H
+#ifndef OHOS_ACELITE_INPUT_BUTTON_COMPONENT_H
+#define OHOS_ACELITE_INPUT_BUTTON_COMPONENT_H
#include "component.h"
#include "key_parser.h"
#include "non_copyable.h"
-#include "ui_checkbox.h"
#include "ui_label_button.h"
-#include "ui_radio_button.h"
namespace OHOS {
namespace ACELite {
-class InputComponent final : public Component {
+class InputButtonComponent final : public Component {
public:
- ACE_DISALLOW_COPY_AND_MOVE(InputComponent);
- InputComponent() = delete;
- InputComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager)
+ ACE_DISALLOW_COPY_AND_MOVE(InputButtonComponent);
+ InputButtonComponent() = delete;
+ InputButtonComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager)
: Component(options, children, manager),
options_(options),
- checkbox_(nullptr),
- button_(nullptr),
- radioButton_(nullptr),
- changeListener_(nullptr),
clickListener_(nullptr),
pressedBackGroundColorValue_(-1),
normalBackGroundImg_(nullptr),
@@ -46,41 +40,29 @@ public:
pressedOpacityValue_ = pressedOpacityValue;
SetComponentName(K_INPUT);
}
- ~InputComponent() override {}
+ ~InputButtonComponent() override {};
bool CreateNativeViews() override;
void ReleaseNativeViews() override;
bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
- bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue) override;
bool ApplyPrivateStyle(const AppStyleItem *style) override;
void PostRender() override;
- void PostUpdate(uint16_t attrKeyId, bool updateResult) override;
+ void PostUpdate(uint16_t attrKeyId) override;
protected:
UIView *GetComponentRootView() const override
{
- if (checkbox_ != nullptr) {
- return checkbox_;
- } else if (radioButton_ != nullptr) {
- return radioButton_;
- } else {
- return button_;
- }
+ return const_cast(&button_);
}
private:
- bool SetTextAlign(const AppStyleItem *style) const;
+ bool SetTextAlign(const AppStyleItem *style);
bool SetFontSize(const AppStyleItem *style);
- bool HandleButtonBackGroundImg(const AppStyleItem &styleItem);
void DealEvent();
- void CreateCheckboxOrRadio();
bool SetBackgroundColor(const AppStyleItem &style);
- bool SetColor(const AppStyleItem &style) const;
+ bool SetColor(const AppStyleItem &style);
bool HandleImage(const AppStyleItem &style);
jerry_value_t options_;
- UICheckBox *checkbox_;
- UILabelButton *button_;
- UIRadioButton *radioButton_;
- StateChangeListener *changeListener_;
+ UILabelButton button_;
ViewOnClickListener *clickListener_;
int32_t pressedBackGroundColorValue_;
uint8_t pressedOpacityValue_;
@@ -92,4 +74,4 @@ private:
};
} // namespace ACELite
} // namespace OHOS
-#endif // OHOS_ACELITE_INPUT_COMPONENT_H
+#endif // OHOS_ACELITE_INPUT_BUTTON_COMPONENT_H
diff --git a/frameworks/src/core/components/input_checkbox_component.cpp b/frameworks/src/core/components/input_checkbox_component.cpp
new file mode 100755
index 0000000..f4021ca
--- /dev/null
+++ b/frameworks/src/core/components/input_checkbox_component.cpp
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "input_checkbox_component.h"
+#include "ace_log.h"
+#include "ace_mem_base.h"
+#include "js_app_context.h"
+#include "js_fwk_common.h"
+#include "key_parser.h"
+#include "keys.h"
+
+namespace OHOS {
+namespace ACELite {
+InputCheckboxComponent::~InputCheckboxComponent()
+{
+ if (changeListener_ != nullptr) {
+ delete changeListener_;
+ changeListener_ = nullptr;
+ }
+ if (clickListener_ != nullptr) {
+ delete clickListener_;
+ clickListener_ = nullptr;
+ }
+ ACE_FREE(normalBackGroundImg_);
+ ACE_FREE(pressedBackGroundImg_);
+}
+
+bool InputCheckboxComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
+{
+ switch (attrKeyId) {
+ case K_CHECKED:
+ // set the state of checkbox and radioButton
+ if (jerry_value_is_boolean(attrValue)) {
+ bool checked = jerry_get_boolean_value(attrValue);
+ UICheckBox::UICheckBoxState state =
+ checked ? UICheckBox::UICheckBoxState::SELECTED : UICheckBox::UICheckBoxState::UNSELECTED;
+ checkbox_.SetState(state);
+ return true;
+ }
+ HILOG_ERROR(HILOG_MODULE_ACE, "the checkbox checked is error value");
+ return false;
+ default:
+ return false;
+ }
+}
+
+bool InputCheckboxComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation)
+{
+ if (eventTypeId == K_CHANGE) {
+ changeListener_ = new StateChangeListener(funcValue);
+ if (changeListener_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "create change listener failed");
+ return false;
+ }
+ return true;
+ }
+ if (eventTypeId == K_CLICK) {
+ clickListener_ = new ViewOnClickListener(funcValue, isStopPropagation);
+ if (clickListener_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "create click listener failed");
+ return false;
+ }
+ return true;
+ }
+ HILOG_DEBUG(HILOG_MODULE_ACE, "go to common click event");
+ return false;
+}
+
+bool InputCheckboxComponent::ApplyPrivateStyle(const AppStyleItem *style)
+{
+ uint16_t styleKey = GetStylePropNameId(style);
+ if (styleKey == K_BACKGROUND_IMAGE) {
+ return HandleBackgroundImg(*style, pressedBackGroundImg_, normalBackGroundImg_);
+ }
+
+ return false;
+}
+
+void InputCheckboxComponent::PostRender()
+{
+ DealEvent();
+ ACE_FREE(normalBackGroundImg_);
+ ACE_FREE(pressedBackGroundImg_);
+}
+
+void InputCheckboxComponent::DealEvent()
+{
+ if (changeListener_ != nullptr) {
+ bool state = (checkbox_.GetState() == UICheckBox::UICheckBoxState::SELECTED);
+ changeListener_->SetState(state);
+ checkbox_.SetOnChangeListener(changeListener_);
+ if (clickListener_ == nullptr) {
+ // trigger changeEvent
+ clickListener_ = new ViewOnClickListener(UNDEFINED, true);
+ if (clickListener_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "create click listener failed");
+ return;
+ }
+ }
+ clickListener_->SetComponentListener(changeListener_);
+ checkbox_.SetOnClickListener(clickListener_);
+ }
+
+ if (normalBackGroundImg_ != nullptr || pressedBackGroundImg_ != nullptr) {
+ // make sure the normal and pressed image same in case user only set one of them
+ char *normalImg = (normalBackGroundImg_ == nullptr) ? pressedBackGroundImg_ : normalBackGroundImg_;
+ char *pressedImg = (pressedBackGroundImg_ == nullptr) ? normalBackGroundImg_ : pressedBackGroundImg_;
+ checkbox_.SetImages(pressedImg, normalImg);
+ }
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/components/input_checkbox_component.h b/frameworks/src/core/components/input_checkbox_component.h
new file mode 100755
index 0000000..493041e
--- /dev/null
+++ b/frameworks/src/core/components/input_checkbox_component.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef OHOS_ACELITE_INPUT_CHECKBOX_COMPONENT_H
+#define OHOS_ACELITE_INPUT_CHECKBOX_COMPONENT_H
+#include "component.h"
+#include "key_parser.h"
+#include "non_copyable.h"
+#include "ui_checkbox.h"
+
+namespace OHOS {
+namespace ACELite {
+class InputCheckboxComponent final : public Component {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(InputCheckboxComponent);
+ InputCheckboxComponent() = delete;
+ InputCheckboxComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager)
+ : Component(options, children, manager),
+ changeListener_(nullptr),
+ clickListener_(nullptr),
+ normalBackGroundImg_(nullptr),
+ pressedBackGroundImg_(nullptr)
+ {
+ SetComponentName(K_INPUT);
+ }
+ ~InputCheckboxComponent() override;
+ bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override;
+ bool ApplyPrivateStyle(const AppStyleItem *style) override;
+ void PostRender() override;
+
+protected:
+ UIView *GetComponentRootView() const override
+ {
+ return const_cast(&checkbox_);
+ }
+
+private:
+ void DealEvent();
+ UICheckBox checkbox_;
+ StateChangeListener *changeListener_;
+ ViewOnClickListener *clickListener_;
+ char *normalBackGroundImg_;
+ char *pressedBackGroundImg_;
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // OHOS_ACELITE_INPUT_CHECKBOX_COMPONENT_H
diff --git a/frameworks/src/core/components/input_radio_component.cpp b/frameworks/src/core/components/input_radio_component.cpp
new file mode 100755
index 0000000..ef5e64e
--- /dev/null
+++ b/frameworks/src/core/components/input_radio_component.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "input_radio_component.h"
+#include "ace_log.h"
+#include "ace_mem_base.h"
+#include "js_app_context.h"
+#include "js_fwk_common.h"
+#include "key_parser.h"
+#include "keys.h"
+
+
+namespace OHOS {
+namespace ACELite {
+void InputRadioComponent::ReleaseNativeViews()
+{
+ if (changeListener_ != nullptr) {
+ delete changeListener_;
+ changeListener_ = nullptr;
+ }
+ if (clickListener_ != nullptr) {
+ delete clickListener_;
+ clickListener_ = nullptr;
+ }
+ ACE_FREE(normalBackGroundImg_);
+ ACE_FREE(pressedBackGroundImg_);
+}
+bool InputRadioComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
+{
+ switch (attrKeyId) {
+ case K_CHECKED: {
+ if (jerry_value_is_boolean(attrValue)) {
+ bool checked = jerry_get_boolean_value(attrValue);
+ UICheckBox::UICheckBoxState state =
+ checked ? UICheckBox::UICheckBoxState::SELECTED : UICheckBox::UICheckBoxState::UNSELECTED;
+ radioButton_.SetState(state);
+ return true;
+ }
+ HILOG_ERROR(HILOG_MODULE_ACE, "the checkbox checked is error value");
+ return false;
+ }
+ case K_NAME: {
+ char *name = MallocStringOf(attrValue);
+ if (name == nullptr) {
+ const char * const tmpName = "";
+ radioButton_.SetName(tmpName);
+ } else {
+ radioButton_.SetName(name);
+ ACE_FREE(name);
+ }
+ return true;
+ }
+ default:
+ break;
+ }
+ return false;
+}
+
+bool InputRadioComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation)
+{
+ if (eventTypeId == K_CHANGE) {
+ changeListener_ = new StateChangeListener(funcValue);
+ if (changeListener_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "create change listener failed");
+ return false;
+ }
+ return true;
+ }
+ if (eventTypeId == K_CLICK) {
+ clickListener_ = new ViewOnClickListener(funcValue, isStopPropagation);
+ if (clickListener_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "create click listener failed");
+ return false;
+ }
+ return true;
+ }
+ return false;
+}
+
+bool InputRadioComponent::ApplyPrivateStyle(const AppStyleItem *style)
+{
+ uint16_t styleKey = GetStylePropNameId(style);
+ if (styleKey == K_BACKGROUND_IMAGE) {
+ return HandleBackgroundImg(*style, pressedBackGroundImg_, normalBackGroundImg_);
+ }
+ return false;
+}
+
+void InputRadioComponent::PostRender()
+{
+ DealEvent();
+ ACE_FREE(normalBackGroundImg_);
+ ACE_FREE(pressedBackGroundImg_);
+}
+
+void InputRadioComponent::DealEvent()
+{
+ if (changeListener_ != nullptr) {
+ bool state = (radioButton_.GetState() == UICheckBox::UICheckBoxState::SELECTED);
+ changeListener_->SetState(state);
+ radioButton_.SetOnChangeListener(changeListener_);
+ }
+
+ if (clickListener_ == nullptr) {
+ // trigger changeEvent
+ clickListener_ = new ViewOnClickListener(UNDEFINED, true);
+ if (clickListener_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "create click listener failed");
+ return;
+ }
+ }
+
+ clickListener_->SetComponentListener(changeListener_);
+ radioButton_.SetOnClickListener(clickListener_);
+
+ if (normalBackGroundImg_ != nullptr || pressedBackGroundImg_ != nullptr) {
+ // make sure the normal and pressed image same in case user only set one of them
+ char *normalImg = (normalBackGroundImg_ == nullptr) ? pressedBackGroundImg_ : normalBackGroundImg_;
+ char *pressedImg = (pressedBackGroundImg_ == nullptr) ? normalBackGroundImg_ : pressedBackGroundImg_;
+ radioButton_.SetImages(pressedImg, normalImg);
+ }
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/components/input_radio_component.h b/frameworks/src/core/components/input_radio_component.h
new file mode 100755
index 0000000..12df8ef
--- /dev/null
+++ b/frameworks/src/core/components/input_radio_component.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef OHOS_ACELITE_INPUT_RADIO_COMPONENT_H
+#define OHOS_ACELITE_INPUT_RADIO_COMPONENT_H
+#include "component.h"
+#include "key_parser.h"
+#include "non_copyable.h"
+#include "ui_radio_button.h"
+
+namespace OHOS {
+namespace ACELite {
+class InputRadioComponent final : public Component {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(InputRadioComponent);
+ InputRadioComponent() = delete;
+ InputRadioComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager)
+ : Component(options, children, manager),
+ changeListener_(nullptr),
+ clickListener_(nullptr),
+ normalBackGroundImg_(nullptr),
+ pressedBackGroundImg_(nullptr)
+ {
+ SetComponentName(K_INPUT);
+ }
+ ~InputRadioComponent() override {}
+ void ReleaseNativeViews() override;
+ bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override;
+ bool ApplyPrivateStyle(const AppStyleItem *style) override;
+ void PostRender() override;
+
+protected:
+ UIView *GetComponentRootView() const override
+ {
+ return const_cast(&radioButton_);
+ }
+
+private:
+ void DealEvent();
+ UIRadioButton radioButton_;
+ StateChangeListener *changeListener_;
+ ViewOnClickListener *clickListener_;
+ char *normalBackGroundImg_;
+ char *pressedBackGroundImg_;
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // OHOS_ACELITE_INPUT_RADIO_COMPONENT_H
diff --git a/src/core/components/list_adapter.cpp b/frameworks/src/core/components/list_adapter.cpp
similarity index 90%
rename from src/core/components/list_adapter.cpp
rename to frameworks/src/core/components/list_adapter.cpp
index 70af92e..57b04f5 100755
--- a/src/core/components/list_adapter.cpp
+++ b/frameworks/src/core/components/list_adapter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -22,14 +22,17 @@
#include "component_utils.h"
#include "directive/descriptor_utils.h"
#include "fatal_handler.h"
-#if ENABLED(SECURE_C_FUNCTION)
#include "securec.h"
-#endif // ENABLED(SECURE_C_FUNCTION)
namespace OHOS {
namespace ACELite {
ListAdapter::ListAdapter()
- : listItems_(nullptr), headNode_(nullptr), tailNode_(nullptr), itemsCount_(0), listItemsCount_(0)
+ : listItems_(nullptr),
+ headNode_(nullptr),
+ tailNode_(nullptr),
+ itemsCount_(0),
+ listItemsCount_(0),
+ uiListContentParam_()
{
}
@@ -182,22 +185,19 @@ int16_t ListAdapter::CalculateItemIndex(int16_t itemIndex) const
return FAILED;
}
-// 1. get UIView according to index which will show in list.
-// 2. delete inView if it is not null(if inView not null, it means this view is out of the list visible area, need
-// delete.) if the UIView found belongs to "For type" child, need create it dynamically, or else just get it from native
-// Element.
UIView *ListAdapter::GetView(UIView *inView, int16_t index)
{
if (index < 0) {
return nullptr;
}
-
- // find listItemsIndex according the item index
+ // 1. get UIView according to index which will show in list.
int16_t listItemsIndex = CalculateItemIndex(index);
if (listItemsIndex < 0) {
return nullptr;
}
- // delete "For type" UIView that are not visible in list
+ // 2. delete inView if it is not null(if inView not null, it means this view is out of the list visible area, need
+ // delete.) if the UIView found belongs to "For type" child, need create it dynamically,
+ // or else just get it from native Element.
if (inView != nullptr) {
// this function will check whether the inView is For type UIView, if it is, delete it, or else do nothing.
DeleteItem(inView);
@@ -234,17 +234,14 @@ JSValue ListAdapter::GetElement(int16_t listItemsIndex, int16_t index, bool &isF
// if it is a for or for+if type list-item, we need create view dynamically.
if (isFor) {
// get render argument
- const int8_t argsLen = 2;
JSValue item = jerry_get_property_by_index(getterRetList, index - startIndex);
if (jerry_value_is_undefined(item)) {
HILOG_ERROR(HILOG_MODULE_ACE, "List adapter: Get item from getterRetList failed.");
return UNDEFINED;
}
JSValue itemIdx = jerry_create_number(index - startIndex);
- JSValue args[argsLen];
- args[0] = {item};
- args[1] = {itemIdx};
-
+ const int8_t argsLen = 2;
+ JSValue args[argsLen] = {item, itemIdx};
// get render function
JSValue renderPropValue = jerryx_get_property_str(descriptorOrElement, DESCRIPTOR_ATTR_RENDER);
if (!jerry_value_is_function(renderPropValue)) {
@@ -252,15 +249,13 @@ JSValue ListAdapter::GetElement(int16_t listItemsIndex, int16_t index, bool &isF
ReleaseJerryValue(item, itemIdx, renderPropValue, VA_ARG_END_FLAG);
return UNDEFINED;
}
-
// excute render function, get nativeElement
JSValue nativeElement = CallJSFunction(renderPropValue, UNDEFINED, args, argsLen);
if (jerry_value_is_undefined(nativeElement)) {
ReleaseJerryValue(item, itemIdx, renderPropValue, nativeElement, VA_ARG_END_FLAG);
return UNDEFINED;
}
-
- // if it is a for+if type list-item, here will ignore if attribure
+ // if it is a for+if type list-item, here will ignore if attribute
if (DescriptorUtils::IsIfDescriptor(nativeElement)) {
element = DescriptorUtils::GetDescriptorRendered(nativeElement);
if (IS_UNDEFINED(element)) {
@@ -280,14 +275,24 @@ JSValue ListAdapter::GetElement(int16_t listItemsIndex, int16_t index, bool &isF
} else { // if it is a common list-item
element = descriptorOrElement;
}
+ BuildItemViewTree(element);
return element;
}
+void ListAdapter::BuildItemViewTree(const JSValue element) const
+{
+ Component *component = ComponentUtils::GetComponentFromBindingObject(element);
+ if (component == nullptr) {
+ return;
+ }
+ ConstrainedParameter parentParam = uiListContentParam_;
+ Component::BuildViewTree(component, nullptr, parentParam);
+ component->OnViewAttached();
+}
+
void ListAdapter::InsertItem(JSValue nativeElement, UIView *uiView)
{
- ViewNativePair *insertNode;
-
- insertNode = (ViewNativePair *)ace_malloc(sizeof(ViewNativePair));
+ ViewNativePair *insertNode = reinterpret_cast(ace_malloc(sizeof(ViewNativePair)));
if (insertNode == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "List adapter: insertNode failed to allocate memory!");
return;
@@ -312,12 +317,8 @@ void ListAdapter::InsertItem(JSValue nativeElement, UIView *uiView)
void ListAdapter::DeleteItem(const UIView *uiView)
{
- ViewNativePair *delNode;
- ViewNativePair *preNode;
-
- // delNode point to head node.
- delNode = headNode_;
- preNode = nullptr;
+ ViewNativePair *delNode = headNode_;
+ ViewNativePair *preNode = nullptr;
// if viewNativePair not exsit, can not confirm whether the uiView is belongs For type child or common child,
// although it can not be deleted, does not effect rendering new View.
@@ -348,7 +349,7 @@ void ListAdapter::DeleteItem(const UIView *uiView)
tailNode_ = preNode;
}
} else {
- // Do nothing
+ HILOG_WARN(HILOG_MODULE_ACE, "item to be deleted is not found");
}
DescriptorUtils::ReleaseDescriptorOrElement(delNode->nativeElement);
@@ -371,5 +372,10 @@ void ListAdapter::CleanUp()
listItems_ = nullptr;
}
}
+
+void ListAdapter::UpdateContentAlignParam(ConstrainedParameter param)
+{
+ uiListContentParam_ = param;
+}
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/list_adapter.h b/frameworks/src/core/components/list_adapter.h
old mode 100755
new mode 100644
similarity index 83%
rename from src/core/components/list_adapter.h
rename to frameworks/src/core/components/list_adapter.h
index b88bf37..b865e91
--- a/src/core/components/list_adapter.h
+++ b/frameworks/src/core/components/list_adapter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -17,6 +17,7 @@
#define OHOS_ACELITE_LIST_ADAPTER_H
#include "abstract_adapter.h"
+#include "component.h"
#include "js_fwk_common.h"
#include "non_copyable.h"
@@ -45,8 +46,14 @@ public:
ListAdapter();
~ListAdapter();
bool Initialize(const JSValue descriptors);
- // Get the view from index.
- // if inView is null, adapter will new a view. if not, adapter will delete the inView and new a view.
+
+ /**
+ * @brief get view from index.
+ * if inView is null, adapter will new a view. if not, adapter will delete the inView and new a view.
+ * @param inview the list object
+ * index the item index
+ * @return the special number view in list
+ */
UIView *GetView(UIView *inView, int16_t index) override;
void DeleteView(UIView *&view) override {}
@@ -57,6 +64,8 @@ public:
void CleanUp();
+ void UpdateContentAlignParam(ConstrainedParameter param);
+
private:
bool GenerateListItems(const JSValue descriptors, int16_t size);
int16_t CalculateItemIndex(int16_t itemIndex) const;
@@ -64,11 +73,14 @@ private:
bool AddForDescriptorToList(JSValue descriptorOrElement, int16_t listItemsIndex) const;
void InsertItem(JSValue nativeElement, UIView *uiView);
void DeleteItem(const UIView *uiView);
+ void BuildItemViewTree(const JSValue element) const;
ListItemValue *listItems_;
ViewNativePair *headNode_;
ViewNativePair *tailNode_;
int16_t itemsCount_;
int16_t listItemsCount_;
+ // the content area
+ ConstrainedParameter uiListContentParam_;
};
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/list_component.cpp b/frameworks/src/core/components/list_component.cpp
similarity index 62%
rename from src/core/components/list_component.cpp
rename to frameworks/src/core/components/list_component.cpp
index c01df3a..0c14417 100755
--- a/src/core/components/list_component.cpp
+++ b/frameworks/src/core/components/list_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,62 +26,30 @@ namespace ACELite {
const char * const ListComponent::FUNC_SCROLLTO = "scrollTo";
const char * const ListComponent::INDEX_SCROLLTO = "index";
ListComponent::ListComponent(JSValue options, JSValue children, AppStyleManager *styleManager)
- : Component(options, children, styleManager),
- list_(nullptr),
- adapter_(nullptr),
- combinedStyle_(nullptr),
- listEventListener_(nullptr),
- flexDirectionDefault("column")
+ : Component(options, children, styleManager)
{
SetComponentName(K_LIST);
RegisterNamedFunction(FUNC_SCROLLTO, ListScrollTo);
- combinedStyle_ = styleManager->GetCombinedStyle();
+#ifdef FEATURE_ROTATION_API
+ RegisterNamedFunction(FUNC_ROTATION_NAME, HandleRotationRequest);
+#endif // FEATURE_ROTATION_API
}
// Create list
bool ListComponent::CreateNativeViews()
{
- if (combinedStyle_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "get list style failed");
- return false;
- }
-
- // Step1. get list flex-direction
- const AppStyleItem *item = combinedStyle_->GetStyleItemByNameId(K_FLEX_DIRECTION);
- const char * const directionValue = (item == nullptr) ? flexDirectionDefault : item->GetStrValue();
- if (directionValue == nullptr) {
- return false;
- }
- size_t directionValueLength = (item == nullptr) ? strlen(flexDirectionDefault) : item->GetStrValueLen();
- uint16_t directionValueId = KeyParser::ParseKeyId(directionValue, directionValueLength);
- // Step2. create list
- if (directionValueId == K_ROW) {
- list_ = new UIList(UIList::HORIZONTAL);
- } else {
- list_ = new UIList(UIList::VERTICAL);
- }
-
- if (list_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "create native list view failed");
- return false;
- }
-
// set list default attributes
- list_->SetThrowDrag(true);
+ list_.SetThrowDrag(true);
// list event listener position
const int16_t listenPosition = 10;
- list_->SetSelectPosition(listenPosition);
-
+ list_.SetSelectPosition(listenPosition);
return true;
}
void ListComponent::ReleaseNativeViews()
{
- if (list_) {
- list_->RemoveAll();
- delete list_;
- list_ = nullptr;
- }
+ list_.RemoveAll();
+
// only let list component release its children when the whole application
// is not in fatal error handling process, as FatalHandler will do the recycle
if (!FatalHandler::GetInstance().IsFatalErrorHandling()) {
@@ -89,32 +57,36 @@ void ListComponent::ReleaseNativeViews()
DescriptorUtils::ReleaseDescriptorOrElements(GetDescriptors());
}
}
- if (adapter_) {
- delete adapter_;
- adapter_ = nullptr;
- }
- if (listEventListener_) {
- delete listEventListener_;
- listEventListener_ = nullptr;
- }
}
UIView *ListComponent::GetComponentRootView() const
{
- return list_;
+ return const_cast(&list_);
}
-bool ListComponent::RegisterPrivateEventListener(uint16_t eventTypeId, JSValue funcValue)
+bool ListComponent::ApplyPrivateStyle(const AppStyleItem *style)
{
- if (listEventListener_ == nullptr) {
- listEventListener_ = new ListEventListener();
- if (listEventListener_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "create list listener failed");
- return false;
- }
- list_->SetScrollStateListener(listEventListener_);
+ uint16_t stylePropNameId = GetStylePropNameId(style);
+ if (stylePropNameId != K_FLEX_DIRECTION) {
+ return false;
}
+ const char * const strValue = GetStyleStrValue(style);
+ if (strValue == nullptr) {
+ return true;
+ }
+
+ uint16_t valueId = KeyParser::ParseKeyId(strValue, GetStyleStrValueLen(style));
+ if (valueId == K_ROW) {
+ list_.SetDirection(UIList::HORIZONTAL);
+ }
+ return true;
+}
+
+bool ListComponent::RegisterPrivateEventListener(uint16_t eventTypeId, JSValue funcValue, bool isStopPropagation)
+{
+ list_.SetScrollStateListener(&listEventListener_);
+
switch (eventTypeId) {
// list specific event switch
#ifdef FEATURE_LIST_SPECIFIC_EVENT_ENABLE
@@ -129,7 +101,7 @@ bool ListComponent::RegisterPrivateEventListener(uint16_t eventTypeId, JSValue f
#endif // FEATURE_LIST_SPECIFIC_EVENT_ENABLE
// when scroll end, this listening event will be triggered
case K_SCROLLEND:
- listEventListener_->SetBindScrollEndFuncName(funcValue);
+ listEventListener_.SetBindScrollEndFuncName(funcValue);
break;
default:
return false;
@@ -150,32 +122,26 @@ bool ListComponent::ProcessChildren()
HandleListForDireactive();
// Step3. create list adapter
- adapter_ = new ListAdapter();
- if (adapter_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "create list adapter failed");
- return false;
- }
- bool ret = adapter_->Initialize(descriptors);
+ bool ret = adapter_.Initialize(descriptors);
if (!ret) {
- delete adapter_;
- adapter_ = nullptr;
HILOG_ERROR(HILOG_MODULE_ACE, "Initialize list adapter failed.");
return false;
}
- // Step4. add children to list dynamically.
- list_->SetAdapter(adapter_);
-
return true;
}
+void ListComponent::OnViewAttached()
+{
+ ConstrainedParameter listParameter;
+ GetConstrainedParam(listParameter);
+ adapter_.UpdateContentAlignParam(listParameter);
+ // Step4. add children to list dynamically.
+ list_.SetAdapter(&adapter_);
+}
+
bool ListComponent::UpdateForView()
{
- if ((adapter_ == nullptr) || (list_ == nullptr)) {
- HILOG_ERROR(HILOG_MODULE_ACE, "List Component: adapter or list is null, UpdateForView failed.");
- return false;
- }
-
// Step1. get new children, if not exsit, return false.
const JSValue descriptors = GetDescriptors();
if (jerry_value_is_undefined(descriptors)) {
@@ -186,22 +152,22 @@ bool ListComponent::UpdateForView()
// free listItems_ array memory and reset listItemCount_.
// here not need delete UIView and free viewNativePair_ link list memory,
// it will be excuted in RefreshList() function.
- adapter_->CleanUp();
+ adapter_.CleanUp();
// save all children's information into listItems_ array(contain For type child and common child).
- bool ret = adapter_->Initialize(descriptors);
+ bool ret = adapter_.Initialize(descriptors);
if (!ret) {
HILOG_ERROR(HILOG_MODULE_ACE, "Initialize list adapter failed.");
return false;
}
// refresh the list, load new child dynamically in list.
- list_->RefreshList();
+ list_.RefreshList();
return true;
}
-JSValue
- ListComponent::ListScrollTo(const JSValue func, const JSValue dom, const JSValue args[], const jerry_length_t size)
+JSValue ListComponent::ListScrollTo(const JSValue func, const JSValue dom,
+ const JSValue args[], const jerry_length_t size)
{
if (size != 1) {
HILOG_ERROR(HILOG_MODULE_ACE, "scrollTo function parameter error");
diff --git a/src/core/components/list_component.h b/frameworks/src/core/components/list_component.h
similarity index 84%
rename from src/core/components/list_component.h
rename to frameworks/src/core/components/list_component.h
index e059df2..59db3ad 100755
--- a/src/core/components/list_component.h
+++ b/frameworks/src/core/components/list_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,16 +33,16 @@ protected:
bool CreateNativeViews() override;
void ReleaseNativeViews() override;
UIView *GetComponentRootView() const override;
- bool RegisterPrivateEventListener(uint16_t eventTypeId, JSValue funcValue) override;
+ bool ApplyPrivateStyle(const AppStyleItem* style) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId, JSValue funcValue, bool isStopPropagation) override;
bool ProcessChildren() override;
+ void OnViewAttached() override;
bool UpdateForView() override;
private:
- UIList *list_;
- ListAdapter *adapter_;
- const AppStyle *combinedStyle_;
- ListEventListener *listEventListener_;
- const char *flexDirectionDefault;
+ UIList list_;
+ ListAdapter adapter_;
+ ListEventListener listEventListener_;
static const char * const FUNC_SCROLLTO;
static const char * const INDEX_SCROLLTO;
static JSValue ListScrollTo(const JSValue func, const JSValue dom, const JSValue args[], const jerry_length_t size);
diff --git a/src/core/components/marquee_component.cpp b/frameworks/src/core/components/marquee_component.cpp
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/components/marquee_component.cpp
rename to frameworks/src/core/components/marquee_component.cpp
diff --git a/src/core/components/marquee_component.h b/frameworks/src/core/components/marquee_component.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/components/marquee_component.h
rename to frameworks/src/core/components/marquee_component.h
diff --git a/src/core/components/panel_view.cpp b/frameworks/src/core/components/panel_view.cpp
similarity index 98%
rename from src/core/components/panel_view.cpp
rename to frameworks/src/core/components/panel_view.cpp
index 38095e6..41c42b7 100755
--- a/src/core/components/panel_view.cpp
+++ b/frameworks/src/core/components/panel_view.cpp
@@ -124,8 +124,8 @@ void PanelView::SetTextInPanel(UILabel *label)
void PanelView::SetVideoSlider()
{
- if (videoSlider_ == nullptr || curTimeLabel_ == nullptr || totalTimeLabel_ == nullptr || playImage_ == nullptr
- || mutedImage_ == nullptr) {
+ if (videoSlider_ == nullptr || curTimeLabel_ == nullptr || totalTimeLabel_ == nullptr ||
+ playImage_ == nullptr || mutedImage_ == nullptr) {
return;
}
const int8_t sliderWidth = 5; // default slider width
diff --git a/src/core/components/panel_view.h b/frameworks/src/core/components/panel_view.h
similarity index 98%
rename from src/core/components/panel_view.h
rename to frameworks/src/core/components/panel_view.h
index 50c75fd..9045ee5 100755
--- a/src/core/components/panel_view.h
+++ b/frameworks/src/core/components/panel_view.h
@@ -27,7 +27,6 @@
#include "ui_image_view.h"
#include "ui_label.h"
#include "ui_slider.h"
-#include "ui_text_language.h"
#include "video_panel_image_res.h"
namespace OHOS {
diff --git a/src/core/components/picker_view_component.cpp b/frameworks/src/core/components/picker_view_component.cpp
similarity index 95%
rename from src/core/components/picker_view_component.cpp
rename to frameworks/src/core/components/picker_view_component.cpp
index f8f9632..da430eb 100755
--- a/src/core/components/picker_view_component.cpp
+++ b/frameworks/src/core/components/picker_view_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -18,6 +18,7 @@
#include "ace_mem_base.h"
#include "key_parser.h"
#include "keys.h"
+#include "product_adapter.h"
#include "ui_font.h"
namespace OHOS {
@@ -42,7 +43,7 @@ void DatePickerListener::OnDatePickerStoped(UIDatePicker &picker)
}
#endif // FEATURE_COMPONENT_DATE_PICKER
-void TextPickerListener::OnPickerStoped(UIPicker& picker)
+void TextPickerListener::OnPickerStoped(UIPicker &picker)
{
if (!jerry_value_is_function(textCallback_)) {
HILOG_ERROR(HILOG_MODULE_ACE, "TextPickerListener: callback type invalid!");
@@ -97,6 +98,10 @@ PickerViewComponent::PickerViewComponent(jerry_value_t options, jerry_value_t ch
timeSelected_(nullptr)
{
SetComponentName(K_PICKER_VIEW);
+ fontSize_ = ProductAdapter::GetDefaultFontSize();
+#ifdef FEATURE_ROTATION_API
+ RegisterNamedFunction(FUNC_ROTATION_NAME, HandleRotationRequest);
+#endif // FEATURE_ROTATION_API
}
bool PickerViewComponent::CreateNativeViews()
@@ -131,8 +136,8 @@ bool PickerViewComponent::CreateNativeViews()
result = false;
}
if (result) {
- result = (CopyFontFamily(fontFamily_, DEFAULT_FONT_FAMILY)) &&
- (CopyFontFamily(selectedFontFamily_, DEFAULT_FONT_FAMILY));
+ result = (CopyFontFamily(fontFamily_, ProductAdapter::GetDefaultFontFamilyName())) &&
+ (CopyFontFamily(selectedFontFamily_, ProductAdapter::GetDefaultFontFamilyName()));
}
return result;
}
@@ -261,9 +266,9 @@ void PickerViewComponent::PostRender()
UpdatePickerAttrs();
}
-void PickerViewComponent::PostUpdate(uint16_t attrKeyId, bool updateResult)
+void PickerViewComponent::PostUpdate(uint16_t attrKeyId)
{
- if ((pickerView_ == nullptr) || !updateResult) {
+ if (pickerView_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "PickerViewComponent: post update failed!");
return;
}
@@ -295,12 +300,11 @@ void PickerViewComponent::UpdatePickerStyles() const
HILOG_ERROR(HILOG_MODULE_ACE, "PickerViewComponent: update picker styles failed!");
return;
}
- if ((fontFamily_ == nullptr) || (fontSize_ == 0) ||
- (selectedFontFamily_ == nullptr) || (selectedFontSize_ == 0)) {
+ if ((fontFamily_ == nullptr) || (fontSize_ == 0) || (selectedFontFamily_ == nullptr) || (selectedFontSize_ == 0)) {
HILOG_ERROR(HILOG_MODULE_ACE, "PickerViewComponent: font family or size invalid!");
return;
}
- UIFont* font = UIFont::GetInstance();
+ UIFont *font = UIFont::GetInstance();
if (font == nullptr) {
return;
}
@@ -450,7 +454,9 @@ bool PickerViewComponent::ApplyPrivateStyle(const AppStyleItem *styleItem)
return true;
}
-bool PickerViewComponent::RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
+bool PickerViewComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation)
{
bool result = false;
switch (eventTypeId) {
diff --git a/src/core/components/picker_view_component.h b/frameworks/src/core/components/picker_view_component.h
old mode 100755
new mode 100644
similarity index 96%
rename from src/core/components/picker_view_component.h
rename to frameworks/src/core/components/picker_view_component.h
index cd76307..1aca88b
--- a/src/core/components/picker_view_component.h
+++ b/frameworks/src/core/components/picker_view_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -134,16 +134,16 @@ protected:
UIView *GetComponentRootView() const override;
bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
bool ApplyPrivateStyle(const AppStyleItem* styleItem) override;
- bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override;
void PostRender() override;
- void PostUpdate(uint16_t attrKeyId, bool updateResult) override;
+ void PostUpdate(uint16_t attrKeyId) override;
/**
* @enum PickerType
*
* @brief Values that represent different types of picker-view
*/
- enum class PickerType {
+ enum class PickerType : uint8_t {
UNKNOWN,
TEXT,
TIME,
diff --git a/frameworks/src/core/components/qrcode_component.cpp b/frameworks/src/core/components/qrcode_component.cpp
new file mode 100755
index 0000000..601ff31
--- /dev/null
+++ b/frameworks/src/core/components/qrcode_component.cpp
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "acelite_config.h"
+
+#ifdef FEATURE_COMPONENT_QRCODE
+#include "qrcode_component.h"
+#include "ace_log.h"
+#include "ace_mem_base.h"
+#include "js_app_context.h"
+#include "js_fwk_common.h"
+#include "key_parser.h"
+#include "keys.h"
+
+namespace OHOS {
+namespace ACELite {
+QrcodeComponent::QrcodeComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager)
+ : Component(options, children, manager), qrcodeValue_(nullptr)
+{
+ qrcodeColor_ = Color::Black();
+ qrcodeBackGroundColor_ = Color::White();
+ SetComponentName(K_QRCODE);
+}
+
+void QrcodeComponent::ReleaseNativeViews()
+{
+ ACE_FREE(qrcodeValue_);
+}
+
+bool QrcodeComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
+{
+ bool setResult = true;
+ switch (attrKeyId) {
+ case K_VALUE: {
+ ACE_FREE(qrcodeValue_);
+ qrcodeValue_ = MallocStringOf(attrValue);
+ break;
+ }
+ default: {
+ setResult = false;
+ break;
+ }
+ }
+ return setResult;
+}
+
+void QrcodeComponent::PostUpdate(uint16_t attrKeyId)
+{
+ switch (attrKeyId) {
+ case K_BACKGROUND_COLOR:
+ // same as below
+ case K_BORDER_WIDTH:
+ // same as below
+ case K_COLOR:
+ // same as below
+ case K_HEIGHT:
+ // same as below
+ case K_WIDTH:
+ // same as below
+ case K_VALUE: {
+ DrawQrcode();
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+bool QrcodeComponent::ApplyPrivateStyle(const AppStyleItem *style)
+{
+ bool result = true;
+ uint16_t styleKey = GetStylePropNameId(style);
+ switch (styleKey) {
+ case K_BACKGROUND_COLOR: {
+ result = SetColor(*style, qrcodeBackGroundColor_);
+ break;
+ }
+ case K_COLOR: {
+ result = SetColor(*style, qrcodeColor_);
+ break;
+ }
+ default: {
+ result = false;
+ break;
+ }
+ }
+ return result;
+}
+
+void QrcodeComponent::OnViewAttached()
+{
+ DrawQrcode();
+}
+
+bool QrcodeComponent::SetColor(const AppStyleItem &style, ColorType &colortype)
+{
+ uint32_t color = 0;
+ uint8_t alpha = 255;
+ if (!GetStyleColorValue(&style, color, alpha)) {
+ return false;
+ }
+ colortype = GetRGBColor(color);
+ return true;
+}
+
+void QrcodeComponent::DrawQrcode()
+{
+ const uint16_t defaultWidth = GetWidth();
+ const uint16_t defaultHeight = GetHeight();
+ uint16_t length = static_cast(strlen(qrcodeValue_));
+ if (length > QRCODE_VAL_MAX || length == 0) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Invalid value. target size[%d]", length);
+ return;
+ }
+
+ qrcode_.SetQrcodeInfo(qrcodeValue_, qrcodeBackGroundColor_, qrcodeColor_);
+ qrcode_.SetWidth(defaultWidth);
+ qrcode_.SetHeight(defaultHeight);
+}
+} // namespace ACELite
+} // namespace OHOS
+#endif // FEATURE_COMPONENT_QRCODE
diff --git a/frameworks/src/core/components/qrcode_component.h b/frameworks/src/core/components/qrcode_component.h
new file mode 100755
index 0000000..406cb57
--- /dev/null
+++ b/frameworks/src/core/components/qrcode_component.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "acelite_config.h"
+
+#ifdef FEATURE_COMPONENT_QRCODE
+#include "component.h"
+#include "key_parser.h"
+#include "non_copyable.h"
+#include "ui_qrcode.h"
+
+namespace OHOS {
+namespace ACELite {
+class QrcodeComponent final : public Component {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(QrcodeComponent);
+ QrcodeComponent() = delete;
+ QrcodeComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager);
+ ~QrcodeComponent() override {}
+ void ReleaseNativeViews() override;
+
+protected:
+ UIView *GetComponentRootView() const override
+ {
+ return (const_cast(&qrcode_));
+ }
+ bool ApplyPrivateStyle(const AppStyleItem *style) override;
+ void OnViewAttached() override;
+ void PostUpdate(uint16_t attrKeyId) override;
+ bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
+
+private:
+ bool SetColor(const AppStyleItem &style, ColorType &colortype);
+ void DrawQrcode();
+
+ UIQrcode qrcode_;
+ char *qrcodeValue_;
+ ColorType qrcodeBackGroundColor_;
+ ColorType qrcodeColor_;
+
+ static constexpr uint16_t QRCODE_VAL_MAX = 256;
+};
+} // namespace ACELite
+} // namespace OHOS
+#endif // #ifdef FEATURE_COMPONENT_QRCODE
diff --git a/src/core/components/scroll_layer.cpp b/frameworks/src/core/components/scroll_layer.cpp
similarity index 71%
rename from src/core/components/scroll_layer.cpp
rename to frameworks/src/core/components/scroll_layer.cpp
index 5490615..85b9410 100755
--- a/src/core/components/scroll_layer.cpp
+++ b/frameworks/src/core/components/scroll_layer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,12 +15,14 @@
#include "scroll_layer.h"
#include "ace_log.h"
+#include "component.h"
#include "component_utils.h"
+#include "fatal_handler.h"
#include "root_view.h"
namespace OHOS {
namespace ACELite {
-ScrollLayer::ScrollLayer() : scroll_(nullptr), origView_(nullptr) {}
+ScrollLayer::ScrollLayer() : scroll_(nullptr), pageRootView_(nullptr) {}
ScrollLayer::~ScrollLayer()
{
@@ -28,7 +30,8 @@ ScrollLayer::~ScrollLayer()
delete (scroll_);
scroll_ = nullptr;
}
- origView_ = nullptr;
+ pageRootView_ = nullptr;
+ FatalHandler::GetInstance().SetCurrentPageRootView(nullptr);
}
UIScrollView *ScrollLayer::AddScrollLayer(UIView &view) const
@@ -69,26 +72,33 @@ UIScrollView *ScrollLayer::AddScrollLayer(UIView &view) const
scroll->Add(&view);
scroll->SetReboundSize(0);
return scroll;
- } else {
- return nullptr;
}
+ return nullptr;
}
-void ScrollLayer::AppendScrollLayer(jerry_value_t nativeElement)
+void ScrollLayer::AppendScrollLayer(Component *rootComponent)
{
- if (IS_UNDEFINED(nativeElement)) {
- HILOG_ERROR(HILOG_MODULE_ACE, "Scroll Layer: AppendScrollLayer function parameter nativeElement error.");
+ if (rootComponent == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Scroll Layer: AppendScrollLayer function parameter rootComponent error.");
return;
}
- UIView *view = ComponentUtils::GetViewFromBindingObject(nativeElement);
+ uint16_t horizontalResolution = GetHorizontalResolution();
+ uint16_t verticalResolution = GetVerticalResolution();
+ ConstrainedParameter rootViewParam(horizontalResolution, verticalResolution);
+ Component::BuildViewTree(rootComponent, nullptr, rootViewParam);
+ // root view will be attached soon, invoke the callback
+ rootComponent->OnViewAttached();
+
+ UIView *view = rootComponent->GetComponentRootView();
if (view == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "Scroll Layer: Failed to get view from js object.");
return;
}
scroll_ = AddScrollLayer(*view);
- origView_ = view;
+ pageRootView_ = (scroll_ == nullptr) ? view : scroll_;
+ FatalHandler::GetInstance().SetCurrentPageRootView(pageRootView_);
}
void ScrollLayer::Hide() const
@@ -98,10 +108,22 @@ void ScrollLayer::Hide() const
HILOG_ERROR(HILOG_MODULE_ACE, "get rootView is nullptr");
return;
}
- rootView->RemoveAll();
+ DetachFromRootView();
rootView->Invalidate();
}
+void ScrollLayer::DetachFromRootView() const
+{
+ if (pageRootView_ == nullptr) {
+ return;
+ }
+ RootView *rootView = RootView::GetInstance();
+ if (rootView == nullptr) {
+ return;
+ }
+ rootView->Remove(pageRootView_);
+}
+
void ScrollLayer::Show() const
{
RootView *rootView = RootView::GetInstance();
@@ -112,15 +134,7 @@ void ScrollLayer::Show() const
rootView->SetPosition(0, 0);
rootView->SetWidth(GetHorizontalResolution());
rootView->SetHeight(GetVerticalResolution());
-#ifdef FEATURE_ROOTVIEW_CUSTOM_BACKGROUND_COLOR
- // set no-blank background color on root view for easy using before the window's mouse showing is optimized
- rootView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Olive().full);
-#endif
- if (scroll_ == nullptr) {
- rootView->Add(origView_);
- } else {
- rootView->Add(scroll_);
- }
+ rootView->Add(pageRootView_);
rootView->Invalidate();
}
} // namespace ACELite
diff --git a/src/core/components/scroll_layer.h b/frameworks/src/core/components/scroll_layer.h
old mode 100755
new mode 100644
similarity index 81%
rename from src/core/components/scroll_layer.h
rename to frameworks/src/core/components/scroll_layer.h
index 4dcb355..2979f22
--- a/src/core/components/scroll_layer.h
+++ b/frameworks/src/core/components/scroll_layer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,6 +16,7 @@
#ifndef OHOS_ACELITE_SCROLL_LAYER_H
#define OHOS_ACELITE_SCROLL_LAYER_H
+#include "component.h"
#include "js_fwk_common.h"
#include "non_copyable.h"
#include "ui_scroll_view.h"
@@ -27,14 +28,15 @@ public:
ACE_DISALLOW_COPY_AND_MOVE(ScrollLayer);
ScrollLayer();
~ScrollLayer();
- void AppendScrollLayer(jerry_value_t nativeElement);
+ void AppendScrollLayer(Component *rootComponent);
void Hide() const;
void Show() const;
+ void DetachFromRootView() const;
private:
UIScrollView *AddScrollLayer(UIView &view) const;
- UIScrollView *scroll_;
- UIView *origView_;
+ UIScrollView *scroll_ = nullptr;
+ UIView *pageRootView_ = nullptr;
};
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/slider_component.cpp b/frameworks/src/core/components/slider_component.cpp
similarity index 50%
rename from src/core/components/slider_component.cpp
rename to frameworks/src/core/components/slider_component.cpp
index 2644f0b..31d8e7b 100755
--- a/src/core/components/slider_component.cpp
+++ b/frameworks/src/core/components/slider_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,47 +26,19 @@ SliderComponent::SliderComponent(jerry_value_t options, jerry_value_t children,
minValue_(0),
maxValue_(DEFAULT_VALUE),
value_(0),
- visibleWidth_(0),
- visibleHeight_(0),
startPosition_({0, 0}),
- sliderView_(nullptr),
- eventListener_(nullptr),
direction_(UISlider::Direction::DIR_LEFT_TO_RIGHT)
{
SetComponentName(K_SLIDER);
+#ifdef FEATURE_ROTATION_API
+ RegisterNamedFunction(FUNC_ROTATION_NAME, HandleRotationRequest);
+#endif // FEATURE_ROTATION_API
}
-bool SliderComponent::CreateNativeViews()
-{
- sliderView_ = new UISlider();
- if (sliderView_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "create native slider view failed");
- return false;
- }
- eventListener_ = new SliderEventListener();
- if (eventListener_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "create listener event failed");
- return false;
- }
- return true;
-}
-
-void SliderComponent::ReleaseNativeViews()
-{
- if (sliderView_) {
- delete sliderView_;
- sliderView_ = nullptr;
- }
-
- if (eventListener_) {
- delete eventListener_;
- eventListener_ = nullptr;
- }
-}
inline UIView *SliderComponent::GetComponentRootView() const
{
- return sliderView_;
+ return const_cast(&sliderView_);
}
bool SliderComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
@@ -90,35 +62,21 @@ bool SliderComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attr
return true;
}
-bool SliderComponent::RegisterEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
-{
- if ((sliderView_ == nullptr) || !KeyParser::IsKeyValid(eventTypeId) || IS_UNDEFINED(funcValue)) {
- return false;
- }
-
- // slider's event type has bigger priority than common ones, so try private handler first
- bool registerResult = RegisterPrivateEventListener(eventTypeId, funcValue);
- if (registerResult) {
- return true;
- }
- // try common ones if no private ones get hitted
- registerResult = RegisterCommonEventListener(*sliderView_, eventTypeId, funcValue);
- return registerResult;
-}
-
-bool SliderComponent::RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
+bool SliderComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation)
{
switch (eventTypeId) {
case K_CHANGE:
- sliderView_->SetSliderEventListener(eventListener_);
- eventListener_->SetBindChangeFuncName(funcValue);
+ sliderView_.SetSliderEventListener(&eventListener_);
+ eventListener_.SetBindChangeFuncName(funcValue);
break;
default:
return false;
}
- sliderView_->SetDraggable(true);
- sliderView_->SetTouchable(true);
+ sliderView_.SetDraggable(true);
+ sliderView_.SetTouchable(true);
return true;
}
@@ -133,8 +91,8 @@ bool SliderComponent::ApplyPrivateStyle(const AppStyleItem *style)
if (!GetStyleColorValue(style, color, alpha)) {
return false;
}
- sliderView_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
- sliderView_->SetBackgroundStyle(STYLE_BACKGROUND_OPA, alpha);
+ sliderView_.SetBackgroundStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
+ sliderView_.SetBackgroundStyle(STYLE_BACKGROUND_OPA, alpha);
break;
}
case K_SELECTED_COLOR: {
@@ -142,8 +100,8 @@ bool SliderComponent::ApplyPrivateStyle(const AppStyleItem *style)
if (!GetStyleColorValue(style, color, alpha)) {
return false;
}
- sliderView_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
- sliderView_->SetForegroundStyle(STYLE_BACKGROUND_OPA, alpha);
+ sliderView_.SetForegroundStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
+ sliderView_.SetForegroundStyle(STYLE_BACKGROUND_OPA, alpha);
break;
}
case K_BLOCK_COLOR: {
@@ -151,8 +109,8 @@ bool SliderComponent::ApplyPrivateStyle(const AppStyleItem *style)
if (!GetStyleColorValue(style, color, alpha)) {
return false;
}
- sliderView_->SetKnobStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
- sliderView_->SetKnobStyle(STYLE_BACKGROUND_OPA, alpha);
+ sliderView_.SetKnobStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
+ sliderView_.SetKnobStyle(STYLE_BACKGROUND_OPA, alpha);
break;
}
case K_LEFT: {
@@ -167,14 +125,6 @@ bool SliderComponent::ApplyPrivateStyle(const AppStyleItem *style)
SetDirection(GetStyleStrValue(style));
break;
}
- case K_HEIGHT: {
- visibleHeight_ = GetStylePixelValue(style);
- break;
- }
- case K_WIDTH: {
- visibleWidth_ = GetStylePixelValue(style);
- break;
- }
default: {
return false;
}
@@ -182,74 +132,75 @@ bool SliderComponent::ApplyPrivateStyle(const AppStyleItem *style)
return true;
}
-void SliderComponent::PostUpdate(uint16_t attrKeyId, bool updateResult)
+void SliderComponent::PostUpdate(uint16_t attrKeyId)
{
- if ((sliderView_ == nullptr) || !updateResult || !KeyParser::IsKeyValid(attrKeyId)) {
+ if (!KeyParser::IsKeyValid(attrKeyId)) {
HILOG_ERROR(HILOG_MODULE_ACE, "slider component post update check args failed");
return;
}
switch (attrKeyId) {
case K_LEFT:
case K_TOP:
- sliderView_->SetPosition(startPosition_.x, startPosition_.y);
- sliderView_->Invalidate();
+ sliderView_.SetPosition(startPosition_.x, startPosition_.y);
+ sliderView_.Invalidate();
break;
case K_HEIGHT:
- case K_WIDTH:
- sliderView_->SetHeight(visibleHeight_);
- sliderView_->SetWidth(visibleWidth_);
+ case K_WIDTH: {
+ int16_t visibleHeight = GetHeight();
+ int16_t visibleWidth = GetWidth();
+ sliderView_.SetHeight(visibleHeight);
+ sliderView_.SetWidth(visibleWidth);
if (direction_ == UISlider::Direction::DIR_BOTTOM_TO_TOP) {
- sliderView_->SetValidWidth(SLIDER_WIDTH);
- sliderView_->SetValidHeight(visibleHeight_ - KNOB_WIDTH);
+ sliderView_.SetValidWidth(SLIDER_WIDTH);
+ sliderView_.SetValidHeight(visibleHeight - KNOB_WIDTH);
} else {
- sliderView_->SetValidHeight(SLIDER_WIDTH);
- sliderView_->SetValidWidth(visibleWidth_ - KNOB_WIDTH);
+ sliderView_.SetValidHeight(SLIDER_WIDTH);
+ sliderView_.SetValidWidth(visibleWidth - KNOB_WIDTH);
}
- sliderView_->Invalidate();
+ sliderView_.Invalidate();
break;
+ }
case K_MAX:
case K_MIN:
case K_VALUE:
- sliderView_->SetRange(maxValue_, minValue_);
- sliderView_->SetValue(value_);
- sliderView_->Invalidate();
+ sliderView_.SetRange(maxValue_, minValue_);
+ sliderView_.SetValue(value_);
+ sliderView_.Invalidate();
break;
default:
break;
}
}
-void SliderComponent::PostRender()
+void SliderComponent::OnViewAttached()
{
- if (sliderView_ == nullptr) {
- return;
- }
-
if (value_ < minValue_) {
value_ = minValue_;
} else if (value_ > maxValue_) {
value_ = maxValue_;
}
- sliderView_->SetDirection(direction_);
- sliderView_->SetPosition(startPosition_.x, startPosition_.y);
- sliderView_->SetRange(maxValue_, minValue_);
- sliderView_->SetHeight(visibleHeight_);
- sliderView_->SetWidth(visibleWidth_);
+ sliderView_.SetDirection(direction_);
+ sliderView_.SetPosition(startPosition_.x, startPosition_.y);
+ sliderView_.SetRange(maxValue_, minValue_);
+ int16_t visibleHeight = GetHeight();
+ int16_t visibleWidth = GetWidth();
+ sliderView_.SetHeight(visibleHeight);
+ sliderView_.SetWidth(visibleWidth);
if (direction_ == UISlider::Direction::DIR_BOTTOM_TO_TOP) {
- sliderView_->SetValidWidth(SLIDER_WIDTH);
- sliderView_->SetValidHeight(visibleHeight_ - KNOB_WIDTH);
+ sliderView_.SetValidWidth(SLIDER_WIDTH);
+ sliderView_.SetValidHeight(visibleHeight - KNOB_WIDTH);
} else {
- sliderView_->SetValidHeight(SLIDER_WIDTH);
- sliderView_->SetValidWidth(visibleWidth_ - KNOB_WIDTH);
+ sliderView_.SetValidHeight(SLIDER_WIDTH);
+ sliderView_.SetValidWidth(visibleWidth - KNOB_WIDTH);
}
- sliderView_->SetKnobWidth(KNOB_WIDTH);
- sliderView_->SetSliderRadius(DEFAULT_BORDER_RADIUS, DEFAULT_BORDER_RADIUS, KNOB_RADIUS);
- sliderView_->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND);
- sliderView_->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND);
- sliderView_->SetBackgroundStyle(STYLE_BORDER_WIDTH, 0);
- sliderView_->SetForegroundStyle(STYLE_BORDER_WIDTH, 0);
- sliderView_->SetKnobStyle(STYLE_BORDER_WIDTH, 0);
- sliderView_->SetValue(value_);
+ sliderView_.SetKnobWidth(KNOB_WIDTH);
+ sliderView_.SetSliderRadius(DEFAULT_BORDER_RADIUS, DEFAULT_BORDER_RADIUS, KNOB_RADIUS);
+ sliderView_.SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND);
+ sliderView_.SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND);
+ sliderView_.SetBackgroundStyle(STYLE_BORDER_WIDTH, 0);
+ sliderView_.SetForegroundStyle(STYLE_BORDER_WIDTH, 0);
+ sliderView_.SetKnobStyle(STYLE_BORDER_WIDTH, 0);
+ sliderView_.SetValue(value_);
}
void SliderComponent::SetDirection(const char * const directionValue)
diff --git a/src/core/components/slider_component.h b/frameworks/src/core/components/slider_component.h
old mode 100755
new mode 100644
similarity index 81%
rename from src/core/components/slider_component.h
rename to frameworks/src/core/components/slider_component.h
index c5fd4c0..8548a8a
--- a/src/core/components/slider_component.h
+++ b/frameworks/src/core/components/slider_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -31,15 +31,12 @@ public:
~SliderComponent() override {}
protected:
- bool CreateNativeViews() override;
- void ReleaseNativeViews() override;
UIView *GetComponentRootView() const override;
bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
- bool RegisterEventListener(uint16_t eventTypeId, jerry_value_t funcValue) override;
- bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override;
bool ApplyPrivateStyle(const AppStyleItem* style) override;
- void PostRender() override;
- void PostUpdate(uint16_t attrKeyId, bool updateResult) override;
+ void OnViewAttached() override;
+ void PostUpdate(uint16_t attrKeyId) override;
private:
static const int16_t DEFAULT_VALUE = 100;
@@ -52,11 +49,9 @@ private:
int16_t minValue_;
int16_t maxValue_;
int16_t value_;
- int16_t visibleWidth_;
- int16_t visibleHeight_;
Point startPosition_;
- UISlider* sliderView_;
- SliderEventListener* eventListener_;
+ UISlider sliderView_;
+ SliderEventListener eventListener_;
UISlider::Direction direction_;
};
} // namespace ACELite
diff --git a/frameworks/src/core/components/stack_component.cpp b/frameworks/src/core/components/stack_component.cpp
new file mode 100644
index 0000000..b98967f
--- /dev/null
+++ b/frameworks/src/core/components/stack_component.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stack_component.h"
+#include "ace_log.h"
+#include "key_parser.h"
+#include "keys.h"
+
+namespace OHOS {
+namespace ACELite {
+StackComponent::StackComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager)
+ : Component(options, children, styleManager)
+{
+ SetComponentName(K_STACK);
+ nativeView_.SetStyle(STYLE_BACKGROUND_OPA, 0);
+}
+
+UIView *StackComponent::GetComponentRootView() const
+{
+ return const_cast(&nativeView_);
+}
+
+bool StackComponent::ProcessChildren()
+{
+ // add all children to this container
+ AppendChildren(this);
+ return true;
+}
+
+void StackComponent::PostUpdate(uint16_t attrKeyId)
+{
+ nativeView_.LayoutChildren();
+}
+
+void StackComponent::AttachView(const Component *child)
+{
+ if (child == nullptr) {
+ return;
+ }
+ nativeView_.Add(child->GetComponentRootView());
+}
+} // namespace ACELite
+} // namespace OHOS
diff --git a/frameworks/src/core/components/stack_component.h b/frameworks/src/core/components/stack_component.h
new file mode 100644
index 0000000..2a1ce51
--- /dev/null
+++ b/frameworks/src/core/components/stack_component.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_ACELITE_STACK_COMPONENT_H
+#define OHOS_ACELITE_STACK_COMPONENT_H
+#include "component.h"
+#include "flex_layout.h"
+#include "non_copyable.h"
+
+namespace OHOS {
+namespace ACELite {
+class StackComponent final : public Component {
+public:
+ ACE_DISALLOW_COPY_AND_MOVE(StackComponent);
+ StackComponent() = delete;
+ StackComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager);
+ ~StackComponent() override {}
+
+protected:
+ UIView *GetComponentRootView() const override;
+ bool ProcessChildren() override;
+ void PostUpdate(uint16_t attrKeyId) override;
+ void AttachView(const Component *child) override;
+
+private:
+ UIViewGroup nativeView_;
+};
+} // namespace ACELite
+} // namespace OHOS
+
+#endif // OHOS_ACELITE_STACK_COMPONENT_H
diff --git a/src/core/components/swiper_component.cpp b/frameworks/src/core/components/swiper_component.cpp
similarity index 68%
rename from src/core/components/swiper_component.cpp
rename to frameworks/src/core/components/swiper_component.cpp
index 325ab52..c7af27b 100755
--- a/src/core/components/swiper_component.cpp
+++ b/frameworks/src/core/components/swiper_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,32 +21,21 @@
namespace OHOS {
namespace ACELite {
-SwiperComponent::SwiperComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager)
+SwiperComponent::SwiperComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager)
: Component(options, children, styleManager),
- swiperView_(nullptr),
hasChildren_(false),
index_(0),
changeListener_(nullptr)
{
SetComponentName(K_SWIPER);
-}
-
-bool SwiperComponent::CreateNativeViews()
-{
- swiperView_ = new UISwipeView();
- if (swiperView_ == nullptr) {
- return false;
- }
- swiperView_->SetLoopState(true);
- return true;
+ swiperView_.SetLoopState(true);
+#ifdef FEATURE_ROTATION_API
+ RegisterNamedFunction(FUNC_ROTATION_NAME, HandleRotationRequest);
+#endif // FEATURE_ROTATION_API
}
void SwiperComponent::ReleaseNativeViews()
{
- if (swiperView_) {
- delete swiperView_;
- swiperView_ = nullptr;
- }
if (changeListener_) {
delete changeListener_;
changeListener_ = nullptr;
@@ -55,7 +44,7 @@ void SwiperComponent::ReleaseNativeViews()
inline UIView *SwiperComponent::GetComponentRootView() const
{
- return swiperView_;
+ return const_cast(&swiperView_);
}
bool SwiperComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
@@ -66,13 +55,13 @@ bool SwiperComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attr
HILOG_ERROR(HILOG_MODULE_ACE, "duration value has problem.");
return false;
}
- swiperView_->SetAnimatorTime(duration);
+ swiperView_.SetAnimatorTime(duration);
return true;
} else if (attrKeyId == K_LOOP) {
if (jerry_value_is_boolean(attrValue)) {
- swiperView_->SetLoopState(BoolOf(attrValue));
+ swiperView_.SetLoopState(BoolOf(attrValue));
} else {
- swiperView_->SetLoopState(true);
+ swiperView_.SetLoopState(true);
}
return true;
} else if (attrKeyId == K_INDEX) {
@@ -85,9 +74,9 @@ bool SwiperComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attr
} else if (attrKeyId == K_VERTICAL) {
if (!hasChildren_) {
if (jerry_value_is_boolean(attrValue)) {
- swiperView_->SetDirection(BoolOf(attrValue));
+ swiperView_.SetDirection(BoolOf(attrValue));
} else {
- swiperView_->SetDirection(0);
+ swiperView_.SetDirection(0);
}
}
}
@@ -95,64 +84,63 @@ bool SwiperComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attr
return false;
}
-void SwiperComponent::PostUpdate(uint16_t attrKeyId, bool updateResult)
-{
- if (updateResult) {
- SetPageIndex();
- }
-}
-
-void SwiperComponent::PostRender()
+void SwiperComponent::PostUpdate(uint16_t attrKeyId)
{
SetPageIndex();
}
bool SwiperComponent::ProcessChildren()
{
- if (swiperView_ == nullptr) {
- return false;
- }
- AppendChildren(swiperView_);
+ AppendChildren(this);
hasChildren_ = true;
return true;
}
-bool SwiperComponent::RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
+void SwiperComponent::AttachView(const Component *child)
+{
+ if (child == nullptr) {
+ return;
+ }
+ swiperView_.Add(child->GetComponentRootView());
+ SetPageIndex();
+}
+
+bool SwiperComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation)
{
if (eventTypeId == K_CHANGE) {
- if (swiperView_) {
- changeListener_ = new ChangeListener(funcValue);
- if (changeListener_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "Create ChangeListener error.");
- return false;
- }
- swiperView_->SetOnSwipeListener(changeListener_);
- return true;
+ changeListener_ = new ChangeListener(funcValue);
+ if (changeListener_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "Create ChangeListener error.");
+ return false;
}
+ swiperView_.SetOnSwipeListener(changeListener_);
+ return true;
}
return false;
}
-void SwiperComponent::SetPageIndex() const
+void SwiperComponent::SetPageIndex()
{
if (jerry_value_is_undefined(GetChildren())) {
- HILOG_INFO(HILOG_MODULE_ACE, "Swiper children don't exsit.");
+ HILOG_INFO(HILOG_MODULE_ACE, "Swiper children don't exist.");
return;
}
uint16_t length = jerry_get_array_length(GetChildren());
if (index_ < 0 || index_ >= length) {
- swiperView_->SetCurrentPage(0);
+ swiperView_.SetCurrentPage(0);
} else {
- swiperView_->SetCurrentPage(index_);
+ swiperView_.SetCurrentPage(index_);
}
}
-void SwiperComponent::ChangeListener::OnSwipe(UISwipeView& view)
+void SwiperComponent::ChangeListener::OnSwipe(UISwipeView &view)
{
if (jerry_value_is_undefined(fn_)) {
return;
}
- UISwipeView* swipeView = reinterpret_cast(&view);
+ UISwipeView *swipeView = reinterpret_cast(&view);
if (swipeView == nullptr) {
return;
}
diff --git a/src/core/components/swiper_component.h b/frameworks/src/core/components/swiper_component.h
old mode 100755
new mode 100644
similarity index 87%
rename from src/core/components/swiper_component.h
rename to frameworks/src/core/components/swiper_component.h
index 638110b..fde1893
--- a/src/core/components/swiper_component.h
+++ b/frameworks/src/core/components/swiper_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -31,14 +31,13 @@ public:
~SwiperComponent() override {}
protected:
- bool CreateNativeViews() override;
void ReleaseNativeViews() override;
UIView *GetComponentRootView() const override;
bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
- void PostUpdate(uint16_t attrKeyId, bool updateResult) override;
- void PostRender() override;
+ void PostUpdate(uint16_t attrKeyId) override;
bool ProcessChildren() override;
- bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override;
+ void AttachView(const Component *child) override;
private:
class ChangeListener : public UISwipeView::OnSwipeListener {
@@ -55,8 +54,8 @@ private:
private:
jerry_value_t fn_;
};
- void SetPageIndex() const;
- UISwipeView *swiperView_;
+ void SetPageIndex();
+ UISwipeView swiperView_;
bool hasChildren_;
int16_t index_;
ChangeListener *changeListener_;
diff --git a/src/core/components/switch_component.cpp b/frameworks/src/core/components/switch_component.cpp
old mode 100755
new mode 100644
similarity index 66%
rename from src/core/components/switch_component.cpp
rename to frameworks/src/core/components/switch_component.cpp
index 5b47e0f..5737fb1
--- a/src/core/components/switch_component.cpp
+++ b/frameworks/src/core/components/switch_component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,12 +23,10 @@ namespace OHOS {
namespace ACELite {
SwitchComponent::SwitchComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager)
: Component(options, children, styleManager),
- toggleButton_(nullptr),
changeListener_(nullptr),
clickListener_(nullptr)
{
SetComponentName(K_SWITCH);
- combinedStyle_ = GetStyleManager()->GetCombinedStyle();
}
SwitchComponent::~SwitchComponent()
@@ -54,8 +52,8 @@ bool SwitchComponent::ApplyPrivateStyle(const AppStyleItem *style)
uint32_t color = 0;
uint8_t alpha = OPA_OPAQUE;
if (GetStyleColorValue(style, color, alpha)) {
- toggleButton_->SetStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
- toggleButton_->SetStyle(STYLE_BACKGROUND_OPA, alpha);
+ toggleButton_.SetStyle(STYLE_BACKGROUND_COLOR, GetRGBColor(color).full);
+ toggleButton_.SetStyle(STYLE_BACKGROUND_OPA, alpha);
return true;
}
}
@@ -65,56 +63,43 @@ bool SwitchComponent::ApplyPrivateStyle(const AppStyleItem *style)
bool SwitchComponent::CreateNativeViews()
{
- toggleButton_ = new UIToggleButton();
-
- if (toggleButton_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "create switch component fail");
- return false;
- }
-
- toggleButton_->SetState(false);
- toggleButton_->SetStyle(STYLE_BORDER_OPA, OPA_OPAQUE);
- toggleButton_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+ toggleButton_.SetState(false);
+ toggleButton_.SetStyle(STYLE_BORDER_OPA, OPA_OPAQUE);
+ toggleButton_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
return true;
}
-void SwitchComponent::ReleaseNativeViews()
-{
- if (toggleButton_) {
- delete toggleButton_;
- toggleButton_ = nullptr;
- }
-}
UIView *SwitchComponent::GetComponentRootView() const
{
- return toggleButton_;
+ return const_cast(&toggleButton_);
}
bool SwitchComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue)
{
if (attrKeyId == K_CHECKED) {
- toggleButton_->SetState(BoolOf(attrValue));
+ toggleButton_.SetState(BoolOf(attrValue));
return true;
}
return false;
}
-bool SwitchComponent::RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue)
+bool SwitchComponent::RegisterPrivateEventListener(uint16_t eventTypeId,
+ jerry_value_t funcValue,
+ bool isStopPropagation)
{
if (eventTypeId == K_CHANGE) {
- if (toggleButton_) {
- changeListener_ = new StateChangeListener(funcValue, K_SWITCH);
- if (changeListener_ == nullptr) {
- HILOG_ERROR(HILOG_MODULE_ACE, "create change listener failed");
- return false;
- }
- return true;
+ changeListener_ = new StateChangeListener(funcValue);
+ if (changeListener_ == nullptr) {
+ HILOG_ERROR(HILOG_MODULE_ACE, "create change listener failed");
+ return false;
}
- } else if (eventTypeId == K_CLICK) {
- clickListener_ = new ViewOnClickListener(funcValue, eventTypeId);
+ return true;
+ }
+ if (eventTypeId == K_CLICK) {
+ clickListener_ = new ViewOnClickListener(funcValue, isStopPropagation);
if (clickListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "create click listener failed");
return false;
@@ -128,10 +113,11 @@ void SwitchComponent::PostRender()
{
// the change event should be dealed after checked attribute
if (changeListener_) {
- toggleButton_->SetOnChangeListener(changeListener_);
+ changeListener_->SetState(toggleButton_.GetState());
+ toggleButton_.SetOnChangeListener(changeListener_);
if (clickListener_ == nullptr) {
// trigger changeEvent
- clickListener_ = new ViewOnClickListener(UNDEFINED, K_CLICK);
+ clickListener_ = new ViewOnClickListener(UNDEFINED, true);
if (clickListener_ == nullptr) {
HILOG_ERROR(HILOG_MODULE_ACE, "create click listener failed");
return;
@@ -140,7 +126,7 @@ void SwitchComponent::PostRender()
}
if (clickListener_) {
clickListener_->SetComponentListener(changeListener_);
- toggleButton_->SetOnClickListener(clickListener_);
+ toggleButton_.SetOnClickListener(clickListener_);
}
}
} // namespace ACELite
diff --git a/src/core/components/switch_component.h b/frameworks/src/core/components/switch_component.h
old mode 100755
new mode 100644
similarity index 89%
rename from src/core/components/switch_component.h
rename to frameworks/src/core/components/switch_component.h
index e87bb0c..9383d56
--- a/src/core/components/switch_component.h
+++ b/frameworks/src/core/components/switch_component.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
+ * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -31,17 +31,15 @@ public:
protected:
bool ApplyPrivateStyle(const AppStyleItem *style) override;
bool CreateNativeViews() override;
- void ReleaseNativeViews() override;
bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
- bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue) override;
+ bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override;
UIView *GetComponentRootView() const override;
void PostRender() override;
private:
- UIToggleButton *toggleButton_;
+ UIToggleButton toggleButton_;
StateChangeListener *changeListener_;
ViewOnClickListener *clickListener_;
- const AppStyle *combinedStyle_;
};
} // namespace ACELite
} // namespace OHOS
diff --git a/src/core/components/tab_bar_component.cpp b/frameworks/src/core/components/tab_bar_component.cpp
similarity index 100%
rename from src/core/components/tab_bar_component.cpp
rename to frameworks/src/core/components/tab_bar_component.cpp
diff --git a/src/core/components/tab_bar_component.h b/frameworks/src/core/components/tab_bar_component.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/components/tab_bar_component.h
rename to frameworks/src/core/components/tab_bar_component.h
diff --git a/src/core/components/tab_content_component.cpp b/frameworks/src/core/components/tab_content_component.cpp
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/components/tab_content_component.cpp
rename to frameworks/src/core/components/tab_content_component.cpp
diff --git a/src/core/components/tab_content_component.h b/frameworks/src/core/components/tab_content_component.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/components/tab_content_component.h
rename to frameworks/src/core/components/tab_content_component.h
diff --git a/src/core/components/tabs_component.cpp b/frameworks/src/core/components/tabs_component.cpp
similarity index 98%
rename from src/core/components/tabs_component.cpp
rename to frameworks/src/core/components/tabs_component.cpp
index 5edccda..e9f5d46 100755
--- a/src/core/components/tabs_component.cpp
+++ b/frameworks/src/core/components/tabs_component.cpp
@@ -280,8 +280,8 @@ int16_t TabsComponent::GetInitPageIndex()
ReleaseJerryValue(appViewModel, appPropName, globalObject, VA_ARG_END_FLAG);
}
int16_t currentPage;
- if (!jerry_value_is_undefined(indexValHandler) && !jerry_value_is_error(indexValHandler)
- && (jerry_value_is_number(indexValHandler) || jerry_value_is_string(indexValHandler))) {
+ if (!jerry_value_is_undefined(indexValHandler) && !jerry_value_is_error(indexValHandler) &&
+ (jerry_value_is_number(indexValHandler) || jerry_value_is_string(indexValHandler))) {
currentPage = IntegerOf(indexValHandler);
if (currentPage >= length || currentPage < 0) {
currentPage = 0;
diff --git a/src/core/components/tabs_component.h b/frameworks/src/core/components/tabs_component.h
old mode 100755
new mode 100644
similarity index 100%
rename from src/core/components/tabs_component.h
rename to frameworks/src/core/components/tabs_component.h
diff --git a/frameworks/src/core/components/test/unittest/BUILD.gn b/frameworks/src/core/components/test/unittest/BUILD.gn
new file mode 100755
index 0000000..4ca5151
--- /dev/null
+++ b/frameworks/src/core/components/test/unittest/BUILD.gn
@@ -0,0 +1,35 @@
+#Copyright (c) 2021 Huawei Device Co., Ltd.
+#Licensed under the Apache License, Version 2.0 (the "License");
+#you may not use this file except in compliance with the License.
+#You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS,
+#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#See the License for the specific language governing permissions and
+#limitations under the License.
+
+group("components_unittest") {
+ deps = [
+ "common:js_frameworks_test_arc",
+ "common:js_frameworks_test_div",
+ "common:js_frameworks_test_event_bubble",
+ "common:js_frameworks_test_horizonprogress",
+ "common:js_frameworks_test_image_path_support",
+ "common:js_frameworks_test_input",
+ "common:js_frameworks_test_jsbundle",
+ "common:js_frameworks_test_list",
+ "common:js_frameworks_test_marquee",
+ "common:js_frameworks_test_opacity",
+ "common:js_frameworks_test_percent",
+ "common:js_frameworks_test_pickerview",
+ "common:js_frameworks_test_radio_switch_width",
+ "common:js_frameworks_test_slider",
+ "common:js_frameworks_test_swiper",
+ "common:js_frameworks_test_switch",
+ "common:js_frameworks_test_text",
+ "common:js_frameworks_test_text_exception",
+ ]
+}
diff --git a/frameworks/src/core/components/test/unittest/common/BUILD.gn b/frameworks/src/core/components/test/unittest/common/BUILD.gn
new file mode 100755
index 0000000..8b9474f
--- /dev/null
+++ b/frameworks/src/core/components/test/unittest/common/BUILD.gn
@@ -0,0 +1,213 @@
+#Copyright (c) 2021 Huawei Device Co., Ltd.
+#Licensed under the Apache License, Version 2.0 (the "License");
+#you may not use this file except in compliance with the License.
+#You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS,
+#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#See the License for the specific language governing permissions and
+#limitations under the License.
+
+import("//build/lite/config/test.gni")
+import("//foundation/ace/ace_engine_lite/test/ace_test_config.gni")
+
+unittest("js_frameworks_test_arc") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "arc_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_div") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "div_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_event_bubble") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/basic_tdd_test.cpp",
+ "event_bubble_tdd_test.cpp",
+ ]
+ deps = ace_test_deps
+}
+unittest("js_frameworks_test_horizonprogress") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "horizonprogress_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_image_path_support") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [ "image_src_path_tdd_test.cpp" ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_input") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "input_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_jsbundle") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [ "jsbundle_tdd_test.cpp" ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_list") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "list_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_marquee") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "marquee_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_opacity") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "opacity_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_percent") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [ "percent_tdd_test.cpp" ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_pickerview") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "picker_view_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_radio_switch_width") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "radio_switch_tdd_test.cpp",
+ "root_component_mock.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_slider") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "root_component_mock.cpp",
+ "slider_tdd_test.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_swiper") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "root_component_mock.cpp",
+ "swiper_tdd_test.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_switch") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "root_component_mock.cpp",
+ "switch_tdd_test.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_text") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "root_component_mock.cpp",
+ "text_tdd_test.cpp",
+ ]
+ deps = ace_test_deps
+}
+
+unittest("js_frameworks_test_text_exception") {
+ output_extension = "bin"
+ output_dir = test_output_root
+ configs = [ "$ace_lite_root/test:test_common_config" ]
+ sources = [
+ "$ace_lite_root/test/moduletest/common/base_test.cpp",
+ "root_component_mock.cpp",
+ "text_tdd_exception_test.cpp",
+ ]
+ deps = ace_test_deps
+}
diff --git a/frameworks/src/core/components/test/unittest/common/arc_tdd_test.cpp b/frameworks/src/core/components/test/unittest/common/arc_tdd_test.cpp
new file mode 100755
index 0000000..31c8486
--- /dev/null
+++ b/frameworks/src/core/components/test/unittest/common/arc_tdd_test.cpp
@@ -0,0 +1,1220 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "arc_tdd_test.h"
+
+namespace OHOS {
+namespace ACELite {
+void ArcTddTest::SetCircleType()
+{
+ JerrySetStringProperty(attrsObj_, "type", "arc");
+}
+
+int16_t ArcTddTest::GetPercentage(const UICircleProgress &circleProgress) const
+{
+ uint16_t delta = circleProgress.GetValue() - circleProgress.GetRangeMin();
+ uint16_t rangeSize = circleProgress.GetRangeMax() - circleProgress.GetRangeMin();
+ if (rangeSize == 0) {
+ return 0;
+ }
+
+ uint8_t totalPercent = 100;
+ uint16_t result = totalPercent * delta / rangeSize;
+ if (result > totalPercent) {
+ result = totalPercent;
+ }
+ return result;
+}
+
+void ArcTddTest::PrintExpectInfo(const ColorType colorType, int32_t lineColor) const
+{
+ EXPECT_TRUE(colorType.green == GetRGBColor(lineColor).green);
+ EXPECT_TRUE(colorType.blue == GetRGBColor(lineColor).blue);
+ EXPECT_TRUE(colorType.red == GetRGBColor(lineColor).red);
+}
+
+void ArcTddTest::ComponentProgressAttributeSetTest001()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+ /**
+ * @tc.steps: step1. set attribute percent = 50
+ */
+ int8_t percentValue = 50;
+ JerrySetNumberProperty(attrsObj_, "percent", percentValue);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressAttributeSetTest001 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressAttributeSetTest001 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.expected: step1. check percent = 50
+ */
+ EXPECT_TRUE(GetPercentage(*circleView) == percentValue);
+
+ /**
+ * @tc.steps: step2. set attribute percent = -60
+ */
+ int8_t percentValueNavigateNum = -60;
+ UpdateNumAttributeOrStyleValue(circleComponent, "percent", percentValueNavigateNum, true);
+
+ /**
+ * @tc.expected: step2. check percent = 0
+ */
+ EXPECT_TRUE(GetPercentage(*circleView) == 0);
+
+ /**
+ * @tc.steps: step3. set attribute percent = -1
+ */
+ UpdateNumAttributeOrStyleValue(circleComponent, "percent", -1, true);
+
+ /**
+ * @tc.expected: step3. check percent = 0
+ */
+ EXPECT_TRUE(GetPercentage(*circleView) == 0);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressAttributeSetTest002()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressAttributeSetTest002 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressAttributeSetTest002 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+ /**
+ * @tc.steps: step4. set attribute percent = 0
+ */
+ UpdateNumAttributeOrStyleValue(circleComponent, "percent", 0, true);
+
+ /**
+ * @tc.expected: step4. check percent = 0
+ */
+ EXPECT_TRUE(GetPercentage(*circleView) == 0);
+
+ /**
+ * @tc.steps: step5. set attribute percent = 100
+ */
+ int8_t percentValueFull = 100;
+ UpdateNumAttributeOrStyleValue(circleComponent, "percent", percentValueFull, true);
+
+ /**
+ * @tc.expected: step5. check percent = 100
+ */
+ EXPECT_TRUE(GetPercentage(*circleView) == percentValueFull);
+
+ /**
+ * @tc.steps: step6. set attribute percent = 101
+ */
+ int8_t percentValueBoundary = 101;
+ UpdateNumAttributeOrStyleValue(circleComponent, "percent", percentValueBoundary, true);
+
+ /**
+ * @tc.expected: step6. check percent = 100
+ */
+ uint8_t maxPercent = 100;
+ EXPECT_TRUE(GetPercentage(*circleView) == maxPercent);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressAttributeSetTest003()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressAttributeSetTest003 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressAttributeSetTest003 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+ /**
+ * @tc.steps: step6. set attribute percent = 200
+ */
+ uint8_t percentValueOver = 200;
+ UpdateNumAttributeOrStyleValue(circleComponent, "percent", percentValueOver, true);
+
+ /**
+ * @tc.expected: step6. check percent = 100
+ */
+ uint8_t maxPercent = 100;
+ EXPECT_TRUE(GetPercentage(*circleView) == maxPercent);
+
+ /**
+ * @tc.steps: step6. set attribute percent = "abc"
+ */
+ UpdateCharAttributeOrStyleValue(circleComponent, "percent", "abc", true);
+
+ /**
+ * @tc.expected: step6. check percent = "abc"
+ */
+ EXPECT_TRUE(GetPercentage(*circleView) == 0);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest001()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* attributeName = "centerX";
+
+ /**
+ * @tc.steps: step1. set style centerX = 227
+ */
+ uint8_t centerX = 227;
+ JerrySetNumberProperty(styleObj_, attributeName, centerX);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest001 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest001 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.expected: step1. check centerX = 227
+ */
+ EXPECT_TRUE(circleView->GetCenterPosition().x == centerX);
+
+ /**
+ * @tc.steps: step2. set attribute centerX = -32768
+ */
+ int16_t centerXBoundary = -32768;
+ UpdateNumAttributeOrStyleValue(circleComponent, attributeName, centerXBoundary, false);
+
+ /**
+ * @tc.expected: step2. check centerX = -32768
+ */
+ EXPECT_TRUE(circleView->GetCenterPosition().x == centerXBoundary);
+
+ /**
+ * @tc.steps: step3. set attribute centerX = 32765
+ */
+ int16_t centerXBoundaryIn = 32765;
+ UpdateNumAttributeOrStyleValue(circleComponent, attributeName, centerXBoundaryIn, false);
+
+ /**
+ * @tc.expected: step3. check centerX = 32765
+ */
+ EXPECT_TRUE(circleView->GetCenterPosition().x == centerXBoundaryIn);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest002()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* attributeName = "centerX";
+
+ /**
+ * @tc.steps: step1. set style centerX = -32769
+ */
+ int32_t centerX = -32769;
+ JerrySetNumberProperty(styleObj_, attributeName, centerX);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest002 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest002 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.expected: step1. set normal value 20, and check centerX = 22 (use normal value set to check whether system
+ * run normally)
+ */
+ uint8_t centerXNormal = 20;
+ UpdateNumAttributeOrStyleValue(circleComponent, "centerX", centerXNormal, false);
+ EXPECT_TRUE(circleView->GetCenterPosition().x == centerXNormal);
+
+ /**
+ * @tc.steps: step2. set style centerX = -32766
+ */
+ int16_t centerXBoundary = -32766;
+ UpdateNumAttributeOrStyleValue(circleComponent, "centerX", centerXBoundary, false);
+
+ /**
+ * @tc.steps: step3. set style centerX = "*,"
+ */
+ UpdateCharAttributeOrStyleValue(circleComponent, "centerX", "*,", false);
+
+ /**
+ * @tc.expected: step3. check centerX = 0 (use normal value set to check whether system run normally)
+ */
+ EXPECT_TRUE(circleView->GetCenterPosition().x == 0);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest003()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "centerY";
+
+ /**
+ * @tc.steps: step1. set style centerY = 227
+ */
+ uint8_t centerY = 227;
+ JerrySetNumberProperty(styleObj_, styleName, centerY);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest003 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest003 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.expected: step1. check centerY = 227
+ */
+ EXPECT_TRUE(circleView->GetCenterPosition().y == centerY);
+
+ /**
+ * @tc.steps: step2. set attribute centerY = -32768
+ */
+ int16_t centerYBoundary = -32768;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, centerYBoundary, false);
+
+ /**
+ * @tc.expected: step2. check centerY = -32768
+ */
+ EXPECT_TRUE(circleView->GetCenterPosition().y == centerYBoundary);
+
+ /**
+ * @tc.steps: step3. set attribute centerY = 32765
+ */
+ int16_t centerYBoundaryIn = 32765;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, centerYBoundaryIn, false);
+
+ /**
+ * @tc.expected: step3. check centerY = 32765
+ */
+ EXPECT_TRUE(circleView->GetCenterPosition().y == centerYBoundaryIn);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest004()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "centerY";
+
+ /**
+ * @tc.steps: step1. set style centerY = -32769
+ */
+ int32_t centerY = -32769;
+ JerrySetNumberProperty(styleObj_, styleName, centerY);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest003 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest003 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.expected: step1. set normal value 20, and check centerY = 22 (use normal value set to check whether system
+ * run normally)
+ */
+ uint8_t centerYNormal = 20;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, centerYNormal, false);
+ EXPECT_TRUE(circleView->GetCenterPosition().y == centerYNormal);
+
+ /**
+ * @tc.steps: step2. set style centerY = -32766
+ */
+ int16_t centerYBoundary = -32766;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, centerYBoundary, false);
+
+ /**
+ * @tc.steps: step3. set style centerY = "abc"
+ */
+ UpdateCharAttributeOrStyleValue(circleComponent, styleName, "abc", false);
+
+ /**
+ * @tc.expected: step3. check centerY = 0 (use normal value set to check whether system run normally)
+ */
+ EXPECT_TRUE(circleView->GetCenterPosition().y == 0);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest005()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "radius";
+
+ /**
+ * @tc.steps: step1. set style radius = 227
+ */
+ uint8_t radius = 227;
+ JerrySetNumberProperty(styleObj_, styleName, radius);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest005 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest005 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.expected: step1. check radius = 227
+ */
+ EXPECT_TRUE(circleView->GetRadius() == radius);
+
+ /**
+ * @tc.steps: step2. set style radius = 0
+ */
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, 0, false);
+
+ /**
+ * @tc.expected: step2. check radius = 0
+ */
+ EXPECT_TRUE(circleView->GetRadius() == 0);
+
+ /**
+ * @tc.steps: step3. set style radius = 65534
+ */
+ uint16_t radiusBoundary = 65534;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, radiusBoundary, false);
+
+ /**
+ * @tc.expected: step3. check radius = 65534
+ */
+ EXPECT_TRUE(circleView->GetRadius() == radiusBoundary);
+
+ /**
+ * @tc.steps: step4. set style radius = "this is a string"
+ */
+ UpdateCharAttributeOrStyleValue(circleComponent, styleName, "this is a string", false);
+
+ /**
+ * @tc.expected: step4. check radius = 0
+ */
+ EXPECT_TRUE(circleView->GetRadius() == 0);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest006()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "radius";
+
+ /**
+ * @tc.steps: step1. set style radius = -1
+ */
+ JerrySetNumberProperty(styleObj_, styleName, -1);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest006 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest006 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.steps: step2. set style radius = 655355
+ */
+ int32_t radius = 655355;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, radius, false);
+
+ /**
+ * @tc.expected: step2. set normal value 20, and check radius = 20 (use normal value set to check whether system run
+ * normally)
+ */
+ uint8_t radiusNormal = 20;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, radiusNormal, false);
+ EXPECT_TRUE(circleView->GetRadius() == radiusNormal);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest008()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "startAngle";
+
+ /**
+ * @tc.steps: step1. set style startAngle = 0
+ */
+ JerrySetNumberProperty(styleObj_, styleName, 0);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest008 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest008 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.expected: step1. check startAngle = 0
+ */
+ EXPECT_TRUE(circleView->GetStartAngle() == 0);
+
+ /**
+ * @tc.steps: step2. set style startAngle = 360
+ */
+ int16_t startAngle = 360;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, startAngle, false);
+
+ /**
+ * @tc.expected: step2. check startAngle = 360
+ */
+ EXPECT_TRUE(circleView->GetStartAngle() == startAngle);
+
+ /**
+ * @tc.steps: step3. set style startAngle = 361
+ */
+ int16_t startAngleBoundary = 361;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, startAngleBoundary, false);
+
+ /**
+ * @tc.expected: step3. check startAngle = 360
+ */
+ EXPECT_TRUE(circleView->GetStartAngle() == startAngle);
+
+ /**
+ * @tc.steps: step4. set style startAngle = -1
+ */
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, -1, false);
+
+ /**
+ * @tc.expected: step4. check startAngle = 0
+ */
+ EXPECT_TRUE(circleView->GetStartAngle() == 0);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest009()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "startAngle";
+
+ /**
+ * @tc.steps: step1. set unnormal style startAngle = -32769
+ */
+ int32_t startAngle = -32769;
+ JerrySetNumberProperty(styleObj_, styleName, startAngle);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest009 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest009 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.steps: step2. set unnormal style startAngle = 326669
+ */
+ int32_t startAngleLarger = 326669;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, startAngleLarger, false);
+
+ /**
+ * @tc.steps: step3. set style startAngle = 30
+ */
+ uint8_t startAngleNormal = 30;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, startAngleNormal, false);
+
+ /**
+ * @tc.expected: step3. check startAngle = 30
+ */
+ EXPECT_TRUE(circleView->GetStartAngle() == startAngleNormal);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest010()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "totalAngle";
+
+ int16_t startAngle = 30;
+ JerrySetNumberProperty(styleObj_, "startAngle", startAngle);
+
+ /**
+ * @tc.steps: step1. set style totalAngle = -360
+ */
+ int16_t totalAngle = -360;
+ JerrySetNumberProperty(styleObj_, styleName, totalAngle);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest010 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest010 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.expected: step1. check endAngle = -330
+ */
+ int16_t endAngle = -330;
+ EXPECT_TRUE(circleView->GetEndAngle() == endAngle);
+
+ /**
+ * @tc.steps: step2. set style totalAngle = -361
+ */
+ int16_t totalAngleBoundary = -361;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, totalAngleBoundary, false);
+
+ /**
+ * @tc.expected: step2. check endAngle = -330
+ */
+ EXPECT_TRUE(circleView->GetEndAngle() == endAngle);
+
+ /**
+ * @tc.steps: step3. set style totalAngle = 360
+ */
+ int16_t totalAngleBoundaryIn = 360;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, totalAngleBoundaryIn, false);
+
+ /**
+ * @tc.expected: step3. check endAngle = 390
+ */
+ int16_t endAngleUpdate = 390;
+ EXPECT_TRUE(circleView->GetEndAngle() == endAngleUpdate);
+
+ /**
+ * @tc.steps: step4. set style totalAngle = 90
+ */
+ uint8_t totalAngleNormal = 90;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, totalAngleNormal, false);
+
+ /**
+ * @tc.expected: step4. check endAngle = 120
+ */
+ uint8_t endAngleReNew = 120;
+ EXPECT_TRUE(circleView->GetEndAngle() == endAngleReNew);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest011()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "totalAngle";
+ uint8_t startAngle = 30;
+ JerrySetNumberProperty(styleObj_, "startAngle", startAngle);
+
+ /**
+ * @tc.steps: step1. set unnormal style totaldAngle = -32769
+ */
+ int32_t totalAngle = -32769;
+ JerrySetNumberProperty(styleObj_, styleName, totalAngle);
+
+ Component* circleComponent = reinterpret_cast(GetRenderedComponent(componentNameId_));
+ if (circleComponent == nullptr) {
+ printf("ComponentProgressStyleSetTest011 fail\n");
+ TDD_CASE_END();
+ return;
+ }
+ UICircleProgress* circleView = reinterpret_cast(circleComponent->GetComponentRootView());
+ if (circleView == nullptr) {
+ printf("ComponentProgressStyleSetTest011 fail\n");
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+ return;
+ }
+
+ /**
+ * @tc.steps: step2. set unnormal style totalAngle = 326669
+ */
+ int32_t totalAngleBoundary = 326669;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, totalAngleBoundary, false);
+
+ /**
+ * @tc.steps: step3. set style totalAngle = 30
+ */
+ uint8_t totalAngleNormal = 30;
+ UpdateNumAttributeOrStyleValue(circleComponent, styleName, totalAngleNormal, false);
+
+ /**
+ * @tc.expected: step3. check endAngle = 60
+ */
+ uint8_t endAngle = 60;
+ EXPECT_TRUE(circleView->GetEndAngle() == endAngle);
+ delete(circleComponent);
+ circleComponent = nullptr;
+ TDD_CASE_END();
+}
+
+void ArcTddTest::ComponentProgressStyleSetTest012()
+{
+ TDD_CASE_BEGIN();
+ SetCompnentNameId("progress");
+ SetCircleType();
+
+ const char* styleName = "color";
+
+ /**
+ * @tc.steps: step1. set style lineColor = 227
+ */
+ int32_t lineColor = 227;
+ JerrySetNumberProperty(styleObj_, styleName, lineColor);
+
+ Component* circleComponent = reinterpret_cast