diff --git a/app/src/main/cpp/BrowserWorld.cpp b/app/src/main/cpp/BrowserWorld.cpp index 1fa4b6578..96b38609a 100644 --- a/app/src/main/cpp/BrowserWorld.cpp +++ b/app/src/main/cpp/BrowserWorld.cpp @@ -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(); @@ -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); } } diff --git a/app/src/main/cpp/BrowserWorld.h b/app/src/main/cpp/BrowserWorld.h index ae3046bf6..e58d0909f 100644 --- a/app/src/main/cpp/BrowserWorld.h +++ b/app/src/main/cpp/BrowserWorld.h @@ -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);