You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2018/06/12 04:44:29 UTC

[05/12] incubator-weex git commit: [WEEX-442][Core] Remove unless include

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_list.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_list.h b/weex_core/Source/core/render/node/render_list.h
index 738e4ea..16d09dc 100644
--- a/weex_core/Source/core/render/node/render_list.h
+++ b/weex_core/Source/core/render/node/render_list.h
@@ -19,320 +19,69 @@
 #ifndef WEEX_PROJECT_RENDERLIST_H
 #define WEEX_PROJECT_RENDERLIST_H
 
-#include <core/css/constants_name.h>
-#include <core/render/node/render_object.h>
-#include <core/css/constants_value.h>
-#include <cmath>
-#include <base/ViewUtils.h>
-#include <core/render/node/factory/render_type.h>
-#include "render_object.h"
+#include "core/render/node/render_object.h"
+#include "core/css/constants_value.h"
 
 namespace WeexCore {
 
   class RenderList : public RenderObject {
 
-    bool mIsPreCalculateCellWidth = false;
-    int mColumnCount = COLUMN_COUNT_NORMAL;
-    float mColumnWidth = AUTO_VALUE;
-    float mAvailableWidth = 0;
-    float mColumnGap = COLUMN_GAP_NORMAL;
-    bool mIsSetFlex = false;
-    std::vector<RenderObject*> cellSlots;
-    std::vector<RenderObject*> cellSlotsCopys;
-    float mLeftGap = 0;
-    float mRightGap = 0;
-
   public:
-      ~RenderList(){
-
-          if(cellSlotsCopys.size() > 0){
-              for(auto it = cellSlotsCopys.begin(); it != cellSlotsCopys.end(); ++it){
-                  RenderObject* child =  *it;
-                  if(child){
-                      delete child;
-                      child = nullptr;
-                  }
-              }
-              cellSlotsCopys.clear();
-          }
 
-          if(cellSlots.size() > 0){
-              for(auto it = cellSlots.begin(); it != cellSlots.end(); ++it){
-                  RenderObject* child =  *it;
-                  if(child){
-                      delete child;
-                      child = nullptr;
-                  }
-              }
-              cellSlots.clear();
-          }
-      }
-      
-  public:
-      void addCellSlotCopyTrack(RenderObject* cellSlot){
-          cellSlot->setParent(this, cellSlot);
-          cellSlotsCopys.push_back(cellSlot);
-      }
-      
-      std::vector<RenderObject*> &CellSlots(){
-          return cellSlots;
-      }
-      
-    std::map<std::string, std::string> *GetDefaultStyle() {
-      std::map<std::string, std::string> *style = new std::map<std::string, std::string>();
+    ~RenderList();
 
-      bool isVertical = true;
-      RenderObject *parent = (RenderObject *) getParent();
+    void addCellSlotCopyTrack(RenderObject *cellSlot);
 
-      if (parent != nullptr && !parent->Type().empty()) {
-          if (parent->Type() == kHList) {
-              isVertical = false;
-          } else if (getOrientation() == HORIZONTAL_VALUE) {
-              isVertical = false;
-          }
-      }
+    void setFlex(const float flex);
 
-      std::string prop = isVertical ? HEIGHT : WIDTH;
+    std::map <std::string, std::string> *GetDefaultStyle();
 
-      if (prop == HEIGHT && isnan(getStyleHeight()) && !mIsSetFlex) {
-        mIsSetFlex = true;
-        style->insert(std::pair<std::string, std::string>(FLEX, "1"));
-      } else if (prop == WIDTH && isnan(getStyleWidth()) && !mIsSetFlex) {
-        mIsSetFlex = true;
-        style->insert(std::pair<std::string, std::string>(FLEX, "1"));
-      }
+    std::map <std::string, std::string> *GetDefaultAttr();
 
-      return style;
-    }
+    void preCalculateCellWidth();
 
-    inline void setFlex(const float flex) {
-        mIsSetFlex = true;
-        WXCoreLayoutNode::setFlex(flex);
-    }
+    std::string calcSpanOffset();
 
-    float calcFreeSpaceAlongMainAxis(const float &width, const float &height, const float &currentLength) const override {
-      return NAN;
-    }
+    float getStyleWidth();
 
-    std::map<std::string, std::string> *GetDefaultAttr() {
-      if (!mIsPreCalculateCellWidth) {
-        preCalculateCellWidth();
-      }
-      return nullptr;
-    }
+    int AddRenderObject(int index, RenderObject *child);
 
+    void AddRenderObjectWidth(RenderObject *child, const bool updating);
 
-    inline void preCalculateCellWidth() {
-        std::map<std::string, std::string> *attrs = new std::map<std::string, std::string>();
-        if (Attributes() != nullptr) {
-            mColumnCount = getColumnCount();
-            mColumnWidth = getColumnWidth();
-            mColumnGap = getColumnGap();
+    void UpdateAttr(std::string key, std::string value);
 
-            mLeftGap = getLeftGap();
-            mRightGap = getRightGap();
+    float getColumnCount();
 
-            mAvailableWidth = getStyleWidth()- getWebPxByWidth(getPaddingLeft(), GetRenderPage()->ViewPortWidth()) - getWebPxByWidth(getPaddingRight(), GetRenderPage()->ViewPortWidth());
+    float getColumnGap();
 
-            if (AUTO_VALUE == mColumnCount && AUTO_VALUE == mColumnWidth) {
-                mColumnCount = COLUMN_COUNT_NORMAL;
-                mColumnWidth = (mAvailableWidth - ((mColumnCount - 1) * mColumnGap)) / mColumnCount;
-                mColumnWidth = mColumnWidth > 0 ? mColumnWidth :0;
-            } else if (AUTO_VALUE == mColumnWidth && AUTO_VALUE != mColumnCount) {
-                mColumnWidth = (mAvailableWidth - mLeftGap - mRightGap - ((mColumnCount - 1) * mColumnGap)) / mColumnCount;
-                mColumnWidth = mColumnWidth > 0 ? mColumnWidth :0;
-            } else if (AUTO_VALUE != mColumnWidth && AUTO_VALUE == mColumnCount) {
-                mColumnCount = (int)round((mAvailableWidth + mColumnGap) / (mColumnWidth + mColumnGap)-0.5f);
-                mColumnCount = mColumnCount > 0 ? mColumnCount :1;
-                if (mColumnCount <= 0) {
-                    mColumnCount = COLUMN_COUNT_NORMAL;
-                }
-                mColumnWidth =((mAvailableWidth + mColumnGap - mLeftGap - mRightGap) / mColumnCount) - mColumnGap;
+    float getColumnWidth();
 
-            } else if(AUTO_VALUE != mColumnWidth && AUTO_VALUE != mColumnCount) {
-                int columnCount = (int)round((mAvailableWidth + mColumnGap - mLeftGap - mRightGap) / (mColumnWidth + mColumnGap)-0.5f);
-                mColumnCount = columnCount > mColumnCount ? mColumnCount :columnCount;
-                if (mColumnCount <= 0) {
-                    mColumnCount = COLUMN_COUNT_NORMAL;
-                }
-                mColumnWidth= ((mAvailableWidth + mColumnGap - mLeftGap - mRightGap) / mColumnCount) - mColumnGap;
-            }
+    float getLeftGap();
 
-            std::string spanOffsets = calcSpanOffset();
+    float getRightGap();
 
-            mIsPreCalculateCellWidth = true;
-            if (getColumnCount() > 0 || getColumnWidth() > 0 || mColumnCount > COLUMN_COUNT_NORMAL) {
-                attrs->insert(std::pair<std::string, std::string>(COLUMN_COUNT, to_string(mColumnCount)));
-                attrs->insert(std::pair<std::string, std::string>(COLUMN_GAP, to_string(mColumnGap)));
-                attrs->insert(std::pair<std::string, std::string>(COLUMN_WIDTH, to_string(mColumnWidth)));
-            }
-            if (spanOffsets.length() > 0) {
-                attrs->insert(std::pair<std::string, std::string>(SPAN_OFFSETS, to_string(spanOffsets)));
-            }
+    int getOrientation();
 
-            for (auto iter = attrs->cbegin(); iter != attrs->cend(); iter++) {
-              RenderObject::UpdateAttr(iter->first, iter->second);
-            }
-        }
-
-      RenderPage *page = GetRenderPage();
-
-      if (page != nullptr)
-        page->SendUpdateAttrAction(this, attrs);
-
-      if (attrs != nullptr) {
-        attrs->clear();
-        delete attrs;
-        attrs = nullptr;
-      }
-    }
-
-    std::string calcSpanOffset() {
-        std::string spanOffsets;
-        if (mLeftGap > 0 || mRightGap > 0) {
-            spanOffsets.append("[");
-            for (int i = 0; i < mColumnCount; i++) {
-                float spanOffset = mLeftGap + i * ((mColumnWidth + mColumnGap) - (mAvailableWidth + mColumnGap) / mColumnCount);
-                spanOffsets.append(to_string(spanOffset));
-                if(i != mColumnCount - 1) {
-                    spanOffsets.append(",");
-                }
-            }
-            spanOffsets.append("]");
-        }
-        return spanOffsets;
-    }
-
-    float getStyleWidth() {
-      float width = getWebPxByWidth(getLayoutWidth(), GetRenderPage()->ViewPortWidth());
-      if (isnan(width) || width <= 0){
-        if(getParent() != nullptr){
-          width = getWebPxByWidth(getParent()->getLayoutWidth(), GetRenderPage()->ViewPortWidth());
-        }
-        if (isnan(width) || width <= 0){
-            width = getWebPxByWidth(RenderObject::getStyleWidth(), GetRenderPage()->ViewPortWidth());
-        }
-      }
-      if (isnan(width) || width <= 0){
-        width = GetViewPortWidth();
-      }
-      return width;
-    }
-
-
-    int AddRenderObject(int index, RenderObject *child) {
-        if(Type() == kRenderRecycleList
-                && (child->Type() == kRenderCellSlot ||  child->Type() == kRenderCell || child->Type()  == kRenderHeader)){
-            child->setParent(this, child);
-            cellSlots.insert(cellSlots.end(), child);
-            index = -1;
-        }else{
-            index = RenderObject::AddRenderObject(index, child);
-        }
-
-        if (!mIsPreCalculateCellWidth) {
-            preCalculateCellWidth();
-        }
-
-        if(mColumnWidth != 0 && !isnan(mColumnWidth)) {
-            AddRenderObjectWidth(child, false);
-        }
-        return index;
-    }
-
-    void AddRenderObjectWidth(RenderObject *child, const bool updating) {
-        if (Type() == kRenderWaterfall || Type() == kRenderRecycleList) {
-            if(child->Type() == kRenderHeader || child->Type() == kRenderFooter) {
-                child->ApplyStyle(WIDTH, to_string(mAvailableWidth), updating);
-            } else if (child->IsSticky()) {
-                child->ApplyStyle(WIDTH, to_string(mAvailableWidth), updating);
-            } else if (child->Type() == kRenderCell || child->Type() == kRenderCellSlot){
-                child->ApplyStyle(WIDTH, to_string(mColumnWidth), updating);
-            }
-        }
-    }
-
-    void UpdateAttr(std::string key, std::string value) {
-      RenderObject::UpdateAttr(key, value);
-
-      if(!GetAttr(COLUMN_COUNT).empty() || !GetAttr(COLUMN_GAP).empty() || !GetAttr(COLUMN_WIDTH).empty()){
-          preCalculateCellWidth();
-
-        if(mColumnWidth == 0 && isnan(mColumnWidth)) {
-          return;
-        }
-
-        int count = getChildCount();
-        for (Index i = 0; i < count; i++) {
-          RenderObject *child = GetChild(i);
-          AddRenderObjectWidth(this, true);
-        }
-      }
-    }
-
-    float getColumnCount() {
-      std::string columnCount = GetAttr(COLUMN_COUNT);
-
-      if (columnCount.empty() || columnCount == AUTO) {
-        return AUTO_VALUE;
-      }
-
-      float columnCountValue = getFloat(columnCount.c_str());
-      return (columnCountValue > 0 && !isnan(columnCountValue)) ? columnCountValue : AUTO_VALUE;
-    }
-
-    float getColumnGap() {
-      std::string columnGap = GetAttr(COLUMN_GAP);
-
-      if (columnGap.empty() || columnGap == NORMAL) {
-        return COLUMN_GAP_NORMAL;
-      }
-
-      float columnGapValue = getFloat(columnGap.c_str());
-      return (columnGapValue > 0 && !isnan(columnGapValue)) ? columnGapValue : AUTO_VALUE;
+    inline float calcFreeSpaceAlongMainAxis(const float &width, const float &height, const float &currentLength) const override {
+      return NAN;
     }
 
-    float getColumnWidth() {
-      std::string columnWidth = GetAttr(COLUMN_WIDTH);
-
-      if (columnWidth.empty() || columnWidth == AUTO) {
-        return AUTO_VALUE;
-      }
-
-      float columnWidthValue = getFloat(columnWidth.c_str());
-      return (columnWidthValue > 0 && !isnan(columnWidthValue)) ? columnWidthValue : 0;
+    inline std::vector<RenderObject *> &CellSlots() {
+      return cellSlots;
     }
 
-      float getLeftGap() {
-          std::string leftGap = GetAttr(LEFT_GAP);
-
-          if (leftGap.empty() || leftGap == AUTO) {
-              return 0;
-          }
-
-          float leftGapValue = getFloat(leftGap.c_str());
-          return (leftGapValue > 0 && !isnan(leftGapValue)) ? leftGapValue : 0;
-      }
-
-      float getRightGap() {
-          std::string rightGap = GetAttr(RIGHT_GAP);
-
-          if (rightGap.empty() || rightGap == AUTO) {
-              return 0;
-          }
-
-          float rightGapValue = getFloat(rightGap.c_str());
-          return (rightGapValue > 0 && !isnan(rightGapValue)) ? rightGapValue : 0;
-      }
-
-    int getOrientation(){
-      std::string direction = GetAttr(SCROLL_DIRECTION);
-      if(HORIZONTAL == direction){
-        return HORIZONTAL_VALUE;
-      }
-      return VERTICAL_VALUE;
-    }
+  private:
 
+    bool mIsPreCalculateCellWidth = false;
+    int mColumnCount = COLUMN_COUNT_NORMAL;
+    float mColumnWidth = AUTO_VALUE;
+    float mAvailableWidth = 0;
+    float mColumnGap = COLUMN_GAP_NORMAL;
+    bool mIsSetFlex = false;
+    std::vector<RenderObject *> cellSlots;
+    std::vector<RenderObject *> cellSlotsCopys;
+    float mLeftGap = 0;
+    float mRightGap = 0;
   };
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_mask.cpp
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_mask.cpp b/weex_core/Source/core/render/node/render_mask.cpp
new file mode 100644
index 0000000..76965a4
--- /dev/null
+++ b/weex_core/Source/core/render/node/render_mask.cpp
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 <cstdlib>
+
+#include "core/render/node/render_mask.h"
+#include "core/config/core_environment.h"
+#include "core/css/constants_name.h"
+#include "base/ViewUtils.h"
+
+namespace WeexCore {
+
+  std::map<std::string, std::string> *RenderMask::GetDefaultStyle() {
+    std::map<std::string, std::string> *style = new std::map<std::string, std::string>();
+
+    int width = WXCoreEnvironment::getInstance()->DeviceWidth();
+    int height = WXCoreEnvironment::getInstance()->DeviceHeight();
+
+    if (WXCoreEnvironment::getInstance()->GetOption("screen_width_pixels") != "" &&
+        WXCoreEnvironment::getInstance()->GetOption("screen_height_pixels") != "") {
+      width = atoi(WXCoreEnvironment::getInstance()->GetOption("screen_width_pixels").c_str());
+      height = atoi(WXCoreEnvironment::getInstance()->GetOption("screen_height_pixels").c_str());
+    }
+
+    if (WXCoreEnvironment::getInstance()->GetOption("status_bar_height") != "") {
+      int statusBarHeight = atoi(
+          WXCoreEnvironment::getInstance()->GetOption("status_bar_height").c_str());
+      height -= statusBarHeight;
+    }
+
+    style->insert(std::pair<std::string, std::string>(POSITION, "absolute"));
+    style->insert(std::pair<std::string, std::string>(WIDTH, to_string(
+        getWebPxByWidth(width, GetViewPortWidth()))));
+    style->insert(std::pair<std::string, std::string>(HEIGHT, to_string(
+        getWebPxByWidth(height, GetViewPortWidth()))));
+    style->insert(std::pair<std::string, std::string>(TOP, "0"));
+    return style;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_mask.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_mask.h b/weex_core/Source/core/render/node/render_mask.h
index 568e759..eb6d4a6 100644
--- a/weex_core/Source/core/render/node/render_mask.h
+++ b/weex_core/Source/core/render/node/render_mask.h
@@ -19,36 +19,16 @@
 #ifndef WEEX_PROJECT_RENDERMASK_H
 #define WEEX_PROJECT_RENDERMASK_H
 
-#include <core/render/node/render_object.h>
-#include <core/config/core_environment.h>
-#include <base/ViewUtils.h>
-#include <cstdlib>
+#include "core/render/node/render_object.h"
 
 namespace WeexCore {
-  class RenderMask : public RenderObject {
-    std::map<std::string, std::string> *GetDefaultStyle() {
-      std::map<std::string, std::string> *style = new std::map<std::string, std::string>();
 
-      int width = WXCoreEnvironment::getInstance()->DeviceWidth();
-      int height = WXCoreEnvironment::getInstance()->DeviceHeight();
+  class RenderMask : public RenderObject {
 
-      if (WXCoreEnvironment::getInstance()->GetOption("screen_width_pixels") != "" &&
-          WXCoreEnvironment::getInstance()->GetOption("screen_height_pixels") != "") {
-        width = atoi(WXCoreEnvironment::getInstance()->GetOption("screen_width_pixels").c_str());
-        height = atoi(WXCoreEnvironment::getInstance()->GetOption("screen_height_pixels").c_str());
-      }
+  public:
 
-      if (WXCoreEnvironment::getInstance()->GetOption("status_bar_height") != "") {
-        int statusBarHeight = atoi(WXCoreEnvironment::getInstance()->GetOption("status_bar_height").c_str());
-        height -= statusBarHeight;
-      }
+    std::map <std::string, std::string> *GetDefaultStyle();
 
-      style->insert(std::pair<std::string, std::string>(POSITION, "absolute"));
-      style->insert(std::pair<std::string, std::string>(WIDTH, to_string(getWebPxByWidth(width, GetViewPortWidth()))));
-      style->insert(std::pair<std::string, std::string>(HEIGHT, to_string(getWebPxByWidth(height, GetViewPortWidth()))));
-      style->insert(std::pair<std::string, std::string>(TOP, "0"));
-      return style;
-    }
   };
 }
 #endif //WEEX_PROJECT_RENDERMASK_H

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_object.cpp
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_object.cpp b/weex_core/Source/core/render/node/render_object.cpp
index 4811ebc..04cc24a 100644
--- a/weex_core/Source/core/render/node/render_object.cpp
+++ b/weex_core/Source/core/render/node/render_object.cpp
@@ -16,16 +16,22 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-#include <core/render/node/render_object.h>
-#include <core/manager/weex_core_manager.h>
+#include "core/render/node/render_object.h"
+#include "core/manager/weex_core_manager.h"
+#include "core/css/constants_name.h"
+#include "core/css/constants_value.h"
+#include "core/css/css_value_getter.h"
+#include "core/layout/layout.h"
+#include "core/render/manager/render_manager.h"
+#include "core/render/page/render_page.h"
+#include "base/ViewUtils.h"
 
-using namespace std;
 namespace WeexCore {
 
   RenderObject::RenderObject() {
-    mStyles = new StylesMap();
-    mAttributes = new AttributesMap();
-    mEvents = new EventsSet();
+    mStyles = new std::map<std::string, std::string>();
+    mAttributes = new std::map<std::string, std::string>();
+    mEvents = new std::set<std::string>();
     mIsRootRender = false;
   }
 
@@ -37,17 +43,19 @@ namespace WeexCore {
       delete mStyles;
       mStyles = nullptr;
     }
+
     if (mAttributes != nullptr) {
       delete mAttributes;
       mAttributes = nullptr;
     }
+
     if (mEvents != nullptr) {
       delete mEvents;
       mEvents = nullptr;
     }
 
-    for(auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) {
-      RenderObject* child = static_cast<RenderObject*>(*it);
+    for (auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) {
+      RenderObject *child = static_cast<RenderObject *>(*it);
       if (child != nullptr) {
         delete child;
         child = nullptr;
@@ -77,7 +85,7 @@ namespace WeexCore {
       return;
 
     for (auto iter = attrs->cbegin(); iter != attrs->cend(); iter++) {
-        UpdateAttr(iter->first, iter->second);
+      UpdateAttr(iter->first, iter->second);
     }
 
     if (attrs != nullptr) {
@@ -95,11 +103,14 @@ namespace WeexCore {
     if (WeexCoreManager::getInstance()->GetMeasureFunctionAdapter() == nullptr)
       return size;
 
-    return WeexCoreManager::getInstance()->GetMeasureFunctionAdapter()->Measure(node, width, widthMeasureMode, height, heightMeasureMode);
+    return WeexCoreManager::getInstance()->GetMeasureFunctionAdapter()->Measure(node, width,
+                                                                                widthMeasureMode,
+                                                                                height,
+                                                                                heightMeasureMode);
   }
 
   void RenderObject::BindMeasureFunc() {
-     setMeasureFunc(measureFunc_Impl);
+    setMeasureFunc(measureFunc_Impl);
   }
 
   void RenderObject::onLayoutBefore() {
@@ -113,4 +124,294 @@ namespace WeexCore {
       return;
     WeexCoreManager::getInstance()->GetMeasureFunctionAdapter()->LayoutAfter(this, width, height);
   }
+
+  StyleType
+  RenderObject::ApplyStyle(const std::string &key, const std::string &value, const bool updating) {
+    bool insert = false;
+    if (value.length() > 0 &&
+        (value.at(0) == JSON_OBJECT_MARK_CHAR || value.at(0) == JSON_ARRAY_MARK_CHAR)) {
+      mapInsertOrAssign(mStyles, key, value);
+      insert = true;
+    }
+
+    if (key == ALIGN_ITEMS) {
+      setAlignItems(GetWXCoreAlignItem(value));
+      return kTypeLayout;
+    } else if (key == ALIGN_SELF) {
+      setAlignSelf(GetWXCoreAlignSelf(value));
+      return kTypeLayout;
+    } else if (key == FLEX) {
+      if (value.empty()) {
+        setFlex(0);
+      } else {
+        float ret = getFloat(value.c_str());
+        if (!isnan(ret)) {
+          setFlex(ret);
+        }
+      }
+      return kTypeLayout;
+    } else if (key == FLEX_DIRECTION) {
+      setFlexDirection(GetWXCoreFlexDirection(value), updating);
+      return kTypeLayout;
+    } else if (key == JUSTIFY_CONTENT) {
+      setJustifyContent(GetWXCoreJustifyContent(value));
+      return kTypeLayout;
+    } else if (key == FLEX_WRAP) {
+      setFlexWrap(GetWXCoreFlexWrap(value));
+      return kTypeLayout;
+    } else if (key == MIN_WIDTH) {
+      UpdateStyleInternal(key, value, NAN, [=](float foo) { setMinWidth(foo, updating); });
+      return kTypeLayout;
+    } else if (key == MIN_HEIGHT) {
+      UpdateStyleInternal(key, value, NAN, [=](float foo) { setMinHeight(foo); });
+      return kTypeLayout;
+    } else if (key == MAX_WIDTH) {
+      UpdateStyleInternal(key, value, NAN, [=](float foo) { setMaxWidth(foo, updating); });
+      return kTypeLayout;
+    } else if (key == MAX_HEIGHT) {
+      UpdateStyleInternal(key, value, NAN, [=](float foo) { setMaxHeight(foo); });
+      return kTypeLayout;
+    } else if (key == HEIGHT) {
+      if (UpdateStyleInternal(key, value, NAN, [=](float foo) { setStyleHeight(foo); })) {
+        setStyleHeightLevel(CSS_STYLE);
+      }
+      return kTypeLayout;
+    } else if (key == WIDTH) {
+      if (UpdateStyleInternal(key, value, NAN, [=](float foo) { setStyleWidth(foo, updating); })) {
+        setStyleWidthLevel(CSS_STYLE);
+      }
+      return kTypeLayout;
+    } else if (key == POSITION) {
+      setStylePositionType(GetWXCorePositionType(value));
+      if (value == STICKY) {
+        mIsSticky = true;
+      }
+      mapInsertOrAssign(mStyles, key, value);
+      return kTypeStyle;
+    } else if (key == LEFT) {
+      UpdateStyleInternal(key, value, NAN,
+                          [=](float foo) { setStylePosition(kPositionEdgeLeft, foo); });
+      return kTypeLayout;
+    } else if (key == TOP) {
+      UpdateStyleInternal(key, value, NAN,
+                          [=](float foo) { setStylePosition(kPositionEdgeTop, foo); });
+      return kTypeLayout;
+    } else if (key == RIGHT) {
+      UpdateStyleInternal(key, value, NAN,
+                          [=](float foo) { setStylePosition(kPositionEdgeRight, foo); });
+      return kTypeLayout;
+    } else if (key == BOTTOM) {
+      UpdateStyleInternal(key, value, NAN,
+                          [=](float foo) { setStylePosition(kPositionEdgeBottom, foo); });
+      return kTypeLayout;
+    } else if (key == MARGIN) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setMargin(kMarginALL, foo); });
+      return kTypeMargin;
+    } else if (key == MARGIN_LEFT) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setMargin(kMarginLeft, foo); });
+      return kTypeMargin;
+    } else if (key == MARGIN_TOP) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setMargin(kMarginTop, foo); });
+      return kTypeMargin;
+    } else if (key == MARGIN_RIGHT) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setMargin(kMarginRight, foo); });
+      return kTypeMargin;
+    } else if (key == MARGIN_BOTTOM) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setMargin(kMarginBottom, foo); });
+      return kTypeMargin;
+    } else if (key == BORDER_WIDTH) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setBorderWidth(kBorderWidthALL, foo); });
+      return kTypeBorder;
+    } else if (key == BORDER_TOP_WIDTH) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setBorderWidth(kBorderWidthTop, foo); });
+      return kTypeBorder;
+    } else if (key == BORDER_RIGHT_WIDTH) {
+      UpdateStyleInternal(key, value, 0,
+                          [=](float foo) { setBorderWidth(kBorderWidthRight, foo); });
+      return kTypeBorder;
+    } else if (key == BORDER_BOTTOM_WIDTH) {
+      UpdateStyleInternal(key, value, 0,
+                          [=](float foo) { setBorderWidth(kBorderWidthBottom, foo); });
+      return kTypeBorder;
+    } else if (key == BORDER_LEFT_WIDTH) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setBorderWidth(kBorderWidthLeft, foo); });
+      return kTypeBorder;
+    } else if (key == PADDING) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setPadding(kPaddingALL, foo); });
+      return kTypePadding;
+    } else if (key == PADDING_LEFT) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setPadding(kPaddingLeft, foo); });
+      return kTypePadding;
+    } else if (key == PADDING_TOP) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setPadding(kPaddingTop, foo); });
+      return kTypePadding;
+    } else if (key == PADDING_RIGHT) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setPadding(kPaddingRight, foo); });
+      return kTypePadding;
+    } else if (key == PADDING_BOTTOM) {
+      UpdateStyleInternal(key, value, 0, [=](float foo) { setPadding(kPaddingBottom, foo); });
+      return kTypePadding;
+    } else {
+      if (!insert) {
+        mapInsertOrAssign(mStyles, key, value);
+      }
+      return kTypeStyle;
+    }
+  }
+
+  const std::string RenderObject::GetStyle(const std::string &key) {
+    if (mStyles == nullptr)
+      return "";
+
+    std::map<std::string, std::string>::iterator iter = mStyles->find(key);
+    if (iter != mStyles->end()) {
+      return iter->second;
+    } else {
+      return "";
+    }
+  }
+
+  const std::string RenderObject::GetAttr(const std::string &key) {
+    if (mAttributes == nullptr)
+      return "";
+
+    std::map<std::string, std::string>::iterator iter = mAttributes->find(key);
+    if (iter != mAttributes->end()) {
+      return iter->second;
+    } else {
+      return "";
+    }
+  }
+
+  float RenderObject::GetViewPortWidth() {
+    if (mViewPortWidth >= 0)
+      return mViewPortWidth;
+
+    RenderPage *page = GetRenderPage();
+    if (page == nullptr)
+      return kDefaultViewPortWidth;
+
+    return page->ViewPortWidth();
+  }
+
+  int RenderObject::AddRenderObject(int index, RenderObject *child) {
+    if (child == nullptr || index < -1) {
+      return index;
+    }
+
+    Index count = getChildCount();
+    index = index >= count ? -1 : index;
+    if (index == -1) {
+      addChildAt(child, getChildCount());
+    } else {
+      addChildAt(child, index);
+    }
+
+    child->SetParentRender(this);
+
+    return index;
+  }
+
+  Index RenderObject::IndexOf(const RenderObject *render) {
+    if (render == nullptr) {
+      return -1;
+    } else {
+      int i = 0;
+      for (auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) {
+        RenderObject *child = static_cast<RenderObject *>(*it);
+        if (child != nullptr) {
+          if (render->Ref() == child->Ref())
+            return i;
+        }
+        ++i;
+      }
+    }
+    return -1;
+  }
+
+  bool RenderObject::UpdateStyleInternal(const std::string key, const std::string value,
+                                         float fallback,
+                                         std::function<void(float)> functor) {
+    bool ret = false;
+    if (value.empty()) {
+      functor(fallback);
+      ret = true;
+    } else {
+      float fvalue = getFloatByViewport(value, GetViewPortWidth());
+      if (!isnan(fvalue)) {
+        functor(fvalue);
+        ret = true;
+      }
+    }
+    return ret;
+  }
+
+  void RenderObject::LayoutBefore() {
+    if (isDirty()) {
+      onLayoutBefore();
+    }
+
+    for (auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) {
+      RenderObject *child = static_cast<RenderObject *>(*it);
+      if (child != nullptr) {
+        child->LayoutBefore();
+      }
+    }
+  }
+
+  void RenderObject::LayoutAfter() {
+    if (hasNewLayout()) {
+      onLayoutAfter(getLayoutWidth(), getLayoutHeight());
+    }
+
+    for (auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) {
+      RenderObject *child = static_cast<RenderObject *>(*it);
+      if (child != nullptr) {
+        child->LayoutAfter();
+      }
+    }
+  }
+
+  void RenderObject::copyFrom(RenderObject *src) {
+    IRenderObject::copyFrom(src);
+    this->mStyles->insert(src->mStyles->begin(), src->mStyles->end());
+    this->mAttributes->insert(src->mAttributes->begin(), src->mAttributes->end());
+    this->mEvents->insert(src->mEvents->begin(), src->mEvents->end());
+  }
+
+  void RenderObject::mapInsertOrAssign(std::map<std::string, std::string> *targetMap,
+                                       const std::string &key, const std::string &value) {
+    std::map<std::string, std::string>::iterator it = targetMap->find(key);
+    if (it != targetMap->end()) {
+      it->second = value;
+    } else {
+      targetMap->insert({key, value});
+    }
+  }
+
+  bool RenderObject::ViewInit() {
+    return (!isnan(getStyleWidth()) && getStyleWidth() > 0) ||
+           (IsRootRender() && GetRenderPage() != nullptr &&
+            GetRenderPage()->GetRenderContainerWidthWrapContent());
+  }
+
+  RenderPage *RenderObject::GetRenderPage() {
+    return RenderManager::GetInstance()->GetPage(PageId());
+  }
+
+  bool RenderObject::IsAppendTree() {
+    std::string append = GetAttr(APPEND);
+    if (append == "tree") {
+      return true;
+    }
+    return false;
+  }
+
+  void RenderObject::UpdateAttr(std::string key, std::string value) {
+    mapInsertOrAssign(mAttributes, key, value);
+  }
+
+  StyleType RenderObject::UpdateStyle(std::string key, std::string value) {
+    return ApplyStyle(key, value, true);
+  }
 } //end WeexCore

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_object.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_object.h b/weex_core/Source/core/render/node/render_object.h
index 062a4c3..ea943c3 100644
--- a/weex_core/Source/core/render/node/render_object.h
+++ b/weex_core/Source/core/render/node/render_object.h
@@ -22,16 +22,9 @@
 #include <string>
 #include <map>
 #include <set>
