Skip to content

Commit

Permalink
Merge branch 'main' into feature/update-vue-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
open-hippy authored Aug 29, 2023
2 parents 8eb0fea + 3a2e85d commit 78e0aa3
Show file tree
Hide file tree
Showing 39 changed files with 215 additions and 434 deletions.
2 changes: 1 addition & 1 deletion framework/android/connector/renderer/tdf/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
# TDFCore's artifact version.
#
# Build from TDFCore's Git commit id: 8a14a23841.
CPP_TDF_CORE_VERSION=0.0.9
CPP_TDF_CORE_VERSION=0.0.14
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ public View replaySnapshot(@NonNull Context context,
return null;
}

@Override
public void removeSnapshotView() {
if (mRenderer != null) {
mRenderer.removeSnapshotView();
}
}

@Override
public void setFrameworkProxy(@NonNull Object proxy) {
if (mRenderer != null && proxy instanceof FrameworkProxy) {
Expand Down
2 changes: 2 additions & 0 deletions modules/footstone/include/footstone/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ constexpr inline size_t SIZE_OF = sizeof(T);
template <typename CharType, size_t N>
char (&ARRAY_SIZE_HELPER(CharType (&array)[N]))[N];

#ifndef WEAK_THIS
#define WEAK_THIS weak_this = weak_from_this()
#endif
#define SHARED_THIS self = this->shared_from_this()
// 表明该lambda不会被存储,可以安全使用this
#define THIS_NO_STORE this
Expand Down
2 changes: 1 addition & 1 deletion renderer/tdf/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ dependencies {
compileOnly project(path: ':pool')
// tdf render need ControllerManager from native manager
compileOnly project(path: ':renderer-native')
compileOnly "com.tencent.tdfcore:embedder:0.0.8"
compileOnly "com.tencent.tdfcore:embedder:0.0.16"
compileOnly deps.annotation
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ void RegisterTDFEngine(JNIEnv *j_env, jobject j_obj, jint j_render_id,
auto render_manager_object = std::static_pointer_cast<TDFRenderManager>(
std::any_cast<std::shared_ptr<RenderManager>>(render_manager));
auto engine = reinterpret_cast<tdfcore::TDFEngineAndroid *>(j_engine_id);
render_manager_object->RegisterShell(static_cast<uint32_t>(j_root_view_id), engine->GetShell());
render_manager_object->RegisterShell(static_cast<uint32_t>(j_root_view_id), engine->GetShell(),
engine->GetPipeline()->GetRenderContext());
}

void SetUriLoader(JNIEnv *j_env, jobject j_obj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public TDFRenderEngine(@NonNull Context context, TDFEngineConfig configuration)
}

@Override
public void onShellCreated(long shell) {
super.onShellCreated(shell);
public void onShellCreated(long shell, long pipelineId) {
super.onShellCreated(shell, pipelineId);
LogUtils.d(TAG, "onShellCreated: " + shell);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ public View replaySnapshot(@NonNull Context context,
return null;
}

@Override
public void removeSnapshotView() {}

@Override
public void handleRenderException(@NonNull Exception exception) {
LogUtils.d(TAG, "handleRenderException: " + exception.getMessage());
Expand Down
1 change: 0 additions & 1 deletion renderer/tdf/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ set(SRC_SET
src/renderer/tdf/viewnode/view_node.cc
src/renderer/tdf/view/modal_view.cc
src/renderer/tdf/view/view_pager.cc
src/renderer/tdf/gesture/touch_recognizer.cc
src/renderer/tdf/devtools/devtools_util.cc
)
target_sources(${PROJECT_NAME} PRIVATE ${SRC_SET})
Expand Down
102 changes: 0 additions & 102 deletions renderer/tdf/common/include/renderer/tdf/gesture/touch_recognizer.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ class TDFRenderManager
const DomArgument &param,
uint32_t cb_id) override;

void RegisterShell(uint32_t root_id, const std::shared_ptr<tdfcore::Shell> &shell);
void RegisterShell(uint32_t root_id, const std::shared_ptr<tdfcore::Shell> &shell,
const std::shared_ptr<tdfcore::RenderContext> &render_context);

void SetDomManager(std::weak_ptr<DomManager> dom_manager) { dom_manager_ = dom_manager; }

Expand Down
3 changes: 2 additions & 1 deletion renderer/tdf/common/include/renderer/tdf/view/modal_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ inline namespace view {

using tdfcore::TRect;
using tdfcore::View;
using tdfcore::ViewContext;

using OnShowCallBack = std::function<void()>;
using OnDismissCallBack = std::function<void()>;
Expand All @@ -57,7 +58,7 @@ class ModalView : public View {
public:
~ModalView() override;

ModalView();
ModalView(const std::shared_ptr<ViewContext> &context);

void AddView(const std::shared_ptr<View> &child) override;

Expand Down
3 changes: 2 additions & 1 deletion renderer/tdf/common/include/renderer/tdf/view/view_pager.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ inline namespace tdf {
inline namespace view {

using tdfcore::ScrollView;
using tdfcore::ViewContext;

using ScrollOffsetListener = std::function<void(int32_t position, double offset)>;
using PageSelectedListener = std::function<void(int32_t position)>;
Expand All @@ -68,7 +69,7 @@ class ViewPager : public ScrollView {
TDF_REFF_CLASS_META(ViewPager)

public:
ViewPager();
ViewPager(const std::shared_ptr<ViewContext> &context);

void Init() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class EmbeddedViewNode : public ViewNode {
std::string DomStyleMap2String(const DomStyleMap &dom_style);

private:
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;

std::map<std::string, std::string> property_;
std::string native_view_type_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ImageViewNode : public ViewNode {
std::string default_src_;
std::string image_src_;
std::string scale_type_;
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;
};

} // namespace tdf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ListViewItemNode : public ViewNode {
/**
* @brief ListViewItemNode's CreateView is Public, can be called by ListViewDataSource.
*/
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;

void UpdateViewType(const DomStyleMap& dom_style);

Expand All @@ -94,7 +94,7 @@ class ListViewItemNode : public ViewNode {

class ListViewNode;

class ListViewDataSource : public tdfcore::CustomLayoutViewDataSource, public tdfcore::Object {
class ListViewDataSource : public tdfcore::CustomLayoutViewDataSource {
public:
ListViewDataSource(std::shared_ptr<ListViewNode> host) : list_view_node_(host) {}

Expand Down Expand Up @@ -136,7 +136,7 @@ class ListViewNode : public ScrollViewNode {

void HandleStyleUpdate(const DomStyleMap& dom_style, const DomDeleteProps& dom_delete_props) override;

std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;

void SetShouldReload() { should_reload_ = true; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ModalViewNode : public ViewNode {
void OnCreate() override;
void HandleLayoutUpdate(hippy::LayoutResult layout_result) override;
void HandleStyleUpdate(const DomStyleMap& dom_style, const DomDeleteProps& dom_delete_props) override;
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;
std::string GetViewName() const override { return kModaViewName; }

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ namespace hippy {
inline namespace render {
inline namespace tdf {

using tdfcore::ViewContext;

inline namespace refreshwrapper {
constexpr const char kRefreshWrapper[] = "RefreshWrapper";
constexpr const char kBounceTime[] = "bounceTime"; // int
Expand All @@ -51,8 +53,8 @@ constexpr const char kRefreshComplected[] = "refreshComplected";

class HippyRefreshHeader : public tdfcore::RefreshHeader {
public:
explicit HippyRefreshHeader(std::shared_ptr<tdfcore::View> content_view)
: tdfcore::RefreshHeader(), content_view_(std::move(content_view)) {}
explicit HippyRefreshHeader(const std::shared_ptr<ViewContext> &context, std::shared_ptr<tdfcore::View> content_view)
: tdfcore::RefreshHeader(context), content_view_(std::move(content_view)) {}

std::shared_ptr<tdfcore::View> GetView() override { return content_view_; }

Expand All @@ -69,7 +71,7 @@ class RefreshWrapperItemNode : public ViewNode {
/**
* @brief make CreateView public,because it's call by RefreshWrapperNode
*/
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;

void HandleLayoutUpdate(hippy::LayoutResult layout_result) override;
};
Expand All @@ -86,7 +88,7 @@ class RefreshWrapperNode : public ViewNode {
void CallFunction(const std::string& name, const DomArgument& param, const uint32_t call_back_id) override;

private:
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;
void HandleOffsetListener(int32_t position, double offset);
std::shared_ptr<RefreshWrapperItemNode> item_node_;
std::shared_ptr<HippyRefreshHeader> refresh_header_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#pragma once

#include "dom/root_node.h"
#include "renderer/tdf/viewnode/view_node.h"
#include "dom/root_node.h"

namespace hippy {
inline namespace render {
Expand All @@ -34,12 +34,13 @@ class RootViewNode : public ViewNode {
using UriDataGetter = std::function<void(const StringView& uri, const DataCb cb)>;

RootViewNode(const RenderInfo info, const std::shared_ptr<tdfcore::Shell>& shell,
const std::shared_ptr<tdfcore::RenderContext>& render_context,
const std::shared_ptr<hippy::DomManager>& manager, UriDataGetter getter);
~RootViewNode() override = default;

void Init() override;

std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;

void RegisterViewNode(uint32_t id, const std::shared_ptr<ViewNode>& view_node);
void UnregisterViewNode(uint32_t id);
Expand All @@ -55,6 +56,10 @@ class RootViewNode : public ViewNode {

std::shared_ptr<tdfcore::Shell> GetShell() { return shell_.lock(); }

std::shared_ptr<tdfcore::RenderContext> GetRenderContext() { return render_context_.lock(); }

std::shared_ptr<tdfcore::ViewContext> GetViewContext() { return view_context_; }

protected:
bool isRoot() override { return true; }

Expand All @@ -66,6 +71,7 @@ class RootViewNode : public ViewNode {
std::unordered_map<uint32_t, std::shared_ptr<ViewNode>> nodes_query_table_;
tdfcore::NoArgListener end_batch_listener_;
std::weak_ptr<tdfcore::Shell> shell_;
std::weak_ptr<tdfcore::RenderContext> render_context_;
std::weak_ptr<hippy::DomManager> dom_manager_;
std::shared_ptr<tdfcore::ViewContext> view_context_;
UriDataGetter getter_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ScrollViewNode : public ViewNode {
using ViewNode::ViewNode;

protected:
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;

void HandleStyleUpdate(const DomStyleMap& dom_style, const DomDeleteProps& dom_delete_props) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class TextInputNode : public ViewNode {

protected:
void HandleStyleUpdate(const DomStyleMap& dom_style, const DomDeleteProps& dom_delete_props) override;
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;

private:
void InitCallBackMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class TextViewNode : public ViewNode {
void HandleLayoutUpdate(hippy::LayoutResult layout_result) override;

private:
std::shared_ptr<tdfcore::View> CreateView() override;
std::shared_ptr<tdfcore::View> CreateView(const std::shared_ptr<ViewContext> &context) override;

void SetText(const DomStyleMap& dom_style, std::shared_ptr<TextView>& text_view);
void SetTextColor(const DomStyleMap& dom_style, TextStyle& text_style);
Expand Down
Loading

0 comments on commit 78e0aa3

Please sign in to comment.