From b9725c04d5c8650ae7c76cb73235aa303118a6f2 Mon Sep 17 00:00:00 2001 From: Michael Ragazzon Date: Fri, 21 Jan 2022 02:06:49 +0100 Subject: [PATCH] Override styles on the cursor proxy to avoid inheriting body decoration from the cloned element's document body --- Source/Core/Context.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/Core/Context.cpp b/Source/Core/Context.cpp index 569126629..9fd6cee3d 100644 --- a/Source/Core/Context.cpp +++ b/Source/Core/Context.cpp @@ -67,6 +67,18 @@ Context::Context(const String& name) : name(name), dimensions(0, 0), density_ind ElementDocument* cursor_proxy_document = rmlui_dynamic_cast< ElementDocument* >(cursor_proxy.get()); RMLUI_ASSERT(cursor_proxy_document); cursor_proxy_document->context = this; + + // The cursor proxy takes the style from its cloned element's document. The latter may define style rules for `` which we don't want on the + // proxy. Thus, we override some properties here that we in particular don't want to inherit from the client document, especially those that + // result in decoration of the body element. + cursor_proxy_document->SetProperty(PropertyId::BackgroundColor, Property(Colourb(255, 255, 255, 0), Property::COLOUR)); + cursor_proxy_document->SetProperty(PropertyId::BorderTopWidth, Property(0, Property::PX)); + cursor_proxy_document->SetProperty(PropertyId::BorderRightWidth, Property(0, Property::PX)); + cursor_proxy_document->SetProperty(PropertyId::BorderBottomWidth, Property(0, Property::PX)); + cursor_proxy_document->SetProperty(PropertyId::BorderLeftWidth, Property(0, Property::PX)); + cursor_proxy_document->SetProperty(PropertyId::Decorator, Property()); + cursor_proxy_document->SetProperty(PropertyId::OverflowX, Property(Style::Overflow::Visible)); + cursor_proxy_document->SetProperty(PropertyId::OverflowY, Property(Style::Overflow::Visible)); enable_cursor = true;