-#include <core/css/constants_name.h>
-#include <core/css/css_value_getter.h>
-#include <core/layout/layout.h>
-#include <core/render/manager/render_manager.h>
-#include <core/render/node/factory/i_render_object.h>
-#include <base/ViewUtils.h>
-#include <core/render/page/render_page.h>
-#include <core/css/constants_value.h>
 #include <functional>
 
+#include "core/render/node/factory/i_render_object.h"
 
 #define JSON_OBJECT_MARK_CHAR  '{'
 #define JSON_ARRAY_MARK_CHAR  '['
@@ -50,48 +43,21 @@ namespace WeexCore {
     kTypeStyle, kTypeLayout, kTypeMargin, kTypePadding, kTypeBorder
   } StyleType;
 
-  typedef std::map<std::string, std::string>::const_iterator StylesIterator;
-  typedef std::map<std::string, std::string>::const_iterator AttributesIterator;
-  typedef std::set<std::string>::const_iterator EventsIterator;
-  typedef std::map<std::string, std::string> StylesMap;
-  typedef std::map<std::string, std::string> AttributesMap;
-  typedef std::set<std::string> EventsSet;
-
   class RenderObject : public IRenderObject {
 
     friend class RenderPage;
 
   public:
-    inline void LayoutBefore() {
-      if (isDirty()) {
-        onLayoutBefore();
-      }
 
-      for(auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) {
-        RenderObject* child = static_cast<RenderObject*>(*it);
-        if (child != nullptr) {
-          child->LayoutBefore();
-        }
-      }
-    }
+    void LayoutBefore();
 
-    inline void LayoutAfter() {
-      if (hasNewLayout()) {
-        onLayoutAfter(getLayoutWidth(), getLayoutHeight());
-      }
+    void LayoutAfter();
 
-      for(auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) {
-        RenderObject* child = static_cast<RenderObject*>(*it);
-        if (child != nullptr) {
-          child->LayoutAfter();
-        }
-      }
-    }
+    void copyFrom(RenderObject* src);
 
-    inline bool ViewInit() {
-      return (!isnan(getStyleWidth()) && getStyleWidth() > 0) ||
-          (IsRootRender() && GetRenderPage() != nullptr && GetRenderPage()->GetRenderContainerWidthWrapContent());
-    }
+    void mapInsertOrAssign(std::map<std::string, std::string> *targetMap, const std::string& key, const std::string& value);
+
+    bool ViewInit();
 
     virtual std::map<std::string, std::string> *GetDefaultStyle() {
       return nullptr;
@@ -101,38 +67,10 @@ namespace WeexCore {
       return nullptr;
     }
 
-    void copyFrom(RenderObject* src){
-      IRenderObject::copyFrom(src);
-      this->mStyles->insert(src->mStyles->begin(), src->mStyles->end());
-      this->mAttributes->insert(src->mAttributes->begin(), src->mAttributes->end());
-      this->mEvents->insert(src->mEvents->begin(), src->mEvents->end());
-    }
-
-    inline void mapInsertOrAssign(std::map<std::string, std::string> *targetMap, const std::string& key, const std::string& value) {
-      std::map<std::string, std::string>::iterator it = targetMap->find(key);
-      if(it != targetMap->end()){
-        it->second = value;
-      }else{
-        targetMap->insert({key, value});
-      }
-    }
+  protected:
 
-   protected:
-    bool UpdateStyle(const std::string key, const std::string value,
-                      float fallback, std::function<void(float)> functor){
-      bool ret = false;
-      if (value.empty()) {
-        functor(fallback);
-        ret = true;
-      } else {
-        float fvalue = getFloatByViewport(value, GetViewPortWidth());
-        if (!isnan(fvalue)) {
-          functor(fvalue);
-          ret = true;
-        }
-      }
-      return ret;
-    }
+    bool UpdateStyleInternal(const std::string key, const std::string value, float fallback,
+                             std::function<void(float)> functor);
 
   public:
 
@@ -146,174 +84,32 @@ namespace WeexCore {
 
     void onLayoutAfter(float width, float height);
 
-    virtual StyleType ApplyStyle(const std::string &key, const std::string &value, const bool updating) {
-      bool  insert = false;
-      if(value.length() > 0 && (value.at(0) == JSON_OBJECT_MARK_CHAR || value.at(0) == JSON_ARRAY_MARK_CHAR)){
-        mapInsertOrAssign(mStyles, key, value);
-        insert = true;
-      }
-
-      if (key == ALIGN_ITEMS) {
-        setAlignItems(GetWXCoreAlignItem(value));
-        return kTypeLayout;
-      } else if (key == ALIGN_SELF) {
-        setAlignSelf(GetWXCoreAlignSelf(value));
-        return kTypeLayout;
-      } else if (key == FLEX) {
-        if (value.empty()) {
-          setFlex(0);
-        } else {
-          float ret = getFloat(value.c_str());
-          if (!isnan(ret)) {
-            setFlex(ret);
-          }
-        }
-        return kTypeLayout;
-      } else if (key == FLEX_DIRECTION) {
-        setFlexDirection(GetWXCoreFlexDirection(value), updating);
-        return kTypeLayout;
-      } else if (key == JUSTIFY_CONTENT) {
-        setJustifyContent(GetWXCoreJustifyContent(value));
-        return kTypeLayout;
-      } else if (key == FLEX_WRAP) {
-        setFlexWrap(GetWXCoreFlexWrap(value));
-        return kTypeLayout;
-      } else if (key == MIN_WIDTH) {
-        UpdateStyle(key, value, NAN, [=](float foo){setMinWidth(foo, updating);});
-        return kTypeLayout;
-      } else if (key == MIN_HEIGHT) {
-        UpdateStyle(key, value, NAN, [=](float foo){setMinHeight(foo);});
-        return kTypeLayout;
-      } else if (key == MAX_WIDTH) {
-        UpdateStyle(key, value, NAN, [=](float foo){setMaxWidth(foo, updating);});
-        return kTypeLayout;
-      } else if (key == MAX_HEIGHT) {
-        UpdateStyle(key, value, NAN, [=](float foo){setMaxHeight(foo);});
-        return kTypeLayout;
-      } else if (key == HEIGHT) {
-        if(UpdateStyle(key, value, NAN, [=](float foo){setStyleHeight(foo);})){
-          setStyleHeightLevel(CSS_STYLE);
-        }
-        return kTypeLayout;
-      } else if (key == WIDTH) {
-        if(UpdateStyle(key, value, NAN, [=](float foo){setStyleWidth(foo, updating);})){
-          setStyleWidthLevel(CSS_STYLE);
-        }
-        return kTypeLayout;
-      } else if (key == POSITION) {
-        setStylePositionType(GetWXCorePositionType(value));
-        if (value == STICKY) {
-          mIsSticky = true;
-        }
-        mapInsertOrAssign(mStyles, key, value);
-        return kTypeStyle;
-      } else if (key == LEFT) {
-        UpdateStyle(key, value, NAN, [=](float foo){setStylePosition(kPositionEdgeLeft, foo);});
-        return kTypeLayout;
-      } else if (key == TOP) {
-        UpdateStyle(key, value, NAN, [=](float foo){setStylePosition(kPositionEdgeTop, foo);});
-        return kTypeLayout;
-      } else if (key == RIGHT) {
-        UpdateStyle(key, value, NAN, [=](float foo){setStylePosition(kPositionEdgeRight, foo);});
-        return kTypeLayout;
-      } else if (key == BOTTOM) {
-        UpdateStyle(key, value, NAN, [=](float foo){setStylePosition(kPositionEdgeBottom, foo);});
-        return kTypeLayout;
-      } else if (key == MARGIN) {
-        UpdateStyle(key, value, 0, [=](float foo){setMargin(kMarginALL, foo);});
-        return kTypeMargin;
-      } else if (key == MARGIN_LEFT) {
-        UpdateStyle(key, value, 0, [=](float foo){setMargin(kMarginLeft, foo);});
-        return kTypeMargin;
-      } else if (key == MARGIN_TOP) {
-        UpdateStyle(key, value, 0, [=](float foo){setMargin(kMarginTop, foo);});
-        return kTypeMargin;
-      } else if (key == MARGIN_RIGHT) {
-        UpdateStyle(key, value, 0, [=](float foo){setMargin(kMarginRight, foo);});
-        return kTypeMargin;
-      } else if (key == MARGIN_BOTTOM) {
-        UpdateStyle(key, value, 0, [=](float foo){setMargin(kMarginBottom, foo);});
-        return kTypeMargin;
-      } else if (key == BORDER_WIDTH) {
-        UpdateStyle(key, value, 0, [=](float foo){setBorderWidth(kBorderWidthALL, foo);});
-        return kTypeBorder;
-      } else if (key == BORDER_TOP_WIDTH) {
-        UpdateStyle(key, value, 0, [=](float foo){setBorderWidth(kBorderWidthTop, foo);});
-        return kTypeBorder;
-      } else if (key == BORDER_RIGHT_WIDTH) {
-        UpdateStyle(key, value, 0, [=](float foo){setBorderWidth(kBorderWidthRight, foo);});
-        return kTypeBorder;
-      } else if (key == BORDER_BOTTOM_WIDTH) {
-        UpdateStyle(key, value, 0, [=](float foo){setBorderWidth(kBorderWidthBottom, foo);});
-        return kTypeBorder;
-      } else if (key == BORDER_LEFT_WIDTH) {
-        UpdateStyle(key, value, 0, [=](float foo){setBorderWidth(kBorderWidthLeft, foo);});
-        return kTypeBorder;
-      } else if (key == PADDING) {
-        UpdateStyle(key, value, 0, [=](float foo){setPadding(kPaddingALL, foo);});
-        return kTypePadding;
-      } else if (key == PADDING_LEFT) {
-        UpdateStyle(key, value, 0, [=](float foo){setPadding(kPaddingLeft, foo);});
-        return kTypePadding;
-      } else if (key == PADDING_TOP) {
-        UpdateStyle(key, value, 0, [=](float foo){setPadding(kPaddingTop, foo);});
-        return kTypePadding;
-      } else if (key == PADDING_RIGHT) {
-        UpdateStyle(key, value, 0, [=](float foo){setPadding(kPaddingRight, foo);});
-        return kTypePadding;
-      } else if (key == PADDING_BOTTOM) {
-        UpdateStyle(key, value, 0, [=](float foo){setPadding(kPaddingBottom, foo);});
-        return kTypePadding;
-      } else {
-        if(!insert){
-          mapInsertOrAssign(mStyles, key, value);
-        }
-        return kTypeStyle;
-      }
-    }
+    virtual StyleType ApplyStyle(const std::string &key, const std::string &value, const bool updating);
 
     void ApplyDefaultStyle();
 
     void ApplyDefaultAttr();
 
-    inline RenderObject *GetChild(const Index &index) {
-      return static_cast<RenderObject*>(getChildAt(index));
-    }
+    Index IndexOf(const RenderObject *render);
 
-    inline Index IndexOf(const RenderObject *render) {
-      if (render == nullptr) {
-        return -1;
-      } else {
-        int i = 0;
-        for(auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) {
-          RenderObject* child = static_cast<RenderObject*>(*it);
-          if (child != nullptr) {
-            if (render->Ref() == child->Ref())
-              return i;
-          }
-          ++i;
-        }
-      }
-      return -1;
-    }
+    virtual int AddRenderObject(int index, RenderObject *child);
 
-    virtual int AddRenderObject(int index, RenderObject *child) {
+    float GetViewPortWidth();
 
-      if (child == nullptr || index < -1) {
-        return index;
-      }
+    const std::string GetAttr(const std::string &key);
 
-      Index count = getChildCount();
-      index = index >= count ? -1 : index;
-      if (index == -1) {
-        addChildAt(child, getChildCount());
-      } else {
-        addChildAt(child, index);
-      }
+    const std::string GetStyle(const std::string &key);
+
+    RenderPage *GetRenderPage();
+
+    virtual void UpdateAttr(std::string key, std::string value);
+
+    virtual StyleType UpdateStyle(std::string key, std::string value);
 
-      child->SetParentRender(this);
+    bool IsAppendTree();
 
-      return index;
+    inline RenderObject *GetChild(const Index &index) {
+      return static_cast<RenderObject*>(getChildAt(index));
     }
 
     inline void RemoveRenderObject(RenderObject *child) {
@@ -324,21 +120,13 @@ namespace WeexCore {
       mapInsertOrAssign(mAttributes, key, value);
     }
 
-    virtual void UpdateAttr(std::string key, std::string value) {
-      mapInsertOrAssign(mAttributes, key, value);
-    }
-
-    virtual StyleType UpdateStyle(std::string key, std::string value) {
-      return ApplyStyle(key, value, true);
-    }
-
     inline StyleType AddStyle(std::string key, std::string value) {
       return ApplyStyle(key, value, false);
     }
 
     inline void AddEvent(std::string event) {
       if (mEvents == nullptr || mEvents->empty()) {
-          mEvents = new EventsSet();
+          mEvents = new std::set<std::string>();
       }
       mEvents->insert(event);
     }
@@ -347,21 +135,6 @@ namespace WeexCore {
       mEvents->erase(event);
     }
 
-    inline RenderPage *GetRenderPage() {
-      return RenderManager::GetInstance()->GetPage(PageId());
-    }
-
-    inline float GetViewPortWidth() {
-      if (mViewPortWidth >= 0)
-        return mViewPortWidth;
-
-      RenderPage *page = GetRenderPage();
-      if (page == nullptr)
-        return kDefaultViewPortWidth;
-
-      return page->ViewPortWidth();
-    }
-
     inline void SetParentRender(RenderObject *render) {
       mParentRender = render;
     }
@@ -370,66 +143,18 @@ namespace WeexCore {
       return mParentRender;
     }
 
-    inline StylesMap *Styles() const {
+    inline std::map<std::string, std::string> *Styles() const {
       return mStyles;
     }
 
-    inline AttributesMap * Attributes() const {
+    inline std::map<std::string, std::string> * Attributes() const {
       return mAttributes;
     }
 
-    inline EventsSet *Events() const {
+    inline std::set<std::string> *Events() const {
       return mEvents;
     }
 
-    inline StylesIterator StyleItBegin() {
-      return mStyles->begin();
-    }
-
-    inline StylesIterator StyleItEnd() {
-      return mStyles->end();
-    }
-
-    inline AttributesIterator AttrItBegin() {
-      return mAttributes->begin();
-    }
-
-    inline AttributesIterator AttrItEnd() {
-      return mAttributes->end();
-    }
-
-    inline EventsIterator EventItBegin() {
-      return mEvents->begin();
-    }
-
-    inline EventsIterator EventItEnd() {
-      return mEvents->end();
-    }
-
-    inline const std::string GetAttr(const std::string &key) {
-      if (mAttributes == nullptr)
-        return "";
-
-      std::map<std::string, std::string>::iterator iter = mAttributes->find(key);
-      if (iter != mAttributes->end()) {
-        return iter->second;
-      } else {
-        return "";
-      }
-    }
-
-    inline const std::string GetStyle(const std::string &key) {
-      if (mStyles == nullptr)
-        return "";
-
-      std::map<std::string, std::string>::iterator iter = mStyles->find(key);
-      if (iter != mStyles->end()) {
-        return iter->second;
-      } else {
-        return "";
-      }
-    }
-
     inline void MarkRootRender() {
       mIsRootRender = true;
     }
@@ -438,23 +163,16 @@ namespace WeexCore {
       return mIsRootRender;
     }
 
-    inline bool IsAppendTree() {
-      std::string append = GetAttr(APPEND);
-      if(append == "tree") {
-        return true;
-      }
-      return false;
-    }
-
     inline bool IsSticky() {
       return mIsSticky;
     }
 
   private:
+
     RenderObject *mParentRender;
-    StylesMap *mStyles;
-    AttributesMap *mAttributes;
-    EventsSet *mEvents;
+    std::map<std::string, std::string> *mStyles;
+    std::map<std::string, std::string> *mAttributes;
+    std::set<std::string> *mEvents;
     float mViewPortWidth = -1;
     bool mIsRootRender;
     bool mIsSticky = false;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_scroller.cpp
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_scroller.cpp b/weex_core/Source/core/render/node/render_scroller.cpp
new file mode 100644
index 0000000..563f7db
--- /dev/null
+++ b/weex_core/Source/core/render/node/render_scroller.cpp
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 "core/render/node/render_scroller.h"
+#include "core/css/constants_name.h"
+
+namespace WeexCore {
+
+  std::map<std::string, std::string> *RenderScroller::GetDefaultStyle() {
+    std::map<std::string, std::string> *style = new std::map<std::string, std::string>();
+
+    bool isVertical = true;
+    RenderObject *parent = (RenderObject *) getParent();
+
+    if (parent != nullptr) {
+      if (parent->GetAttr(SCROLL_DIRECTION) == HORIZONTAL) {
+        isVertical = false;
+      }
+    }
+
+    std::string prop = isVertical ? HEIGHT : WIDTH;
+
+    if (prop == HEIGHT && isnan(getStyleHeight()) && !mIsSetFlex) {
+      style->insert(std::pair<std::string, std::string>(FLEX, "1"));
+    } else if (prop == WIDTH && isnan(getStyleWidth()) && !mIsSetFlex) {
+      style->insert(std::pair<std::string, std::string>(FLEX, "1"));
+    }
+
+    return style;
+  }
+
+  void RenderScroller::setFlex(const float flex) {
+    mIsSetFlex = true;
+    WXCoreLayoutNode::setFlex(flex);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_scroller.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_scroller.h b/weex_core/Source/core/render/node/render_scroller.h
index 38e804a..cb4e1f0 100644
--- a/weex_core/Source/core/render/node/render_scroller.h
+++ b/weex_core/Source/core/render/node/render_scroller.h
@@ -19,43 +19,19 @@
 #ifndef WEEX_PROJECT_RENDERSCROLLER_H
 #define WEEX_PROJECT_RENDERSCROLLER_H
 
-#include <core/render/node/render_object.h>
+#include "core/render/node/render_object.h"
 
 namespace WeexCore {
   class RenderScroller : public RenderObject {
 
     bool mIsSetFlex = false;
 
-    std::map<std::string, std::string> *GetDefaultStyle() {
-      std::map<std::string, std::string> *style = new std::map<std::string, std::string>();
+    std::map<std::string, std::string> *GetDefaultStyle();
 
-      bool isVertical = true;
-      RenderObject *parent = (RenderObject *) getParent();
+    void setFlex(const float flex);
 
-      if (parent != nullptr) {
-        if (parent->GetAttr(SCROLL_DIRECTION) == HORIZONTAL) {
-          isVertical = false;
-        }
-      }
-
-      std::string prop = isVertical ? HEIGHT : WIDTH;
-
-      if (prop == HEIGHT && isnan(getStyleHeight()) &&  !mIsSetFlex) {
-        style->insert(std::pair<std::string, std::string>(FLEX, "1"));
-      } else if (prop == WIDTH && isnan(getStyleWidth()) &&  !mIsSetFlex) {
-        style->insert(std::pair<std::string, std::string>(FLEX, "1"));
-      }
-
-      return style;
-    }
-
-    inline void setFlex(const float flex) {
-       mIsSetFlex = true;
-       WXCoreLayoutNode::setFlex(flex);
-    }
-
-
-      float calcFreeSpaceAlongMainAxis(const float &width, const float &height, const float &currentLength) const override {
+    inline float calcFreeSpaceAlongMainAxis(const float &width, const float &height,
+                                     const float &currentLength) const override {
       return NAN;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_switch.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_switch.h b/weex_core/Source/core/render/node/render_switch.h
deleted file mode 100644
index f52ede7..0000000
--- a/weex_core/Source/core/render/node/render_switch.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 WEEX_PROJECT_RENDERSWITCH_H
-#define WEEX_PROJECT_RENDERSWITCH_H
-
-#include <core/render/node/render_object.h>
-
-namespace WeexCore {
-  class RenderSwitch : public RenderObject {
-    
-  };
-}
-
-#endif //WEEX_PROJECT_RENDERSWITCH_H

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_text.cpp
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_text.cpp b/weex_core/Source/core/render/node/render_text.cpp
new file mode 100644
index 0000000..4aa3490
--- /dev/null
+++ b/weex_core/Source/core/render/node/render_text.cpp
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 "core/render/node/render_text.h"
+#include "core/render/page/render_page.h"
+
+namespace WeexCore {
+
+  void RenderText::UpdateAttr(std::string key, std::string value) {
+    RenderObject::UpdateAttr(key, value);
+    markDirty();
+  }
+
+  StyleType RenderText::UpdateStyle(std::string key, std::string value) {
+    StyleType resultType = RenderObject::ApplyStyle(key, value, true);
+    markDirty();
+    return resultType;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_text.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_text.h b/weex_core/Source/core/render/node/render_text.h
index 165e8a7..804b298 100644
--- a/weex_core/Source/core/render/node/render_text.h
+++ b/weex_core/Source/core/render/node/render_text.h
@@ -19,22 +19,16 @@
 #ifndef WEEX_PROJECT_RENDERTEXT_H
 #define WEEX_PROJECT_RENDERTEXT_H
 
-#include <core/render/node/render_object.h>
-#include <core/render/page/render_page.h>
+#include "core/render/node/render_object.h"
 
 namespace WeexCore {
   class RenderText : public RenderObject {
+
   private:
-    inline void UpdateAttr(std::string key, std::string value) {
-      RenderObject::UpdateAttr(key, value);
-      markDirty();
-    }
 
-    inline StyleType UpdateStyle(std::string key, std::string value) {
-      StyleType resultType = RenderObject::ApplyStyle(key, value, true);
-      markDirty();
-      return resultType;
-    }
+    void UpdateAttr(std::string key, std::string value);
+
+    StyleType UpdateStyle(std::string key, std::string value);
   };
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/node/render_textarea.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/node/render_textarea.h b/weex_core/Source/core/render/node/render_textarea.h
deleted file mode 100644
index f15569d..0000000
--- a/weex_core/Source/core/render/node/render_textarea.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 WEEX_PROJECT_RENDERTEXTAREA_H
-#define WEEX_PROJECT_RENDERTEXTAREA_H
-
-#include <core/render/node/render_input.h>
-
-namespace WeexCore {
-  class RenderTextArea : public RenderInput {
-
-  };
-}
-
-#endif //WEEX_PROJECT_RENDERTEXTAREA_H

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/page/render_page.cpp
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/page/render_page.cpp b/weex_core/Source/core/render/page/render_page.cpp
index cc2b4c9..82e14d7 100644
--- a/weex_core/Source/core/render/page/render_page.cpp
+++ b/weex_core/Source/core/render/page/render_page.cpp
@@ -16,26 +16,27 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-#include <core/render/action/render_action_add_element.h>
-#include <core/render/action/render_action_remove_element.h>
-#include <core/render/action/render_action_move_element.h>
-#include <core/render/action/render_action_createbody.h>
-#include <core/render/action/render_action_update_style.h>
-#include <core/render/action/render_action_update_attr.h>
-#include <core/render/action/render_action_layout.h>
-#include <core/render/action/render_action_createfinish.h>
-#include <core/render/action/render_action_appendtree_createfinish.h>
-#include <core/layout/layout.h>
-#include <core/moniter/render_performance.h>
-#include <core/config/core_environment.h>
-#include <base/ViewUtils.h>
-#include <core/render/action/render_action_add_event.h>
-#include <core/render/action/render_action_remove_event.h>
-#include <core/css/constants_value.h>
-#include <core/render/node/factory/render_type.h>
-#include <core/render/node/render_list.h>
-#include <core/manager/weex_core_manager.h>
-#include "render_page.h"
+#include "core/render/action/render_action_add_element.h"
+#include "core/render/action/render_action_remove_element.h"
+#include "core/render/action/render_action_move_element.h"
+#include "core/render/action/render_action_createbody.h"
+#include "core/render/action/render_action_update_style.h"
+#include "core/render/action/render_action_update_attr.h"
+#include "core/render/action/render_action_layout.h"
+#include "core/render/action/render_action_createfinish.h"
+#include "core/render/action/render_action_appendtree_createfinish.h"
+#include "core/layout/layout.h"
+#include "core/moniter/render_performance.h"
+#include "core/config/core_environment.h"
+#include "base/ViewUtils.h"
+#include "core/render/action/render_action_add_event.h"
+#include "core/render/action/render_action_remove_event.h"
+#include "core/css/constants_value.h"
+#include "core/render/node/factory/render_type.h"
+#include "core/render/node/render_list.h"
+#include "core/manager/weex_core_manager.h"
+#include "base/TimeUtils.h"
+#include "core/render/page/render_page.h"
 #include "core/render/manager/render_manager.h"
 #include "core/render/node/render_object.h"
 
@@ -259,40 +260,40 @@ namespace WeexCore {
             if (margin == nullptr) {
               margin = new std::vector<std::pair<std::string, std::string>>();
             }
-            render->UpdateStyle((*iter).first,
-                                (*iter).second,
-                                0,
-                                [=, &flag](float foo) {
-                                  (*iter).second = to_string(foo),
-                                      margin->insert(margin->end(), (*iter)),
-                                  flag = true;
-                                });
+            render->UpdateStyleInternal((*iter).first,
+                                        (*iter).second,
+                                        0,
+                                        [=, &flag](float foo) {
+                                          (*iter).second = to_string(foo),
+                                              margin->insert(margin->end(), (*iter)),
+                                          flag = true;
+                                        });
             break;
           case kTypePadding:
             if (padding == nullptr) {
               padding = new std::vector<std::pair<std::string, std::string>>();
             }
-            render->UpdateStyle((*iter).first,
-                                (*iter).second,
-                                0,
-                                [=, &flag](float foo) {
-                                  (*iter).second = to_string(foo),
-                                      padding->insert(padding->end(), (*iter)),
-                                  flag = true;
-                                });
+            render->UpdateStyleInternal((*iter).first,
+                                        (*iter).second,
+                                        0,
+                                        [=, &flag](float foo) {
+                                          (*iter).second = to_string(foo),
+                                              padding->insert(padding->end(), (*iter)),
+                                          flag = true;
+                                        });
             break;
           case kTypeBorder:
             if (border == nullptr) {
               border = new std::vector<std::pair<std::string, std::string>>();
             }
-            render->UpdateStyle((*iter).first,
-                                (*iter).second,
-                                0,
-                                [=, &flag](float foo) {
-                                  (*iter).second = to_string(foo),
-                                      border->insert(border->end(), (*iter)),
-                                  flag = true;
-                                });
+            render->UpdateStyleInternal((*iter).first,
+                                        (*iter).second,
+                                        0,
+                                        [=, &flag](float foo) {
+                                          (*iter).second = to_string(foo),
+                                              border->insert(border->end(), (*iter)),
+                                          flag = true;
+                                        });
             break;
         }
       }
@@ -397,7 +398,7 @@ namespace WeexCore {
 
     render->AddEvent(event);
 
-    render_action *action = new RenderActionAddEvent(mPageId, ref, event);
+    RenderAction *action = new RenderActionAddEvent(mPageId, ref, event);
     PostRenderAction(action);
     return true;
   }
@@ -409,7 +410,7 @@ namespace WeexCore {
 
     render->RemoveEvent(event);
 
-    render_action *action = new RenderActionRemoveEvent(mPageId, ref, event);
+    RenderAction *action = new RenderActionRemoveEvent(mPageId, ref, event);
     PostRenderAction(action);
     return true;
   }
@@ -432,7 +433,7 @@ namespace WeexCore {
     }
   }
 
-  void RenderPage::PostRenderAction(render_action *action) {
+  void RenderPage::PostRenderAction(RenderAction *action) {
     if (action != nullptr) {
       action->ExecuteAction();
     }
@@ -471,7 +472,7 @@ namespace WeexCore {
     if (render == nullptr)
       return;
 
-    render_action *action = new RenderActionCreateBody(PageId(), render);
+    RenderAction *action = new RenderActionCreateBody(PageId(), render);
     PostRenderAction(action);
 
     Index i = 0;
@@ -495,7 +496,7 @@ namespace WeexCore {
         willLayout = false;
     }
 
-    render_action *action = new RenderActionAddElement(PageId(), child, parent, index, willLayout);
+    RenderAction *action = new RenderActionAddElement(PageId(), child, parent, index, willLayout);
     PostRenderAction(action);
 
     Index i = 0;
@@ -525,12 +526,12 @@ namespace WeexCore {
   }
 
   void RenderPage::SendRemoveElementAction(const std::string &ref) {
-    render_action *action = new RenderActionRemoveElement(PageId(), ref);
+    RenderAction *action = new RenderActionRemoveElement(PageId(), ref);
     PostRenderAction(action);
   }
 
   void RenderPage::SendMoveElementAction(const std::string &ref, const std::string &parentRef, int index) {
-    render_action *action = new RenderActionMoveElement(PageId(), ref, parentRef, index);
+    RenderAction *action = new RenderActionMoveElement(PageId(), ref, parentRef, index);
     PostRenderAction(action);
   }
 
@@ -538,7 +539,7 @@ namespace WeexCore {
     if (render == nullptr)
       return;
 
-    render_action *action = new RenderActionLayout(PageId(), render, index);
+    RenderAction *action = new RenderActionLayout(PageId(), render, index);
     PostRenderAction(action);
   }
 
@@ -547,13 +548,13 @@ namespace WeexCore {
                                          std::vector<std::pair<std::string, std::string>> *margin,
                                          std::vector<std::pair<std::string, std::string>> *padding,
                                          std::vector<std::pair<std::string, std::string>> *border) {
-    render_action *action = new RenderActionUpdateStyle(PageId(), render->Ref(), style, margin, padding, border);
+    RenderAction *action = new RenderActionUpdateStyle(PageId(), render->Ref(), style, margin, padding, border);
     PostRenderAction(action);
   }
 
   void RenderPage::SendUpdateAttrAction(RenderObject *render,
                                         std::vector<std::pair<std::string, std::string>> *attrs) {
-    render_action *action = new RenderActionUpdateAttr(PageId(), render->Ref(), attrs);
+    RenderAction *action = new RenderActionUpdateAttr(PageId(), render->Ref(), attrs);
     PostRenderAction(action);
   }
 
@@ -564,7 +565,7 @@ namespace WeexCore {
       vAttrs->insert(vAttrs->begin(), std::pair<std::string, std::string>(iter->first, iter->second));
     }
 
-    render_action *action = new RenderActionUpdateAttr(PageId(), render->Ref(), vAttrs);
+    RenderAction *action = new RenderActionUpdateAttr(PageId(), render->Ref(), vAttrs);
     PostRenderAction(action);
 
     if (vAttrs != nullptr) {
@@ -575,12 +576,12 @@ namespace WeexCore {
   }
 
   void RenderPage::SendCreateFinishAction() {
-    render_action *action = new RenderActionCreateFinish(PageId());
+    RenderAction *action = new RenderActionCreateFinish(PageId());
     PostRenderAction(action);
   }
 
   void RenderPage::SendAppendTreeCreateFinish(const std::string &ref) {
-    render_action *action = new RenderActionAppendTreeCreateFinish(PageId(), ref);
+    RenderAction *action = new RenderActionAppendTreeCreateFinish(PageId(), ref);
     PostRenderAction(action);
   }
 
@@ -621,6 +622,15 @@ namespace WeexCore {
     }
   }
 
+  RenderObject* RenderPage::GetRenderObject(const std::string &ref) {
+    std::map<std::string, RenderObject *>::iterator iter = mRenderObjectRegisterMap.find(ref);
+    if (iter != mRenderObjectRegisterMap.end()) {
+      return iter->second;
+    } else {
+      return nullptr;
+    }
+  }
+
   void RenderPage::OnRenderPageInit() {
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/19406510/weex_core/Source/core/render/page/render_page.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/core/render/page/render_page.h b/weex_core/Source/core/render/page/render_page.h
index 369d057..36bc583 100644
--- a/weex_core/Source/core/render/page/render_page.h
+++ b/weex_core/Source/core/render/page/render_page.h
@@ -29,7 +29,7 @@ namespace WeexCore {
 
   constexpr float kLayoutFirstScreenOverflowRadio = 1.2f;
 
-  class render_action;
+  class RenderAction;
 
   class RenderObject;
 
@@ -55,12 +55,11 @@ namespace WeexCore {
 
     void SendLayoutAction(RenderObject *render, int index);
 
-    void
-    SendUpdateStyleAction(RenderObject *render,
-                          std::vector<std::pair<std::string, std::string>> *style,
-                          std::vector<std::pair<std::string, std::string>> *margin,
-                          std::vector<std::pair<std::string, std::string>> *padding,
-                          std::vector<std::pair<std::string, std::string>> *border);
+    void SendUpdateStyleAction(RenderObject *render,
+                               std::vector <std::pair<std::string, std::string>> *style,
+                               std::vector <std::pair<std::string, std::string>> *margin,
+                               std::vector <std::pair<std::string, std::string>> *padding,
+                               std::vector <std::pair<std::string, std::string>> *border);
 
     void SendUpdateAttrAction(RenderObject *render, std::vector<std::pair<std::string, std::string>> *attrs);
 
@@ -68,12 +67,9 @@ namespace WeexCore {
 
     void SendAppendTreeCreateFinish(const std::string &ref);
 
-    void PostRenderAction(render_action *action);
+    void PostRenderAction(RenderAction *action);
 
   public:
-    static constexpr bool useVSync = true;
-    std::atomic_bool needLayout{false};
-    std::atomic_bool hasForeLayoutAction{false};
 
     explicit RenderPage(std::string pageId);
 
@@ -93,7 +89,8 @@ namespace WeexCore {
 
     bool UpdateAttr(const std::string &ref, std::vector<std::pair<std::string, std::string>> *attrs);
 
-    void SetDefaultHeightAndWidthIntoRootRender(const float defaultWidth, const float defaultHeight, const bool isWidthWrapContent, const bool isHeightWrapContent);
+    void SetDefaultHeightAndWidthIntoRootRender(const float defaultWidth, const float defaultHeight,
+                                                const bool isWidthWrapContent, const bool isHeightWrapContent);
 
     bool AddEvent(const std::string &ref, const std::string &event);
 
@@ -117,17 +114,23 @@ namespace WeexCore {
 
     void SendUpdateAttrAction(RenderObject *render, std::map<std::string, std::string> *attrs);
 
-    inline RenderObject *GetRenderObject(const std::string &ref) {
-        std::map<std::string, RenderObject *>::iterator iter = mRenderObjectRegisterMap.find(ref);
-        if (iter != mRenderObjectRegisterMap.end()) {
-            return iter->second;
-        } else {
-            return nullptr;
-        }
-    }
+    RenderObject *GetRenderObject(const std::string &ref);
 
     void SetRootRenderObject(RenderObject *root);
 
+    // ****** Life Cycle ****** //
+
+    void OnRenderPageInit();
+
+    void OnRenderProcessStart();
+
+    void OnRenderProcessExited();
+
+    void OnRenderProcessGone();
+
+    void OnRenderPageClose();
+
+
     inline std::string PageId() {
       return mPageId;
     }
@@ -156,19 +159,14 @@ namespace WeexCore {
       return isRenderContainerWidthWrapContent.load();
     }
 
-    // ****** Life Cycle ****** //
-
-    void OnRenderPageInit();
-
-    void OnRenderProcessStart();
-
-    void OnRenderProcessExited();
-
-    void OnRenderProcessGone();
+  public:
 
-    void OnRenderPageClose();
+    static constexpr bool useVSync = true;
+    std::atomic_bool needLayout{false};
+    std::atomic_bool hasForeLayoutAction{false};
 
   private:
+
     bool mAlreadyCreateFinish = false;
     float mViewPortWidth;
     RenderObject *render_root = nullptr;