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/05/24 07:53:27 UTC

[3/3] incubator-weex git commit: [WEEX-403] Fix waterfall sticky

[WEEX-403] Fix waterfall sticky


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7d28c1cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7d28c1cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7d28c1cb

Branch: refs/heads/master
Commit: 7d28c1cb6bcfbb47a8b3acfc581335698f0fc700
Parents: 5ab00a0
Author: miomin <mi...@foxmail.com>
Authored: Thu May 24 15:28:03 2018 +0800
Committer: YorkShen <sh...@gmail.com>
Committed: Thu May 24 15:53:16 2018 +0800

----------------------------------------------------------------------
 weex_core/Source/core/render/node/render_list.h   |  4 ++--
 weex_core/Source/core/render/node/render_object.h | 13 ++++++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7d28c1cb/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 25b6ed0..abc23cd 100644
--- a/weex_core/Source/core/render/node/render_list.h
+++ b/weex_core/Source/core/render/node/render_list.h
@@ -205,8 +205,8 @@ namespace WeexCore {
         if (Type() == kRenderWaterfall || Type() == kRenderRecycleList) {
             if(child->Type() == kRenderHeader || child->Type() == kRenderFooter) {
                 child->ApplyStyle(WIDTH, to_string(mAvailableWidth), updating);
-            } else if (child->getStypePositionType() == kSticky) {
-                child->ApplyStyle(WIDTH, to_string(GetViewPortWidth()), 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);
             }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7d28c1cb/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 7c45485..c92f4e9 100644
--- a/weex_core/Source/core/render/node/render_object.h
+++ b/weex_core/Source/core/render/node/render_object.h
@@ -64,7 +64,6 @@ namespace WeexCore {
 
     friend class RenderPage;
 
-
   public:
     inline void LayoutBefore() {
       if (isDirty()) {
@@ -210,6 +209,9 @@ namespace WeexCore {
         return kTypeLayout;
       } else if (key == POSITION) {
         setStylePositionType(GetWXCorePositionType(value));
+        if (value == STICKY) {
+          mIsSticky = true;
+        }
         mapInsertOrAssign(mStyles, key, value);
         return kTypeStyle;
       } else if (key == LEFT) {
@@ -438,14 +440,18 @@ namespace WeexCore {
       return mIsRootRender;
     }
 
-    inline bool IsAppendTree(){
+    inline bool IsAppendTree() {
       std::string append = GetAttr(APPEND);
-      if(append == "tree"){
+      if(append == "tree") {
         return true;
       }
       return false;
     }
 
+    inline bool IsSticky() {
+      return mIsSticky;
+    }
+
   private:
     RenderObject *mParentRender;
     StylesMap *mStyles;
@@ -453,6 +459,7 @@ namespace WeexCore {
     EventsSet *mEvents;
     float mViewPortWidth = -1;
     bool mIsRootRender;
+    bool mIsSticky = false;
   };
 } //end WeexCore
 #endif //RenderObject_h