Skip to content

Commit

Permalink
Update children widgets recursively (#2346)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro authored and bluemarvin committed Nov 22, 2019
1 parent f889ece commit 6bef00e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/main/cpp/BrowserWorld.cpp
Expand Up @@ -1042,6 +1042,16 @@ BrowserWorld::UpdateWidget(int32_t aHandle, const WidgetPlacementPtr& aPlacement
LayoutWidget(aHandle);
}

void
BrowserWorld::UpdateWidgetRecursive(int32_t aHandle, const WidgetPlacementPtr& aPlacement) {
UpdateWidget(aHandle, aPlacement);
for (WidgetPtr& widget: m.widgets) {
if (widget->GetPlacement() && widget->GetPlacement()->parentHandle == aHandle) {
UpdateWidgetRecursive(widget->GetHandle(), widget->GetPlacement());
}
}
}

void
BrowserWorld::RemoveWidget(int32_t aHandle) {
ASSERT_ON_RENDER_THREAD();
Expand Down Expand Up @@ -1514,7 +1524,7 @@ JNI_METHOD(void, updateWidgetNative)
(JNIEnv* aEnv, jobject, jint aHandle, jobject aPlacement) {
crow::WidgetPlacementPtr placement = crow::WidgetPlacement::FromJava(aEnv, aPlacement);
if (placement) {
crow::BrowserWorld::Instance().UpdateWidget(aHandle, placement);
crow::BrowserWorld::Instance().UpdateWidgetRecursive(aHandle, placement);
}
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/BrowserWorld.h
Expand Up @@ -45,6 +45,7 @@ class BrowserWorld {
void SetSurfaceTexture(const std::string& aName, jobject& aSurface);
void AddWidget(int32_t aHandle, const WidgetPlacementPtr& placement);
void UpdateWidget(int32_t aHandle, const WidgetPlacementPtr& aPlacement);
void UpdateWidgetRecursive(int32_t aHandle, const WidgetPlacementPtr& aPlacement);
void RemoveWidget(int32_t aHandle);
void StartWidgetResize(int32_t aHandle, const vrb::Vector& aMaxSize, const vrb::Vector& aMinSize);
void FinishWidgetResize(int32_t aHandle);
Expand Down

0 comments on commit 6bef00e

Please sign in to comment.