From 3226efdb24a42eff67876a7bc29fc42700acb53c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sat, 2 May 2026 01:47:08 -0300 Subject: [PATCH] Do not allow to set width and height of `html` and `body` from CSS since they need to have very specific sizing. --- include/eepp/ui/uirichtext.hpp | 1 + src/eepp/ui/uirichtext.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/eepp/ui/uirichtext.hpp b/include/eepp/ui/uirichtext.hpp index 5c684f745..304ac49fc 100644 --- a/include/eepp/ui/uirichtext.hpp +++ b/include/eepp/ui/uirichtext.hpp @@ -166,6 +166,7 @@ class EE_API UIHTMLHtml : public UIRichText { static UIHTMLHtml* New( const std::string& tag ); virtual Uint32 getType() const override; bool isType( const Uint32& type ) const override; + bool applyProperty( const StyleSheetProperty& attribute ) override; protected: UIHTMLHtml( const std::string& tag = "html" ); diff --git a/src/eepp/ui/uirichtext.cpp b/src/eepp/ui/uirichtext.cpp index 1a703b953..64e7809e8 100644 --- a/src/eepp/ui/uirichtext.cpp +++ b/src/eepp/ui/uirichtext.cpp @@ -34,6 +34,21 @@ bool UIHTMLHtml::isType( const Uint32& type ) const { return UIHTMLHtml::getType() == type ? true : UIRichText::isType( type ); } +bool UIHTMLHtml::applyProperty( const StyleSheetProperty& attribute ) { + if ( !checkPropertyDefinition( attribute ) ) + return false; + + switch ( attribute.getPropertyDefinition()->getPropertyId() ) { + case PropertyId::Width: + case PropertyId::Height: + return false; // Ignore width and height set from CSS + default: + break; + } + + return UIRichText::applyProperty( attribute ); +} + UILineBreak* UILineBreak::New( const std::string& tag ) { return eeNew( UILineBreak, ( tag ) ); } @@ -69,6 +84,9 @@ bool UIHTMLBody::applyProperty( const StyleSheetProperty& attribute ) { return false; switch ( attribute.getPropertyDefinition()->getPropertyId() ) { + case PropertyId::Width: + case PropertyId::Height: + return false; // Ignore width and height set from CSS case PropertyId::BackgroundColor: case PropertyId::BackgroundImage: case PropertyId::BackgroundTint: