Skip to content

Commit

Permalink
Override styles on the cursor proxy to avoid inheriting body decorati…
Browse files Browse the repository at this point in the history
…on from the cloned element's document body
  • Loading branch information
mikke89 committed Jan 21, 2022
1 parent 9d090ab commit b9725c0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Source/Core/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<body>` 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;

Expand Down

0 comments on commit b9725c0

Please sign in to comment.