Repository: incubator-weex Updated Branches: refs/heads/master b25cfd4cc -> 0d960067e
[WEEX-386][Core] Fix apply default style Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ba2a59a2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ba2a59a2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ba2a59a2 Branch: refs/heads/master Commit: ba2a59a26c6176afdff17d75eaebc9517f5e22f2 Parents: b25cfd4 Author: miomin <miomin...@foxmail.com> Authored: Mon May 28 17:48:44 2018 +0800 Committer: miomin <miomin...@foxmail.com> Committed: Mon May 28 17:52:51 2018 +0800 ---------------------------------------------------------------------- weex_core/Source/core/render/node/render_appbar.h | 9 +++++++-- weex_core/Source/core/render/node/render_object.h | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ba2a59a2/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 27774fb..9795de6 100644 --- a/weex_core/Source/core/render/node/render_appbar.h +++ b/weex_core/Source/core/render/node/render_appbar.h @@ -43,13 +43,18 @@ namespace WeexCore { style->insert(std::pair<std::string, std::string>(PADDING_LEFT, "0")); style->insert(std::pair<std::string, std::string>(PADDING_RIGHT, "0")); - if (!appbar_color.empty() && appbar_color != "") + if (!appbar_color.empty() && appbar_color != "" && !StyleExist(appbar_color)) style->insert(std::pair<std::string, std::string>(COLOR, appbar_color)); - if (!appbar_background_color.empty() && appbar_background_color != "") + if (!appbar_background_color.empty() && appbar_background_color != "" && !StyleExist(appbar_background_color)) style->insert(std::pair<std::string, std::string>(BACKGROUND_COLOR, appbar_background_color)); return style; } + inline bool StyleExist(const std::string &key) { + std::string value = GetStyle(key); + return !value.empty() && value != ""; + } + public: StyleType ApplyStyle(const std::string &key, const std::string &value, const bool updating) { http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ba2a59a2/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 c92f4e9..195c798 100644 --- a/weex_core/Source/core/render/node/render_object.h +++ b/weex_core/Source/core/render/node/render_object.h @@ -432,6 +432,18 @@ namespace WeexCore { } } + 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; }