Fix two list-marker issues:

- Decimal/text markers now inherit the current list-item font color.
  - Marker X/Y coordinates are pixel-snapped, eliminating blurry rendering.
  - The behavior is shared by <li> and textual <summary> markers.
  - Added focused tests for inherited color and integer positioning.
This commit is contained in:
Martín Lucas Golini
2026-08-23 18:50:45 -03:00
parent e269d65e01
commit 65a389aa96
5 changed files with 51 additions and 11 deletions

View File

@@ -26,6 +26,7 @@
#include <eepp/ui/uihtmldetails.hpp>
#include <eepp/ui/uihtmlimage.hpp>
#include <eepp/ui/uihtmlinput.hpp>
#include <eepp/ui/uihtmlliststyle.hpp>
#include <eepp/ui/uihtmltable.hpp>
#include <eepp/ui/uihtmltextarea.hpp>
#include <eepp/ui/uihtmltextinput.hpp>
@@ -2402,6 +2403,25 @@ UTEST( UILayout, listStyleTypeDecimal ) {
Engine::destroySingleton();
}
UTEST( UILayout, textListMarkerTracksInheritedColor ) {
FontStyleConfig inheritedStyle;
inheritedStyle.FontColor = Color( 224, 230, 237 );
inheritedStyle.CharacterSize = 19;
Text marker;
marker.setString( "1." );
UIHTMLListStyle::syncTextMarkerColor( marker, inheritedStyle.FontColor );
EXPECT_TRUE( marker.getFillColor() == inheritedStyle.FontColor );
}
UTEST( UILayout, textListMarkerPositionIsPixelAligned ) {
const Vector2f markerPos = UIHTMLListStyle::getTextMarkerPosition(
{ 100.75f, 40.5f }, Rectf( 0.25f, 1.75f, 0.f, 0.f ), 12.4f, 17.f );
EXPECT_TRUE( markerPos == markerPos.floor() );
}
UTEST( UILayout, listStyleTypeDisc ) {
init_ui_test();
auto* sceneNode = SceneManager::instance()->getUISceneNode();