[WEEX-442][Core] C++ code style : function name
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8f8b214f Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8f8b214f Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8f8b214f Branch: refs/heads/release Commit: 8f8b214f3275d71ee79a027920a330fcc810f07b Parents: e1c9dd5 Author: miomin <[email protected]> Authored: Mon Jun 11 17:30:50 2018 +0800 Committer: YorkShen <[email protected]> Committed: Tue Jun 12 12:44:03 2018 +0800 ---------------------------------------------------------------------- .../native_render_object_utils_impl_android.cpp | 21 +- weex_core/Source/core/layout/layout.h | 11 +- .../layout/measure_func_adapter_impl_android.h | 2 +- weex_core/Source/core/parser/dom_wson.cpp | 2 +- .../render/action/render_action_add_element.cpp | 46 ++--- .../render/action/render_action_add_element.h | 24 +-- .../render/action/render_action_add_event.cpp | 12 +- .../render/action/render_action_add_event.h | 6 +- .../render_action_appendtree_createfinish.cpp | 8 +- .../render_action_appendtree_createfinish.h | 4 +- .../render/action/render_action_createbody.cpp | 36 ++-- .../render/action/render_action_createbody.h | 18 +- .../action/render_action_createfinish.cpp | 4 +- .../render/action/render_action_createfinish.h | 2 +- .../core/render/action/render_action_layout.cpp | 30 +-- .../core/render/action/render_action_layout.h | 18 +- .../action/render_action_move_element.cpp | 16 +- .../render/action/render_action_move_element.h | 8 +- .../action/render_action_remove_element.cpp | 8 +- .../action/render_action_remove_element.h | 4 +- .../action/render_action_remove_event.cpp | 12 +- .../render/action/render_action_remove_event.h | 6 +- .../render/action/render_action_update_attr.cpp | 12 +- .../render/action/render_action_update_attr.h | 6 +- .../action/render_action_update_style.cpp | 24 +-- .../render/action/render_action_update_style.h | 12 +- .../core/render/manager/render_manager.cpp | 8 +- .../Source/core/render/manager/render_manager.h | 2 +- .../core/render/node/factory/render_creator.cpp | 4 +- .../node/factory/render_object_interface.h | 38 ++-- .../Source/core/render/node/render_appbar.cpp | 12 +- .../Source/core/render/node/render_appbar.h | 4 +- .../Source/core/render/node/render_list.cpp | 192 +++++++++---------- weex_core/Source/core/render/node/render_list.h | 51 ++--- .../Source/core/render/node/render_object.cpp | 121 +++++++----- .../Source/core/render/node/render_object.h | 88 ++++----- .../Source/core/render/node/render_scroller.cpp | 10 +- .../Source/core/render/node/render_scroller.h | 6 +- .../Source/core/render/page/render_page.cpp | 30 +-- 39 files changed, 468 insertions(+), 450 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/android/bridge/impl/native_render_object_utils_impl_android.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/android/bridge/impl/native_render_object_utils_impl_android.cpp b/weex_core/Source/android/bridge/impl/native_render_object_utils_impl_android.cpp index 9fc1a39..dcee337 100644 --- a/weex_core/Source/android/bridge/impl/native_render_object_utils_impl_android.cpp +++ b/weex_core/Source/android/bridge/impl/native_render_object_utils_impl_android.cpp @@ -80,12 +80,13 @@ static void UpdateRenderObjectAttr(JNIEnv* env, jclass jcaller, static jlong CopyRenderObject(JNIEnv* env, jclass jcaller, jlong ptr){ RenderObject *render = convert_long_to_render_object(ptr); - RenderObject *copy = (RenderObject*)RenderCreator::GetInstance()->CreateRender(render->Type(), render->Ref()); - copy->copyFrom(render); - if(render->Type() == WeexCore::kRenderCellSlot || render->Type() == WeexCore::kRenderCell){ + RenderObject *copy = (RenderObject*)RenderCreator::GetInstance()->CreateRender(render->type(), + render->ref()); + copy->CopyFrom(render); + if(render->type() == WeexCore::kRenderCellSlot || render->type() == WeexCore::kRenderCell){ RenderList* renderList = static_cast<RenderList*>(render->getParent()); if(renderList != nullptr){ - renderList->addCellSlotCopyTrack(copy); + renderList->AddCellSlotCopyTrack(copy); }else{ __android_log_print(ANDROID_LOG_ERROR, " LayoutRenderObject","copy error parent null"); } @@ -94,7 +95,7 @@ static jlong CopyRenderObject(JNIEnv* env, jclass jcaller, jlong ptr){ } static void showRenderObjectLayout(RenderObject *renderObject, int level){ - LOGE("RenderObject layout %s %d %p %f %f %f %f ", renderObject->Type().c_str(), + LOGE("RenderObject layout %s %d %p %f %f %f %f ", renderObject->type().c_str(), renderObject->getStypePositionType(), renderObject, renderObject->getLayoutHeight(), renderObject->getLayoutWidth(), renderObject->getLayoutPositionLeft(), renderObject->getLayoutPositionRight()); @@ -123,11 +124,11 @@ static jint LayoutRenderObject(JNIEnv* env, jclass jcaller, } RenderObject *render = convert_long_to_render_object(ptr); - if(render->Type() == WeexCore::kRenderCell || render->Type() == WeexCore::kRenderCellSlot){ + if(render->type() == WeexCore::kRenderCell || render->type() == WeexCore::kRenderCellSlot){ RenderList* renderList = static_cast<RenderList*>(render->getParent()); if(renderList != nullptr){ - if(renderList->getColumnCount() > 1 && renderList->getColumnWidth() > 0){ - renderPageSize.first = renderList->getColumnWidth(); + if(renderList->TakeColumnCount() > 1 && renderList->TakeColumnWidth() > 0){ + renderPageSize.first = renderList->TakeColumnWidth(); } } } @@ -137,9 +138,9 @@ static jint LayoutRenderObject(JNIEnv* env, jclass jcaller, render->setStyleWidthLevel(CSS_STYLE); } - render->LayoutBefore(); + render->LayoutBeforeImpl(); render->calculateLayout(renderPageSize); - render->LayoutAfter(); + render->LayoutAfterImpl(); return (jint)render->getLayoutHeight(); } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/layout/layout.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/layout/layout.h b/weex_core/Source/core/layout/layout.h index 7bd32dc..aaf013e 100644 --- a/weex_core/Source/core/layout/layout.h +++ b/weex_core/Source/core/layout/layout.h @@ -375,12 +375,13 @@ namespace WeexCore { inline bool isWrapRequired(const float &width, const float &height, const float ¤tLength, const float &childLength) const { - float freeMainSize = calcFreeSpaceAlongMainAxis(width, height, currentLength); + float freeMainSize = CalculateFreeSpaceAlongMainAxis(width, height, currentLength); return !isSingleFlexLine(freeMainSize) && freeMainSize < childLength; } //If width/height is NAN, ret is NAN, which property we use on purpose. - virtual float calcFreeSpaceAlongMainAxis(const float &width, const float &height, const float ¤tLength) const{ + virtual float CalculateFreeSpaceAlongMainAxis(const float &width, const float &height, + const float ¤tLength) const{ float ret; if(isMainAxisHorizontal(this)){ ret = width - sumPaddingBorderAlongAxis(this, true) - currentLength; @@ -641,11 +642,11 @@ namespace WeexCore { std::tuple<bool, float, float> calculateBFCDimension(const std::pair<float,float>&); - virtual void onLayoutBefore() { + virtual void OnLayoutBefore() { } - virtual void onLayoutAfter(float width, float height) { + virtual void OnLayoutAfter(float width, float height) { } @@ -1017,7 +1018,7 @@ namespace WeexCore { return mCssStyle->mAlignSelf; } - virtual void setFlex(const float flex) { + virtual void set_flex(const float flex) { if (mCssStyle->mFlexGrow != flex) { mCssStyle->mFlexGrow = flex; markDirty(); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/layout/measure_func_adapter_impl_android.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/layout/measure_func_adapter_impl_android.h b/weex_core/Source/core/layout/measure_func_adapter_impl_android.h index 1795c78..38af830 100644 --- a/weex_core/Source/core/layout/measure_func_adapter_impl_android.h +++ b/weex_core/Source/core/layout/measure_func_adapter_impl_android.h @@ -89,7 +89,7 @@ namespace WeexCore { if (!node->haveMeasureFunc()) { return nullptr; } - return Bridge_Impl_Android::getInstance()->getMeasureFunc(((RenderObject *) node)->PageId().c_str(), convert_render_object_to_long(node)); + return Bridge_Impl_Android::getInstance()->getMeasureFunc(((RenderObject *) node)->page_id().c_str(), convert_render_object_to_long(node)); } }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/parser/dom_wson.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/parser/dom_wson.cpp b/weex_core/Source/core/parser/dom_wson.cpp index 46adcd9..1e63667 100644 --- a/weex_core/Source/core/parser/dom_wson.cpp +++ b/weex_core/Source/core/parser/dom_wson.cpp @@ -63,7 +63,7 @@ namespace WeexCore { }else if (0 == strcmp(objectKey.c_str(), "type")) { renderType = parser.nextStringUTF8(parser.nextType()); render = (RenderObject *) RenderCreator::GetInstance()->CreateRender(renderType, ref); - render->SetPageId(pageId); + render->set_page_id(pageId); if (parent != nullptr){ parent->AddRenderObject(index, render); } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_add_element.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_add_element.cpp b/weex_core/Source/core/render/action/render_action_add_element.cpp index 46cff05..aa4fa67 100644 --- a/weex_core/Source/core/render/action/render_action_add_element.cpp +++ b/weex_core/Source/core/render/action/render_action_add_element.cpp @@ -27,31 +27,31 @@ namespace WeexCore { const RenderObject *render, const RenderObject *parent, int index, bool will_layout) { - this->attributes = render->Attributes(); - this->styles = render->Styles(); - this->events = render->Events(); - this->margins = render->GetMargins(); - this->paddings = render->GetPaddings(); - this->borders = render->GetBorders(); - this->page_id = page_id; - this->component_type = render->Type(); - this->ref = render->Ref(); - this->parent_ref = parent->Ref(); - this->index = index; - this->will_layout = will_layout; + this->attributes_ = render->attributes(); + this->styles_ = render->styles(); + this->events_ = render->events(); + this->margins_ = render->GetMargins(); + this->paddings_ = render->GetPaddings(); + this->borders_ = render->GetBorders(); + this->page_id_ = page_id; + this->component_type_ = render->type(); + this->ref_ = render->ref(); + this->parent_ref_ = parent->ref(); + this->index_ = index; + this->will_layout_ = will_layout; } void RenderActionAddElement::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callAddElement(this->page_id.c_str(), - this->component_type.c_str(), - this->ref.c_str(), - this->index, - this->parent_ref.c_str(), - this->styles, - this->attributes, - this->events, this->margins, - this->paddings, - this->borders, - this->will_layout); + WeexCoreManager::getInstance()->getPlatformBridge()->callAddElement(this->page_id_.c_str(), + this->component_type_.c_str(), + this->ref_.c_str(), + this->index_, + this->parent_ref_.c_str(), + this->styles_, + this->attributes_, + this->events_, this->margins_, + this->paddings_, + this->borders_, + this->will_layout_); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_add_element.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_add_element.h b/weex_core/Source/core/render/action/render_action_add_element.h index 69b9d06..be7c6d7 100644 --- a/weex_core/Source/core/render/action/render_action_add_element.h +++ b/weex_core/Source/core/render/action/render_action_add_element.h @@ -40,18 +40,18 @@ namespace WeexCore { void ExecuteAction(); public: - std::map<std::string, std::string> *styles; - std::map<std::string, std::string> *attributes; - std::set<std::string> *events; - WXCoreMargin margins; - WXCorePadding paddings; - WXCoreBorderWidth borders; - std::string page_id; - std::string component_type; - std::string parent_ref; - std::string ref; - int index; - bool will_layout; + std::map<std::string, std::string> *styles_; + std::map<std::string, std::string> *attributes_; + std::set<std::string> *events_; + WXCoreMargin margins_; + WXCorePadding paddings_; + WXCoreBorderWidth borders_; + std::string page_id_; + std::string component_type_; + std::string parent_ref_; + std::string ref_; + int index_; + bool will_layout_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_add_event.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_add_event.cpp b/weex_core/Source/core/render/action/render_action_add_event.cpp index 98bb6c8..bcd4aa5 100644 --- a/weex_core/Source/core/render/action/render_action_add_event.cpp +++ b/weex_core/Source/core/render/action/render_action_add_event.cpp @@ -24,15 +24,15 @@ namespace WeexCore { RenderActionAddEvent::RenderActionAddEvent(const std::string &page_id, const std::string &ref, const std::string &event) { - this->page_id = page_id; - this->ref = ref; - this->event = event; + this->page_id_ = page_id; + this->ref_ = ref; + this->event_ = event; } void RenderActionAddEvent::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callAddEvent(this->page_id.c_str(), - this->ref.c_str(), - this->event.c_str()); + WeexCoreManager::getInstance()->getPlatformBridge()->callAddEvent(this->page_id_.c_str(), + this->ref_.c_str(), + this->event_.c_str()); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_add_event.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_add_event.h b/weex_core/Source/core/render/action/render_action_add_event.h index 852549c..6347177 100644 --- a/weex_core/Source/core/render/action/render_action_add_event.h +++ b/weex_core/Source/core/render/action/render_action_add_event.h @@ -34,9 +34,9 @@ namespace WeexCore { void ExecuteAction(); public: - std::string page_id; - std::string ref; - std::string event; + std::string page_id_; + std::string ref_; + std::string event_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_appendtree_createfinish.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_appendtree_createfinish.cpp b/weex_core/Source/core/render/action/render_action_appendtree_createfinish.cpp index 25cdb12..7f8b620 100644 --- a/weex_core/Source/core/render/action/render_action_appendtree_createfinish.cpp +++ b/weex_core/Source/core/render/action/render_action_appendtree_createfinish.cpp @@ -24,13 +24,13 @@ namespace WeexCore { RenderActionAppendTreeCreateFinish::RenderActionAppendTreeCreateFinish(const std::string &page_id, const std::string &ref) { - this->page_id = page_id; - this->ref = ref; + this->page_id_ = page_id; + this->ref_ = ref; } void RenderActionAppendTreeCreateFinish::ExecuteAction() { WeexCoreManager::getInstance()->getPlatformBridge()->callAppendTreeCreateFinish( - this->page_id.c_str(), - this->ref.c_str()); + this->page_id_.c_str(), + this->ref_.c_str()); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_appendtree_createfinish.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_appendtree_createfinish.h b/weex_core/Source/core/render/action/render_action_appendtree_createfinish.h index beb601c..32700fc 100644 --- a/weex_core/Source/core/render/action/render_action_appendtree_createfinish.h +++ b/weex_core/Source/core/render/action/render_action_appendtree_createfinish.h @@ -33,8 +33,8 @@ namespace WeexCore { void ExecuteAction(); public: - std::string page_id; - std::string ref; + std::string page_id_; + std::string ref_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_createbody.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_createbody.cpp b/weex_core/Source/core/render/action/render_action_createbody.cpp index 9247a48..75c5bdf 100644 --- a/weex_core/Source/core/render/action/render_action_createbody.cpp +++ b/weex_core/Source/core/render/action/render_action_createbody.cpp @@ -25,26 +25,26 @@ namespace WeexCore { RenderActionCreateBody::RenderActionCreateBody(const std::string &page_id, const RenderObject *render) { - this->attributes = render->Attributes(); - this->styles = render->Styles(); - this->events = render->Events(); - this->margins = render->GetMargins(); - this->paddings = render->GetPaddings(); - this->borders = render->GetBorders(); - this->page_id = page_id; - this->component_type = render->Type(); - this->ref = render->Ref(); + this->attributes_ = render->attributes(); + this->styles_ = render->styles(); + this->events_ = render->events(); + this->margins_ = render->GetMargins(); + this->paddings_ = render->GetPaddings(); + this->borders_ = render->GetBorders(); + this->page_id_ = page_id; + this->component_type_ = render->type(); + this->ref_ = render->ref(); } void RenderActionCreateBody::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callCreateBody(this->page_id.c_str(), - this->component_type.c_str(), - this->ref.c_str(), - this->styles, - this->attributes, - this->events, - this->margins, - this->paddings, - this->borders); + WeexCoreManager::getInstance()->getPlatformBridge()->callCreateBody(this->page_id_.c_str(), + this->component_type_.c_str(), + this->ref_.c_str(), + this->styles_, + this->attributes_, + this->events_, + this->margins_, + this->paddings_, + this->borders_); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_createbody.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_createbody.h b/weex_core/Source/core/render/action/render_action_createbody.h index 8929138..9de047d 100644 --- a/weex_core/Source/core/render/action/render_action_createbody.h +++ b/weex_core/Source/core/render/action/render_action_createbody.h @@ -37,15 +37,15 @@ namespace WeexCore { void ExecuteAction(); public: - std::map<std::string, std::string> *styles; - std::map<std::string, std::string> *attributes; - std::set<std::string> *events; - WXCoreMargin margins; - WXCorePadding paddings; - WXCoreBorderWidth borders; - std::string page_id; - std::string component_type; - std::string ref; + std::map<std::string, std::string> *styles_; + std::map<std::string, std::string> *attributes_; + std::set<std::string> *events_; + WXCoreMargin margins_; + WXCorePadding paddings_; + WXCoreBorderWidth borders_; + std::string page_id_; + std::string component_type_; + std::string ref_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_createfinish.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_createfinish.cpp b/weex_core/Source/core/render/action/render_action_createfinish.cpp index cb1b15a..a9a4b73 100644 --- a/weex_core/Source/core/render/action/render_action_createfinish.cpp +++ b/weex_core/Source/core/render/action/render_action_createfinish.cpp @@ -23,10 +23,10 @@ namespace WeexCore { RenderActionCreateFinish::RenderActionCreateFinish(const std::string &page_id) { - this->page_id = page_id; + this->page_id_ = page_id; } void RenderActionCreateFinish::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callCreateFinish(this->page_id.c_str()); + WeexCoreManager::getInstance()->getPlatformBridge()->callCreateFinish(this->page_id_.c_str()); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_createfinish.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_createfinish.h b/weex_core/Source/core/render/action/render_action_createfinish.h index 8590edb..449ea7d 100644 --- a/weex_core/Source/core/render/action/render_action_createfinish.h +++ b/weex_core/Source/core/render/action/render_action_createfinish.h @@ -33,7 +33,7 @@ namespace WeexCore { void ExecuteAction(); public: - std::string page_id; + std::string page_id_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_layout.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_layout.cpp b/weex_core/Source/core/render/action/render_action_layout.cpp index b37a2ef..1edd9cb 100644 --- a/weex_core/Source/core/render/action/render_action_layout.cpp +++ b/weex_core/Source/core/render/action/render_action_layout.cpp @@ -25,27 +25,27 @@ namespace WeexCore { RenderActionLayout::RenderActionLayout(const std::string &page_id, const RenderObject *render, int index) { - this->page_id = page_id; - this->ref = render->Ref(); - this->index = index; + this->page_id_ = page_id; + this->ref_ = render->ref(); + this->index_ = index; GetLayoutInfo(render); } void RenderActionLayout::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callLayout(this->page_id.c_str(), - this->ref.c_str(), - this->top, this->bottom, - this->left, this->right, - this->height, this->width, - this->index); + WeexCoreManager::getInstance()->getPlatformBridge()->callLayout(this->page_id_.c_str(), + this->ref_.c_str(), + this->top_, this->bottom_, + this->left_, this->right_, + this->height_, this->width_, + this->index_); } void RenderActionLayout::GetLayoutInfo(const WXCoreLayoutNode *node) { - this->top = node->getLayoutPositionTop(); - this->bottom = node->getLayoutPositionBottom(); - this->right = node->getLayoutPositionRight(); - this->left = node->getLayoutPositionLeft(); - this->height = node->getLayoutHeight(); - this->width = node->getLayoutWidth(); + this->top_ = node->getLayoutPositionTop(); + this->bottom_ = node->getLayoutPositionBottom(); + this->right_ = node->getLayoutPositionRight(); + this->left_ = node->getLayoutPositionLeft(); + this->height_ = node->getLayoutHeight(); + this->width_ = node->getLayoutWidth(); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_layout.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_layout.h b/weex_core/Source/core/render/action/render_action_layout.h index 5a21f08..38b98e9 100644 --- a/weex_core/Source/core/render/action/render_action_layout.h +++ b/weex_core/Source/core/render/action/render_action_layout.h @@ -41,15 +41,15 @@ namespace WeexCore { void GetLayoutInfo(const WXCoreLayoutNode *node); public: - std::string page_id; - std::string ref; - float width; - float height; - float top; - float left; - float bottom; - float right; - int index; + std::string page_id_; + std::string ref_; + float width_; + float height_; + float top_; + float left_; + float bottom_; + float right_; + int index_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_move_element.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_move_element.cpp b/weex_core/Source/core/render/action/render_action_move_element.cpp index 356c0df..ac328ba 100644 --- a/weex_core/Source/core/render/action/render_action_move_element.cpp +++ b/weex_core/Source/core/render/action/render_action_move_element.cpp @@ -25,16 +25,16 @@ namespace WeexCore { RenderActionMoveElement::RenderActionMoveElement(const std::string &page_id, const std::string &ref, const std::string &parent_ref, int index) { - this->page_id = page_id; - this->ref = ref; - this->parent_ref = parent_ref; - this->index = index; + this->page_id_ = page_id; + this->ref_ = ref; + this->parent_ref_ = parent_ref; + this->index_ = index; } void RenderActionMoveElement::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callMoveElement(this->page_id.c_str(), - this->ref.c_str(), - this->parent_ref.c_str(), - this->index); + WeexCoreManager::getInstance()->getPlatformBridge()->callMoveElement(this->page_id_.c_str(), + this->ref_.c_str(), + this->parent_ref_.c_str(), + this->index_); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_move_element.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_move_element.h b/weex_core/Source/core/render/action/render_action_move_element.h index 2644066..fcc6509 100644 --- a/weex_core/Source/core/render/action/render_action_move_element.h +++ b/weex_core/Source/core/render/action/render_action_move_element.h @@ -34,10 +34,10 @@ namespace WeexCore { void ExecuteAction(); public: - std::string page_id; - std::string ref; - std::string parent_ref; - int index; + std::string page_id_; + std::string ref_; + std::string parent_ref_; + int index_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_remove_element.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_remove_element.cpp b/weex_core/Source/core/render/action/render_action_remove_element.cpp index b5f1206..8995c40 100644 --- a/weex_core/Source/core/render/action/render_action_remove_element.cpp +++ b/weex_core/Source/core/render/action/render_action_remove_element.cpp @@ -24,12 +24,12 @@ namespace WeexCore { RenderActionRemoveElement::RenderActionRemoveElement(const std::string &page_id, const std::string &ref) { - this->page_id = page_id; - this->ref = ref; + this->page_id_ = page_id; + this->ref_ = ref; } void RenderActionRemoveElement::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callRemoveElement(this->page_id.c_str(), - this->ref.c_str()); + WeexCoreManager::getInstance()->getPlatformBridge()->callRemoveElement(this->page_id_.c_str(), + this->ref_.c_str()); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_remove_element.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_remove_element.h b/weex_core/Source/core/render/action/render_action_remove_element.h index 425c3e4..6699d0d 100644 --- a/weex_core/Source/core/render/action/render_action_remove_element.h +++ b/weex_core/Source/core/render/action/render_action_remove_element.h @@ -32,8 +32,8 @@ namespace WeexCore { void ExecuteAction(); public: - std::string page_id; - std::string ref; + std::string page_id_; + std::string ref_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_remove_event.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_remove_event.cpp b/weex_core/Source/core/render/action/render_action_remove_event.cpp index fc4e953..732f7b7 100644 --- a/weex_core/Source/core/render/action/render_action_remove_event.cpp +++ b/weex_core/Source/core/render/action/render_action_remove_event.cpp @@ -25,14 +25,14 @@ namespace WeexCore { RenderActionRemoveEvent::RenderActionRemoveEvent(const std::string &page_id, const std::string &ref, const std::string &event) { - this->page_id = page_id; - this->ref = ref; - this->event = event; + this->page_id_ = page_id; + this->ref_ = ref; + this->event_ = event; } void RenderActionRemoveEvent::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callRemoveEvent(this->page_id.c_str(), - this->ref.c_str(), - this->event.c_str()); + WeexCoreManager::getInstance()->getPlatformBridge()->callRemoveEvent(this->page_id_.c_str(), + this->ref_.c_str(), + this->event_.c_str()); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_remove_event.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_remove_event.h b/weex_core/Source/core/render/action/render_action_remove_event.h index e331dd0..5d6d0fe 100644 --- a/weex_core/Source/core/render/action/render_action_remove_event.h +++ b/weex_core/Source/core/render/action/render_action_remove_event.h @@ -34,9 +34,9 @@ namespace WeexCore { void ExecuteAction(); public: - std::string page_id; - std::string ref; - std::string event; + std::string page_id_; + std::string ref_; + std::string event_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_update_attr.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_update_attr.cpp b/weex_core/Source/core/render/action/render_action_update_attr.cpp index 91e75dd..35500b2 100644 --- a/weex_core/Source/core/render/action/render_action_update_attr.cpp +++ b/weex_core/Source/core/render/action/render_action_update_attr.cpp @@ -24,14 +24,14 @@ namespace WeexCore { RenderActionUpdateAttr::RenderActionUpdateAttr(const std::string &page_id, const std::string &ref, std::vector<std::pair<std::string, std::string>> *attrs) { - this->page_id = page_id; - this->ref = ref; - this->attrs = attrs; + this->page_id_ = page_id; + this->ref_ = ref; + this->attrs_ = attrs; } void RenderActionUpdateAttr::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callUpdateAttr(this->page_id.c_str(), - this->ref.c_str(), - this->attrs); + WeexCoreManager::getInstance()->getPlatformBridge()->callUpdateAttr(this->page_id_.c_str(), + this->ref_.c_str(), + this->attrs_); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_update_attr.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_update_attr.h b/weex_core/Source/core/render/action/render_action_update_attr.h index b666f41..81b48b5 100644 --- a/weex_core/Source/core/render/action/render_action_update_attr.h +++ b/weex_core/Source/core/render/action/render_action_update_attr.h @@ -35,9 +35,9 @@ namespace WeexCore { void ExecuteAction(); public: - std::string page_id; - std::string ref; - std::vector<std::pair<std::string, std::string>> *attrs; + std::string page_id_; + std::string ref_; + std::vector<std::pair<std::string, std::string>> *attrs_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_update_style.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_update_style.cpp b/weex_core/Source/core/render/action/render_action_update_style.cpp index 21df427..1bc9342 100644 --- a/weex_core/Source/core/render/action/render_action_update_style.cpp +++ b/weex_core/Source/core/render/action/render_action_update_style.cpp @@ -28,20 +28,20 @@ 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) { - this->page_id = page_id; - this->ref = ref; - this->style = style; - this->margin = margin; - this->padding = padding; - this->border = border; + this->page_id_ = page_id; + this->ref_ = ref; + this->style_ = style; + this->margin_ = margin; + this->padding_ = padding; + this->border_ = border; } void RenderActionUpdateStyle::ExecuteAction() { - WeexCoreManager::getInstance()->getPlatformBridge()->callUpdateStyle(this->page_id.c_str(), - this->ref.c_str(), - this->style, - this->margin, - this->padding, - this->border); + WeexCoreManager::getInstance()->getPlatformBridge()->callUpdateStyle(this->page_id_.c_str(), + this->ref_.c_str(), + this->style_, + this->margin_, + this->padding_, + this->border_); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/action/render_action_update_style.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/action/render_action_update_style.h b/weex_core/Source/core/render/action/render_action_update_style.h index bef6806..ae914f5 100644 --- a/weex_core/Source/core/render/action/render_action_update_style.h +++ b/weex_core/Source/core/render/action/render_action_update_style.h @@ -39,12 +39,12 @@ namespace WeexCore { void ExecuteAction(); public: - std::string page_id; - std::string ref; - 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; + std::string page_id_; + std::string ref_; + 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_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/manager/render_manager.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/manager/render_manager.cpp b/weex_core/Source/core/render/manager/render_manager.cpp index 8b299a9..64e179c 100644 --- a/weex_core/Source/core/render/manager/render_manager.cpp +++ b/weex_core/Source/core/render/manager/render_manager.cpp @@ -35,7 +35,7 @@ namespace WeexCore { #endif RenderPage *page = new RenderPage(page_id); - this->pages.insert(std::pair<std::string, RenderPage *>(page_id, page)); + this->pages_.insert(std::pair<std::string, RenderPage *>(page_id, page)); long long startTime = getCurrentTime(); RenderObject *root = Wson2RenderObject(data, page_id); @@ -183,8 +183,8 @@ namespace WeexCore { } RenderPage *RenderManager::GetPage(const std::string &page_id) { - std::map<std::string, RenderPage *>::iterator iter = this->pages.find(page_id); - if (iter != this->pages.end()) { + std::map<std::string, RenderPage *>::iterator iter = this->pages_.find(page_id); + if (iter != this->pages_.end()) { return iter->second; } else { return nullptr; @@ -200,7 +200,7 @@ namespace WeexCore { LOGD("[RenderManager] ClosePage >>>> pageId: %s", pageId.c_str()); #endif page->OnRenderPageClose(); - this->pages.erase(page_id); + this->pages_.erase(page_id); delete page; page = nullptr; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/manager/render_manager.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/manager/render_manager.h b/weex_core/Source/core/render/manager/render_manager.h index 33573ff..b87c486 100644 --- a/weex_core/Source/core/render/manager/render_manager.h +++ b/weex_core/Source/core/render/manager/render_manager.h @@ -84,7 +84,7 @@ namespace WeexCore { private: static RenderManager *g_pInstance; - std::map<std::string, RenderPage *> pages; + std::map<std::string, RenderPage *> pages_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/node/factory/render_creator.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/node/factory/render_creator.cpp b/weex_core/Source/core/render/node/factory/render_creator.cpp index f3ecdad..92f8c3b 100644 --- a/weex_core/Source/core/render/node/factory/render_creator.cpp +++ b/weex_core/Source/core/render/node/factory/render_creator.cpp @@ -48,8 +48,8 @@ namespace WeexCore { } IRenderObject *render = factory->CreateRender(); - render->SetRef(ref); - render->SetType(type); + render->set_ref(ref); + render->set_type(type); delete factory; return render; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/node/factory/render_object_interface.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/node/factory/render_object_interface.h b/weex_core/Source/core/render/node/factory/render_object_interface.h index 13d2aaf..9e3922f 100644 --- a/weex_core/Source/core/render/node/factory/render_object_interface.h +++ b/weex_core/Source/core/render/node/factory/render_object_interface.h @@ -29,42 +29,42 @@ namespace WeexCore { public: - inline void SetRef(std::string ref) { - this->ref = ref; + inline void set_ref(std::string ref) { + this->ref_ = ref; } - inline const std::string &Ref() const { - return this->ref; + inline const std::string &ref() const { + return this->ref_; } - inline void SetPageId(std::string page_id) { - this->page_id = page_id; + inline void set_page_id(std::string page_id) { + this->page_id_ = page_id; } - inline const std::string &PageId() const { - return this->page_id; + inline const std::string &page_id() const { + return this->page_id_; } - inline void SetType(std::string type) { - this->tyle = type; + inline void set_type(std::string type) { + this->tyle_ = type; } - inline const std::string &Type() const { - return this->tyle; + inline const std::string &type() const { + return this->tyle_; } - inline void copyFrom(IRenderObject *src) { + inline void CopyFrom(IRenderObject *src) { WXCoreLayoutNode::copyFrom(src); - SetRef(src->Ref()); - SetPageId(src->PageId()); - SetType(src->Type()); + set_ref(src->ref()); + set_page_id(src->page_id()); + set_type(src->type()); } private: - std::string page_id = ""; - std::string ref = ""; - std::string tyle = ""; + std::string page_id_ = ""; + std::string ref_ = ""; + std::string tyle_ = ""; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/node/render_appbar.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/node/render_appbar.cpp b/weex_core/Source/core/render/node/render_appbar.cpp index d97c0d4..8c05f41 100644 --- a/weex_core/Source/core/render/node/render_appbar.cpp +++ b/weex_core/Source/core/render/node/render_appbar.cpp @@ -24,10 +24,10 @@ namespace WeexCore { std::map<std::string, std::string> *RenderAppBar::GetDefaultStyle() { - this->default_nav_width = getFloat( + this->default_nav_width_ = getFloat( WXCoreEnvironment::getInstance()->GetOption("defaultNavWidth").c_str()); - this->default_overflow_width = getFloat( + this->default_overflow_width_ = getFloat( WXCoreEnvironment::getInstance()->GetOption("defaultOverflowWidth").c_str()); std::string appbar_color = WXCoreEnvironment::getInstance()->GetOption("appbar_color"); @@ -58,8 +58,8 @@ namespace WeexCore { value, 0, [=](float foo) { - setPadding(kPaddingLeft, foo + this->default_nav_width), - setPadding(kPaddingRight, foo + this->default_overflow_width), + setPadding(kPaddingLeft, foo + this->default_nav_width_), + setPadding(kPaddingRight, foo + this->default_overflow_width_), setPadding(kPaddingTop, foo), setPadding(kPaddingBottom, foo); }); @@ -68,14 +68,14 @@ namespace WeexCore { UpdateStyleInternal(key, value, 0, - [=](float foo) { setPadding(kPaddingLeft, foo + this->default_nav_width); }); + [=](float foo) { setPadding(kPaddingLeft, foo + this->default_nav_width_); }); return kTypePadding; } else if (key == PADDING_RIGHT) { UpdateStyleInternal(key, value, 0, [=](float foo) { - setPadding(kPaddingRight, foo + this->default_overflow_width); + setPadding(kPaddingRight, foo + this->default_overflow_width_); }); return kTypePadding; } else { http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/node/render_appbar.h ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/node/render_appbar.h b/weex_core/Source/core/render/node/render_appbar.h index 4772b10..3247c7c 100644 --- a/weex_core/Source/core/render/node/render_appbar.h +++ b/weex_core/Source/core/render/node/render_appbar.h @@ -38,8 +38,8 @@ namespace WeexCore { private: - float default_nav_width; - float default_overflow_width; + float default_nav_width_; + float default_overflow_width_; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/weex_core/Source/core/render/node/render_list.cpp ---------------------------------------------------------------------- diff --git a/weex_core/Source/core/render/node/render_list.cpp b/weex_core/Source/core/render/node/render_list.cpp index 89ac63c..1854d5e 100644 --- a/weex_core/Source/core/render/node/render_list.cpp +++ b/weex_core/Source/core/render/node/render_list.cpp @@ -28,32 +28,32 @@ namespace WeexCore { RenderList::~RenderList() { - if (this->cell_slots_copys.size() > 0) { - for (auto it = this->cell_slots_copys.begin(); it != this->cell_slots_copys.end(); ++it) { + if (this->cell_slots_copys_.size() > 0) { + for (auto it = this->cell_slots_copys_.begin(); it != this->cell_slots_copys_.end(); ++it) { RenderObject *child = *it; if (child) { delete child; child = nullptr; } } - this->cell_slots_copys.clear(); + this->cell_slots_copys_.clear(); } - if (this->cell_slots.size() > 0) { - for (auto it = this->cell_slots.begin(); it != this->cell_slots.end(); ++it) { + if (this->cell_slots_.size() > 0) { + for (auto it = this->cell_slots_.begin(); it != this->cell_slots_.end(); ++it) { RenderObject *child = *it; if (child) { delete child; child = nullptr; } } - this->cell_slots.clear(); + this->cell_slots_.clear(); } } - void RenderList::addCellSlotCopyTrack(RenderObject *cellSlot) { + void RenderList::AddCellSlotCopyTrack(RenderObject *cellSlot) { cellSlot->setParent(this, cellSlot); - this->cell_slots_copys.push_back(cellSlot); + this->cell_slots_copys_.push_back(cellSlot); } std::map<std::string, std::string> *RenderList::GetDefaultStyle() { @@ -62,101 +62,101 @@ namespace WeexCore { bool isVertical = true; RenderObject *parent = (RenderObject *) getParent(); - if (parent != nullptr && !parent->Type().empty()) { - if (parent->Type() == kHList) { + if (parent != nullptr && !parent->type().empty()) { + if (parent->type() == kHList) { isVertical = false; - } else if (getOrientation() == HORIZONTAL_VALUE) { + } else if (TakeOrientation() == HORIZONTAL_VALUE) { isVertical = false; } } std::string prop = isVertical ? HEIGHT : WIDTH; - if (prop == HEIGHT && isnan(getStyleHeight()) && !this->is_set_flex) { - this->is_set_flex = true; + if (prop == HEIGHT && isnan(getStyleHeight()) && !this->is_set_flex_) { + this->is_set_flex_ = true; style->insert(std::pair<std::string, std::string>(FLEX, "1")); - } else if (prop == WIDTH && isnan(getStyleWidth()) && !this->is_set_flex) { - this->is_set_flex = true; + } else if (prop == WIDTH && isnan(TakeStyleWidth()) && !this->is_set_flex_) { + this->is_set_flex_ = true; style->insert(std::pair<std::string, std::string>(FLEX, "1")); } return style; } - void RenderList::setFlex(const float flex) { - this->is_set_flex = true; - WXCoreLayoutNode::setFlex(flex); + void RenderList::set_flex(const float flex) { + this->is_set_flex_ = true; + WXCoreLayoutNode::set_flex(flex); } std::map<std::string, std::string> *RenderList::GetDefaultAttr() { - if (!this->is_pre_calculate_cell_width) { - preCalculateCellWidth(); + if (!this->is_pre_calculate_cell_width_) { + PreCalculateCellWidth(); } return nullptr; } - void RenderList::preCalculateCellWidth() { + void RenderList::PreCalculateCellWidth() { std::map<std::string, std::string> *attrs = new std::map<std::string, std::string>(); - if (Attributes() != nullptr) { - this->column_count = getColumnCount(); - this->column_width = getColumnWidth(); - this->column_gap = getColumnGap(); + if (attributes() != nullptr) { + this->column_count_ = TakeColumnCount(); + this->column_width_ = TakeColumnWidth(); + this->column_gap_ = TakeColumnGap(); - this->left_gap = getLeftGap(); - this->right_gap = getRightGap(); + this->left_gap_ = TakeLeftGap(); + this->right_gap_ = TakeRightGap(); - this->available_width = - getStyleWidth() - getWebPxByWidth(getPaddingLeft(), GetRenderPage()->ViewPortWidth()) - + this->available_width_ = + TakeStyleWidth() - getWebPxByWidth(getPaddingLeft(), GetRenderPage()->ViewPortWidth()) - getWebPxByWidth(getPaddingRight(), GetRenderPage()->ViewPortWidth()); - if (AUTO_VALUE == this->column_count && AUTO_VALUE == this->column_width) { - this->column_count = COLUMN_COUNT_NORMAL; - this->column_width = - (this->available_width - ((this->column_count - 1) * this->column_gap)) / - this->column_count; - this->column_width = this->column_width > 0 ? this->column_width : 0; - } else if (AUTO_VALUE == this->column_width && AUTO_VALUE != this->column_count) { - this->column_width = - (this->available_width - this->left_gap - this->right_gap - - ((this->column_count - 1) * this->column_gap)) / - this->column_count; - this->column_width = this->column_width > 0 ? this->column_width : 0; - } else if (AUTO_VALUE != this->column_width && AUTO_VALUE == this->column_count) { - this->column_count = (int) round( - (this->available_width + this->column_gap) / (this->column_width + this->column_gap) - + if (AUTO_VALUE == this->column_count_ && AUTO_VALUE == this->column_width_) { + this->column_count_ = COLUMN_COUNT_NORMAL; + this->column_width_ = + (this->available_width_ - ((this->column_count_ - 1) * this->column_gap_)) / + this->column_count_; + this->column_width_ = this->column_width_ > 0 ? this->column_width_ : 0; + } else if (AUTO_VALUE == this->column_width_ && AUTO_VALUE != this->column_count_) { + this->column_width_ = + (this->available_width_ - this->left_gap_ - this->right_gap_ - + ((this->column_count_ - 1) * this->column_gap_)) / + this->column_count_; + this->column_width_ = this->column_width_ > 0 ? this->column_width_ : 0; + } else if (AUTO_VALUE != this->column_width_ && AUTO_VALUE == this->column_count_) { + this->column_count_ = (int) round( + (this->available_width_ + this->column_gap_) / (this->column_width_ + this->column_gap_) - 0.5f); - this->column_count = this->column_count > 0 ? this->column_count : 1; - if (this->column_count <= 0) { - this->column_count = COLUMN_COUNT_NORMAL; + this->column_count_ = this->column_count_ > 0 ? this->column_count_ : 1; + if (this->column_count_ <= 0) { + this->column_count_ = COLUMN_COUNT_NORMAL; } - this->column_width = - ((this->available_width + this->column_gap - this->left_gap - this->right_gap) / - this->column_count) - this->column_gap; + this->column_width_ = + ((this->available_width_ + this->column_gap_ - this->left_gap_ - this->right_gap_) / + this->column_count_) - this->column_gap_; - } else if (AUTO_VALUE != this->column_width && AUTO_VALUE != this->column_count) { + } else if (AUTO_VALUE != this->column_width_ && AUTO_VALUE != this->column_count_) { int columnCount = (int) round( - (this->available_width + this->column_gap - this->left_gap - this->right_gap) / - (this->column_width + this->column_gap) - + (this->available_width_ + this->column_gap_ - this->left_gap_ - this->right_gap_) / + (this->column_width_ + this->column_gap_) - 0.5f); - this->column_count = columnCount > this->column_count ? this->column_count : columnCount; - if (this->column_count <= 0) { - this->column_count = COLUMN_COUNT_NORMAL; + this->column_count_ = columnCount > this->column_count_ ? this->column_count_ : columnCount; + if (this->column_count_ <= 0) { + this->column_count_ = COLUMN_COUNT_NORMAL; } - this->column_width = - ((this->available_width + this->column_gap - this->left_gap - this->right_gap) / - this->column_count) - this->column_gap; + this->column_width_ = + ((this->available_width_ + this->column_gap_ - this->left_gap_ - this->right_gap_) / + this->column_count_) - this->column_gap_; } - std::string spanOffsets = calcSpanOffset(); + std::string spanOffsets = CalculateSpanOffset(); - this->is_pre_calculate_cell_width = true; - if (getColumnCount() > 0 || getColumnWidth() > 0 || - this->column_count > COLUMN_COUNT_NORMAL) { + this->is_pre_calculate_cell_width_ = true; + if (TakeColumnCount() > 0 || TakeColumnWidth() > 0 || + this->column_count_ > COLUMN_COUNT_NORMAL) { attrs->insert( - std::pair<std::string, std::string>(COLUMN_COUNT, to_string(this->column_count))); - attrs->insert(std::pair<std::string, std::string>(COLUMN_GAP, to_string(this->column_gap))); + std::pair<std::string, std::string>(COLUMN_COUNT, to_string(this->column_count_))); + attrs->insert(std::pair<std::string, std::string>(COLUMN_GAP, to_string(this->column_gap_))); attrs->insert( - std::pair<std::string, std::string>(COLUMN_WIDTH, to_string(this->column_width))); + std::pair<std::string, std::string>(COLUMN_WIDTH, to_string(this->column_width_))); } if (spanOffsets.length() > 0) { attrs->insert(std::pair<std::string, std::string>(SPAN_OFFSETS, to_string(spanOffsets))); @@ -179,16 +179,16 @@ namespace WeexCore { } } - std::string RenderList::calcSpanOffset() { + std::string RenderList::CalculateSpanOffset() { std::string spanOffsets; - if (this->left_gap > 0 || this->right_gap > 0) { + if (this->left_gap_ > 0 || this->right_gap_ > 0) { spanOffsets.append("["); - for (int i = 0; i < this->column_count; i++) { - float spanOffset = this->left_gap + i * ((this->column_width + this->column_gap) - - (this->available_width + this->column_gap) / - this->column_count); + for (int i = 0; i < this->column_count_; i++) { + float spanOffset = this->left_gap_ + i * ((this->column_width_ + this->column_gap_) - + (this->available_width_ + this->column_gap_) / + this->column_count_); spanOffsets.append(to_string(spanOffset)); - if (i != this->column_count - 1) { + if (i != this->column_count_ - 1) { spanOffsets.append(","); } } @@ -197,7 +197,7 @@ namespace WeexCore { return spanOffsets; } - float RenderList::getStyleWidth() { + float RenderList::TakeStyleWidth() { float width = getWebPxByWidth(getLayoutWidth(), GetRenderPage()->ViewPortWidth()); if (isnan(width) || width <= 0) { if (getParent() != nullptr) { @@ -214,34 +214,34 @@ namespace WeexCore { } int RenderList::AddRenderObject(int index, RenderObject *child) { - if (Type() == kRenderRecycleList - && (child->Type() == kRenderCellSlot || child->Type() == kRenderCell || - child->Type() == kRenderHeader)) { + if (type() == kRenderRecycleList + && (child->type() == kRenderCellSlot || child->type() == kRenderCell || + child->type() == kRenderHeader)) { child->setParent(this, child); - this->cell_slots.insert(this->cell_slots.end(), child); + this->cell_slots_.insert(this->cell_slots_.end(), child); index = -1; } else { index = RenderObject::AddRenderObject(index, child); } - if (!this->is_pre_calculate_cell_width) { - preCalculateCellWidth(); + if (!this->is_pre_calculate_cell_width_) { + PreCalculateCellWidth(); } - if (this->column_width != 0 && !isnan(this->column_width)) { + if (this->column_width_ != 0 && !isnan(this->column_width_)) { AddRenderObjectWidth(child, false); } return index; } void RenderList::AddRenderObjectWidth(RenderObject *child, const bool updating) { - if (Type() == kRenderWaterfall || Type() == kRenderRecycleList) { - if (child->Type() == kRenderHeader || child->Type() == kRenderFooter) { - child->ApplyStyle(WIDTH, to_string(this->available_width), updating); - } else if (child->IsSticky()) { - child->ApplyStyle(WIDTH, to_string(this->available_width), updating); - } else if (child->Type() == kRenderCell || child->Type() == kRenderCellSlot) { - child->ApplyStyle(WIDTH, to_string(this->column_width), updating); + if (type() == kRenderWaterfall || type() == kRenderRecycleList) { + if (child->type() == kRenderHeader || child->type() == kRenderFooter) { + child->ApplyStyle(WIDTH, to_string(this->available_width_), updating); + } else if (child->is_sticky()) { + child->ApplyStyle(WIDTH, to_string(this->available_width_), updating); + } else if (child->type() == kRenderCell || child->type() == kRenderCellSlot) { + child->ApplyStyle(WIDTH, to_string(this->column_width_), updating); } } } @@ -251,9 +251,9 @@ namespace WeexCore { if (!GetAttr(COLUMN_COUNT).empty() || !GetAttr(COLUMN_GAP).empty() || !GetAttr(COLUMN_WIDTH).empty()) { - preCalculateCellWidth(); + PreCalculateCellWidth(); - if (this->column_width == 0 && isnan(this->column_width)) { + if (this->column_width_ == 0 && isnan(this->column_width_)) { return; } @@ -265,7 +265,7 @@ namespace WeexCore { } } - float RenderList::getColumnCount() { + float RenderList::TakeColumnCount() { std::string columnCount = GetAttr(COLUMN_COUNT); if (columnCount.empty() || columnCount == AUTO) { @@ -276,7 +276,7 @@ namespace WeexCore { return (columnCountValue > 0 && !isnan(columnCountValue)) ? columnCountValue : AUTO_VALUE; } - float RenderList::getColumnGap() { + float RenderList::TakeColumnGap() { std::string columnGap = GetAttr(COLUMN_GAP); if (columnGap.empty() || columnGap == NORMAL) { @@ -287,7 +287,7 @@ namespace WeexCore { return (columnGapValue > 0 && !isnan(columnGapValue)) ? columnGapValue : AUTO_VALUE; } - float RenderList::getColumnWidth() { + float RenderList::TakeColumnWidth() { std::string columnWidth = GetAttr(COLUMN_WIDTH); if (columnWidth.empty() || columnWidth == AUTO) { @@ -298,7 +298,7 @@ namespace WeexCore { return (columnWidthValue > 0 && !isnan(columnWidthValue)) ? columnWidthValue : 0; } - float RenderList::getLeftGap() { + float RenderList::TakeLeftGap() { std::string leftGap = GetAttr(LEFT_GAP); if (leftGap.empty() || leftGap == AUTO) { @@ -309,7 +309,7 @@ namespace WeexCore { return (leftGapValue > 0 && !isnan(leftGapValue)) ? leftGapValue : 0; } - float RenderList::getRightGap() { + float RenderList::TakeRightGap() { std::string rightGap = GetAttr(RIGHT_GAP); if (rightGap.empty() || rightGap == AUTO) { @@ -320,7 +320,7 @@ namespace WeexCore { return (rightGapValue > 0 && !isnan(rightGapValue)) ? rightGapValue : 0; } - int RenderList::getOrientation() { + int RenderList::TakeOrientation() { std::string direction = GetAttr(SCROLL_DIRECTION); if (HORIZONTAL == direction) { return HORIZONTAL_VALUE; http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/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 ad0417c..39453e0 100644 --- a/weex_core/Source/core/render/node/render_list.h +++ b/weex_core/Source/core/render/node/render_list.h @@ -30,19 +30,19 @@ namespace WeexCore { ~RenderList(); - void addCellSlotCopyTrack(RenderObject *cellSlot); + void set_flex(const float flex); - void setFlex(const float flex); + void AddCellSlotCopyTrack(RenderObject *cellSlot); - std::map <std::string, std::string> *GetDefaultStyle(); + std::map<std::string, std::string> *GetDefaultStyle(); - std::map <std::string, std::string> *GetDefaultAttr(); + std::map<std::string, std::string> *GetDefaultAttr(); - void preCalculateCellWidth(); + void PreCalculateCellWidth(); - std::string calcSpanOffset(); + std::string CalculateSpanOffset(); - float getStyleWidth(); + float TakeStyleWidth(); int AddRenderObject(int index, RenderObject *child); @@ -50,38 +50,39 @@ namespace WeexCore { void UpdateAttr(std::string key, std::string value); - float getColumnCount(); + float TakeColumnCount(); - float getColumnGap(); + float TakeColumnGap(); - float getColumnWidth(); + float TakeColumnWidth(); - float getLeftGap(); + float TakeLeftGap(); - float getRightGap(); + float TakeRightGap(); - int getOrientation(); + int TakeOrientation(); - inline float calcFreeSpaceAlongMainAxis(const float &width, const float &height, const float ¤tLength) const override { + inline float CalculateFreeSpaceAlongMainAxis(const float &width, const float &height, + const float ¤tLength) const override { return NAN; } inline std::vector<RenderObject *> &CellSlots() { - return cell_slots; + return cell_slots_; } private: - bool is_pre_calculate_cell_width = false; - int column_count = COLUMN_COUNT_NORMAL; - float column_width = AUTO_VALUE; - float available_width = 0; - float column_gap = COLUMN_GAP_NORMAL; - bool is_set_flex = false; - std::vector<RenderObject *> cell_slots; - std::vector<RenderObject *> cell_slots_copys; - float left_gap = 0; - float right_gap = 0; + bool is_pre_calculate_cell_width_ = false; + int column_count_ = COLUMN_COUNT_NORMAL; + float column_width_ = AUTO_VALUE; + float available_width_ = 0; + float column_gap_ = COLUMN_GAP_NORMAL; + bool is_set_flex_ = false; + std::vector<RenderObject *> cell_slots_; + std::vector<RenderObject *> cell_slots_copys_; + float left_gap_ = 0; + float right_gap_ = 0; }; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/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 a13d6d1..6818cff 100644 --- a/weex_core/Source/core/render/node/render_object.cpp +++ b/weex_core/Source/core/render/node/render_object.cpp @@ -29,29 +29,29 @@ namespace WeexCore { RenderObject::RenderObject() { - this->styles = new std::map<std::string, std::string>(); - this->attributes = new std::map<std::string, std::string>(); - this->events = new std::set<std::string>(); - this->is_root_render = false; + this->styles_ = new std::map<std::string, std::string>(); + this->attributes_ = new std::map<std::string, std::string>(); + this->events_ = new std::set<std::string>(); + this->is_root_render_ = false; } RenderObject::~RenderObject() { - this->parent_render = nullptr; + this->parent_render_ = nullptr; - if (this->styles != nullptr) { - delete this->styles; - this->styles = nullptr; + if (this->styles_ != nullptr) { + delete this->styles_; + this->styles_ = nullptr; } - if (this->attributes != nullptr) { - delete this->attributes; - this->attributes = nullptr; + if (this->attributes_ != nullptr) { + delete this->attributes_; + this->attributes_ = nullptr; } - if (this->events != nullptr) { - delete this->events; - this->events = nullptr; + if (this->events_ != nullptr) { + delete this->events_; + this->events_ = nullptr; } for (auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) { @@ -113,13 +113,13 @@ namespace WeexCore { setMeasureFunc(measureFunc_Impl); } - void RenderObject::onLayoutBefore() { + void RenderObject::OnLayoutBefore() { if (WeexCoreManager::getInstance()->GetMeasureFunctionAdapter() == nullptr) return; WeexCoreManager::getInstance()->GetMeasureFunctionAdapter()->LayoutBefore(this); } - void RenderObject::onLayoutAfter(float width, float height) { + void RenderObject::OnLayoutAfter(float width, float height) { if (WeexCoreManager::getInstance()->GetMeasureFunctionAdapter() == nullptr) return; WeexCoreManager::getInstance()->GetMeasureFunctionAdapter()->LayoutAfter(this, width, height); @@ -130,7 +130,7 @@ namespace WeexCore { bool insert = false; if (value.length() > 0 && (value.at(0) == JSON_OBJECT_MARK_CHAR || value.at(0) == JSON_ARRAY_MARK_CHAR)) { - mapInsertOrAssign(this->styles, key, value); + MapInsertOrAssign(this->styles_, key, value); insert = true; } @@ -142,11 +142,11 @@ namespace WeexCore { return kTypeLayout; } else if (key == FLEX) { if (value.empty()) { - setFlex(0); + set_flex(0); } else { float ret = getFloat(value.c_str()); if (!isnan(ret)) { - setFlex(ret); + set_flex(ret); } } return kTypeLayout; @@ -184,9 +184,9 @@ namespace WeexCore { } else if (key == POSITION) { setStylePositionType(GetWXCorePositionType(value)); if (value == STICKY) { - this->is_sticky = true; + this->is_sticky_ = true; } - mapInsertOrAssign(this->styles, key, value); + MapInsertOrAssign(this->styles_, key, value); return kTypeStyle; } else if (key == LEFT) { UpdateStyleInternal(key, value, NAN, @@ -253,18 +253,18 @@ namespace WeexCore { return kTypePadding; } else { if (!insert) { - mapInsertOrAssign(this->styles, key, value); + MapInsertOrAssign(this->styles_, key, value); } return kTypeStyle; } } const std::string RenderObject::GetStyle(const std::string &key) { - if (this->styles == nullptr) + if (this->styles_ == nullptr) return ""; - std::map<std::string, std::string>::iterator iter = this->styles->find(key); - if (iter != this->styles->end()) { + std::map<std::string, std::string>::iterator iter = this->styles_->find(key); + if (iter != this->styles_->end()) { return iter->second; } else { return ""; @@ -272,11 +272,11 @@ namespace WeexCore { } const std::string RenderObject::GetAttr(const std::string &key) { - if (this->attributes == nullptr) + if (this->attributes_ == nullptr) return ""; - std::map<std::string, std::string>::iterator iter = this->attributes->find(key); - if (iter != this->attributes->end()) { + std::map<std::string, std::string>::iterator iter = this->attributes_->find(key); + if (iter != this->attributes_->end()) { return iter->second; } else { return ""; @@ -284,8 +284,8 @@ namespace WeexCore { } float RenderObject::GetViewPortWidth() { - if (this->viewport_width >= 0) - return this->viewport_width; + if (this->viewport_width_ >= 0) + return this->viewport_width_; RenderPage *page = GetRenderPage(); if (page == nullptr) @@ -307,7 +307,7 @@ namespace WeexCore { addChildAt(child, index); } - child->SetParentRender(this); + child->set_parent_render(this); return index; } @@ -320,7 +320,7 @@ namespace WeexCore { for (auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) { RenderObject *child = static_cast<RenderObject *>(*it); if (child != nullptr) { - if (render->Ref() == child->Ref()) + if (render->ref() == child->ref()) return i; } ++i; @@ -346,40 +346,40 @@ namespace WeexCore { return ret; } - void RenderObject::LayoutBefore() { + void RenderObject::LayoutBeforeImpl() { if (isDirty()) { - onLayoutBefore(); + OnLayoutBefore(); } for (auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) { RenderObject *child = static_cast<RenderObject *>(*it); if (child != nullptr) { - child->LayoutBefore(); + child->LayoutBeforeImpl(); } } } - void RenderObject::LayoutAfter() { + void RenderObject::LayoutAfterImpl() { if (hasNewLayout()) { - onLayoutAfter(getLayoutWidth(), getLayoutHeight()); + OnLayoutAfter(getLayoutWidth(), getLayoutHeight()); } for (auto it = ChildListIterBegin(); it != ChildListIterEnd(); it++) { RenderObject *child = static_cast<RenderObject *>(*it); if (child != nullptr) { - child->LayoutAfter(); + child->LayoutAfterImpl(); } } } - void RenderObject::copyFrom(RenderObject *src) { - IRenderObject::copyFrom(src); - this->styles->insert(src->styles->begin(), src->styles->end()); - this->attributes->insert(src->attributes->begin(), src->attributes->end()); - this->events->insert(src->events->begin(), src->events->end()); + void RenderObject::CopyFrom(RenderObject *src) { + IRenderObject::CopyFrom(src); + this->styles_->insert(src->styles_->begin(), src->styles_->end()); + this->attributes_->insert(src->attributes_->begin(), src->attributes_->end()); + this->events_->insert(src->events_->begin(), src->events_->end()); } - void RenderObject::mapInsertOrAssign(std::map<std::string, std::string> *targetMap, + 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()) { @@ -391,12 +391,12 @@ namespace WeexCore { bool RenderObject::ViewInit() { return (!isnan(getStyleWidth()) && getStyleWidth() > 0) || - (IsRootRender() && GetRenderPage() != nullptr && + (is_root_render() && GetRenderPage() != nullptr && GetRenderPage()->GetRenderContainerWidthWrapContent()); } RenderPage *RenderObject::GetRenderPage() { - return RenderManager::GetInstance()->GetPage(PageId()); + return RenderManager::GetInstance()->GetPage(page_id()); } bool RenderObject::IsAppendTree() { @@ -408,10 +408,37 @@ namespace WeexCore { } void RenderObject::UpdateAttr(std::string key, std::string value) { - mapInsertOrAssign(this->attributes, key, value); + MapInsertOrAssign(this->attributes_, key, value); } StyleType RenderObject::UpdateStyle(std::string key, std::string value) { return ApplyStyle(key, value, true); } + + RenderObject* RenderObject::GetChild(const Index &index) { + return static_cast<RenderObject*>(getChildAt(index)); + } + + void RenderObject::RemoveRenderObject(RenderObject *child) { + removeChild(child); + } + + void RenderObject::AddAttr(std::string key, std::string value) { + MapInsertOrAssign(this->attributes_, key, value); + } + + StyleType RenderObject::AddStyle(std::string key, std::string value) { + return ApplyStyle(key, value, false); + } + + void RenderObject::AddEvent(std::string event) { + if (this->events_ == nullptr || this->events_->empty()) { + this->events_ = new std::set<std::string>(); + } + this->events_->insert(event); + } + + void RenderObject::RemoveEvent(const std::string &event) { + this->events_->erase(event); + } } //end WeexCore http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/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 1e519af..91c9a16 100644 --- a/weex_core/Source/core/render/node/render_object.h +++ b/weex_core/Source/core/render/node/render_object.h @@ -49,13 +49,14 @@ namespace WeexCore { public: - void LayoutBefore(); + void LayoutBeforeImpl(); - void LayoutAfter(); + void LayoutAfterImpl(); - void copyFrom(RenderObject* src); + void CopyFrom(RenderObject *src); - void mapInsertOrAssign(std::map<std::string, std::string> *targetMap, const std::string& key, const std::string& value); + void MapInsertOrAssign(std::map<std::string, std::string> *targetMap, const std::string &key, + const std::string &value); bool ViewInit(); @@ -80,9 +81,9 @@ namespace WeexCore { void BindMeasureFunc(); - void onLayoutBefore(); + void OnLayoutBefore(); - void onLayoutAfter(float width, float height); + void OnLayoutAfter(float width, float height); virtual StyleType ApplyStyle(const std::string &key, const std::string &value, const bool updating); @@ -108,74 +109,61 @@ namespace WeexCore { bool IsAppendTree(); - inline RenderObject *GetChild(const Index &index) { - return static_cast<RenderObject*>(getChildAt(index)); - } + RenderObject *GetChild(const Index &index); - inline void RemoveRenderObject(RenderObject *child) { - removeChild(child); - } + void RemoveRenderObject(RenderObject *child); - inline void AddAttr(std::string key, std::string value) { - mapInsertOrAssign(this->attributes, key, value); - } + void AddAttr(std::string key, std::string value); - inline StyleType AddStyle(std::string key, std::string value) { - return ApplyStyle(key, value, false); - } + StyleType AddStyle(std::string key, std::string value); - inline void AddEvent(std::string event) { - if (this->events == nullptr || this->events->empty()) { - this->events = new std::set<std::string>(); - } - this->events->insert(event); - } + void AddEvent(std::string event); - inline void RemoveEvent(const std::string &event) { - this->events->erase(event); - } + void RemoveEvent(const std::string &event); + + public: - inline void SetParentRender(RenderObject *render) { - this->parent_render = render; + inline void set_parent_render(RenderObject *render) { + this->parent_render_ = render; } - inline RenderObject *GetParentRender() { - return this->parent_render; + inline RenderObject *parent_render() { + return this->parent_render_; } - inline std::map<std::string, std::string> *Styles() const { - return this->styles; + inline std::map<std::string, std::string> *styles() const { + return this->styles_; } - inline std::map<std::string, std::string> * Attributes() const { - return this->attributes; + inline std::map<std::string, std::string> * attributes() const { + return this->attributes_; } - inline std::set<std::string> *Events() const { - return this->events; + inline std::set<std::string> *events() const { + return this->events_; } - inline void MarkRootRender() { - this->is_root_render = true; + inline void set_is_root_render() { + this->is_root_render_ = true; } - inline bool IsRootRender() { - return this->is_root_render; + inline bool is_root_render() { + return this->is_root_render_; } - inline bool IsSticky() { - return this->is_sticky; + inline bool is_sticky() { + return this->is_sticky_; } private: - RenderObject *parent_render; - std::map<std::string, std::string> *styles; - std::map<std::string, std::string> *attributes; - std::set<std::string> *events; - float viewport_width = -1; - bool is_root_render; - bool is_sticky = false; + RenderObject *parent_render_; + std::map<std::string, std::string> *styles_; + std::map<std::string, std::string> *attributes_; + std::set<std::string> *events_; + float viewport_width_ = -1; + bool is_root_render_; + bool is_sticky_ = false; }; } //end WeexCore #endif //RenderObject_h http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/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 index 4844383..139af5e 100644 --- a/weex_core/Source/core/render/node/render_scroller.cpp +++ b/weex_core/Source/core/render/node/render_scroller.cpp @@ -35,17 +35,17 @@ namespace WeexCore { std::string prop = isVertical ? HEIGHT : WIDTH; - if (prop == HEIGHT && isnan(getStyleHeight()) && !this->is_set_flex) { + if (prop == HEIGHT && isnan(getStyleHeight()) && !this->is_set_flex_) { style->insert(std::pair<std::string, std::string>(FLEX, "1")); - } else if (prop == WIDTH && isnan(getStyleWidth()) && !this->is_set_flex) { + } else if (prop == WIDTH && isnan(getStyleWidth()) && !this->is_set_flex_) { style->insert(std::pair<std::string, std::string>(FLEX, "1")); } return style; } - void RenderScroller::setFlex(const float flex) { - this->is_set_flex = true; - WXCoreLayoutNode::setFlex(flex); + void RenderScroller::set_flex(const float flex) { + this->is_set_flex_ = true; + WXCoreLayoutNode::set_flex(flex); } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8f8b214f/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 2868d8b..fed8f0b 100644 --- a/weex_core/Source/core/render/node/render_scroller.h +++ b/weex_core/Source/core/render/node/render_scroller.h @@ -24,13 +24,13 @@ namespace WeexCore { class RenderScroller : public RenderObject { - bool is_set_flex = false; + bool is_set_flex_ = false; std::map<std::string, std::string> *GetDefaultStyle(); - void setFlex(const float flex); + void set_flex(const float flex); - inline float calcFreeSpaceAlongMainAxis(const float &width, const float &height, + inline float CalculateFreeSpaceAlongMainAxis(const float &width, const float &height, const float ¤t_length) const override { return NAN; }
