Commit Graph

2153 Commits

Author SHA1 Message Date
Martín Lucas Golini
323d511eed Fixed a regression in UIWebView that caused to basically don't have render culling:
- Added UISceneNode::getVisibleWorldBounds() with an optional bounds-node binding.
  - UIWebView binds its document scene to the scroll container’s clipped viewport.
  - UINode::nodeDraw() now culls against visible scene bounds instead of the full document extent.
  - Existing top-level scenes retain their previous behavior.
  - Added a regression test confirming offscreen document widgets are skipped and visible widgets render.
2026-08-01 01:16:13 -03:00
Martín Lucas Golini
13508c20d1 UIImageViewer expanded capabilities.
ecode image viewing will not auto-scale images to the pixel density.
eeiv: Modernizing eeiv to use eepp GUI, already working just like before, there are probably a few things to fix.
2026-07-31 01:25:41 -03:00
Martín Lucas Golini
d3ed96919a Fix percentage margin resolution after async HTML layout
Track percentage-based margins in UIHTMLWidget and re-resolve them when
  the containing parent acquires its final size. This prevents margins
  computed against an initial zero-width container from remaining stale
  until the viewport is resized.

  Add regressions covering percentage margin recomputation and the SS64
  footer layout after a deferred stylesheet is loaded.
2026-07-30 19:08:49 -03:00
Martín Lucas Golini
943103869a fix(ui): preserve CSS order for deferred stylesheets
Reserve stylesheet source positions when link elements are encountered
  instead of assigning them when asynchronous loading completes.

  Track the stylesheet and rule ordinals explicitly so deferred external
  styles retain their document order relative to later inline styles.
  Preserve this ordering when extracting marked stylesheet rules.

  Add an SS64 regression test covering heading and button styles after a
  deferred stylesheet finishes loading.
2026-07-30 17:52:27 -03:00
Martín Lucas Golini
660395ee4d Fix cursor precedence for specialized UI widgets:
Activate retained CSS cursors when the event dispatcher resolves a new
  hover target instead of applying them at the end of UIWidget mouse-over
  handling.

  Resolve cursors through the nearest widget ancestor for non-widget hit
  targets while allowing text inputs, editors, splitters, resize handles,
  and plugins to override the default cursor contextually.

  This restores ecode and Breeze cursor behavior without changing their
  existing styles.
2026-07-30 17:06:21 -03:00
Martín Lucas Golini
ae0c5ffef0 Fix CSS pointer cursor handling on hovered widgets
Map the standard CSS pointer value to the hand cursor and retain the
computed cursor in each UIWidget instead of mutating the scene during
style application.

Apply the retained cursor when a widget becomes the hover target, restore
the arrow when leaving the UI, and make cursor inheritance available to
descendants such as inline SVG elements.

Store cursor state in an existing UIWidget padding gap and centralize
cursor serialization in Cursor::toName().

Add regressions for pointer parsing, cursor serialization, inheritance,
and the SS64 search button SVG.
2026-07-30 16:47:52 -03:00
Martín Lucas Golini
246161be7e Fix nested float propagation in rich text layout
Propagate descendant float exclusions through non-BFC HTML containers so
floats participate in their nearest block formatting context.

Finalize line geometry before translating propagated exclusions, track
finalized lines incrementally, and search successive float bands when a
fixed-width inline-block does not fit beside active floats.

Recognize inline-block elements as block formatting contexts while
preserving their fixed width. Reuse persistent float-exclusion storage
across relayouts to avoid repeated allocations.

Add SS64 regressions covering narrow viewports, HiDPI rendering, stacked
floats, anchor sizing, SVG sizing, and footer overlap.

Fixed `cursor: pointer`, `pointer` was not registered.
2026-07-30 16:28:36 -03:00
Martín Lucas Golini
9fc385307a Fix percentage-sized inline SVG layout and rendering
Resolve percentage dimensions for HTML-backed widgets after their containing
block has a definite size. Apply the resolution during rich-text, flex, and
grid layout without triggering broad layout invalidation.

Rasterize SVGs using their resolved dimensions when intrinsic width or height
attributes are missing or percentage-based.

Add regression coverage for percentage-sized SVGs and the SS64 navigation
buttons and search icon.
2026-07-30 13:38:36 -03:00
Martín Lucas Golini
4d644880d8 Fix in CSS properties parser when comments were between and inside properties. 2026-07-30 13:11:33 -03:00
Martín Lucas Golini
d61c8a7582 Fix flex items losing their stretched cross size
Preserve the final cross-axis size assigned to auto-sized stretched flex
items when their block layout runs. Keep intrinsic flex measurement
separate so content changes can still update item sizing correctly.

Add an HTML regression test covering a short sidebar stretched alongside
taller content.
2026-07-30 11:46:54 -03:00
Martín Lucas Golini
9f65377c50 Fixed the heap-use-after-free, root cause: system fallback loading published a font under desc.family, replacing and destroying an existing same-family font while its getGlyph() call was still executing. 2026-07-30 11:21:09 -03:00
Martín Lucas Golini
acd19069c3 Add table/tree view CSS properties, UIModelCreator, and optimize string allocations
- Add CSS properties: editable, selection-type, selection-kind, icon-size,
  sort-icon-size, main-column, row-header-width, table-flags (pipe-separated),
  indent-width, expander-icon-size, table-model
- Create UIModelCreator static factory with 4 built-in models:
  widgettree, filesystem, diskdrives, cssproperties
- Eliminate 17 heap-allocating std::string copies in applyProperty()
  handlers across 12 files using String::iequals with const refs
- Replace table-flags token parsing with allocation-free String::splitCb
- Update cssspecification.md with all new property documentation

Fixed fall-through bugs in applyProperty.
Fixed status terminal button "Terminal" not setting the tooltip text correctly.
2026-07-28 00:15:04 -03:00
Martín Lucas Golini
935b28c91a Fix HTML input styling and internal control layout
Treat UIHTMLInput as the stable HTML/CSS host while keeping its native
control as an anonymous implementation detail.

Prevent author CSS from matching internal control widgets, avoiding
duplicated backgrounds and other styles. Keep valid input types such as
email intact for attribute selectors while falling back to compatible
native implementations.

Synchronize the internal control with the host content box after layout,
including flex sizing, and preserve intrinsic measurement for size and
font changes. Preserve input state across dynamic type changes and make
hidden transitions reversible.

Also fix border-radius calculations and add regressions for CSS ownership,
anonymous widget isolation, dynamic type changes, input sizing, and the
Causality newsletter form.
2026-07-27 11:17:23 -03:00
Martín Lucas Golini
90f41a64aa Fix HTML viewport sizing and background shorthand parsing
- parse slash-separated background position and size without requiring whitespace
  - recognize custom-property background images following an explicit size
  - resolve root body and html minimum heights against the layout viewport
  - avoid expanding semantic document boxes to the scrollable content extent
  - handle auto margins and percentage offsets correctly for absolute positioning
  - add DuckDuckGo layout and background shorthand regression tests
  - document the Xvfb limitation with multisampled OpenGL contexts
2026-07-27 00:59:39 -03:00
Martín Lucas Golini
a113c0f6c9 Rename FrameBufferRegistry, ShaderProgramRegistry and VertexBufferRegistry file names.
Rename class and file of PackManager to PackRegistry to follow the new naming convention.
2026-07-26 23:16:24 -03:00
Martín Lucas Golini
33bba67dde Correct paddings in Glyph struct.
Disable Haiku build until beta6 vm.
2026-07-26 13:22:21 -03:00
Martín Lucas Golini
ce3a10a3bd Single pass subpixel rendering in all backends.
Build fixes.
2026-07-26 01:44:31 -03:00
Martín Lucas Golini
fac6c4ab05 Single pass subpixel rendering in OpenGL 2 context.
Fix unit-tests build issue.
2026-07-26 01:02:06 -03:00
Martín Lucas Golini
521e2af2e2 Should fix unit-tests. 2026-07-26 00:04:03 -03:00
Martín Lucas Golini
9f4ae9e83c Font SubPixel antialiasing support for eterm and ui_html. 2026-07-25 21:24:45 -03:00
Martín Lucas Golini
b71ef9522d Clean up. 2026-07-25 20:31:52 -03:00
Martín Lucas Golini
c0debbee9f Rollback to fix rendering. 2026-07-25 20:26:24 -03:00
Martín Lucas Golini
27a57960f4 SubPixel hinting support. 2026-07-25 18:59:20 -03:00
Martín Lucas Golini
b940407102 ecode: The custom fallback font reused the "fallback-font" resource key, replacing the built-in CJK fallback in FontService.
Fix:

  - User fallback now uses "user-fallback-font".
  - Built-in CJK and custom fallback fonts remain registered together.
  - Added and passed a regression test verifying both fallback resources remain in the chain.

Fixes in premake5.lua:

  - Removed obsolete PRECISE_F32=1; Wasm already provides precise float behavior.
  - Moved ENVIRONMENT=worker,web to final application link options.

Fixed MarkdownView not getting the correct CSS style from the base theme.
2026-07-25 01:36:00 -03:00
Martín Lucas Golini
2601048a17 clarify FontTrueType scope ownership
Document that a FontTrueType can be locally associated with only one
  ResourceScope and that catalog imports should be used to share fonts
  between scopes.

  Note the current single FontService pointer limitation and the possible
  future direction of moving fallback resolution out of shared fonts.
2026-07-24 23:40:19 -03:00
Martín Lucas Golini
8bdee0281f graphics: add strong 64-bit resource name hashes
Introduce ResourceNameHash using wyhash for fast drawable and font
  secondary indexes without changing the global String::HashType.

  Replace the 32-bit resource indexes with direct 64-bit weak-handle
  lookups while keeping complete ResourceKey lookup authoritative.
  Preserve legacy persisted drawable hash support through a documented
  compatibility scan and migrate internal font operations to semantic
  name lookup.

  Add regression coverage proving names that collide under the legacy
  hash remain independently addressable.
2026-07-24 23:33:16 -03:00
Martín Lucas Golini
605c81087d harden web resource cache completion lifecycle
Identify asynchronous loads by cache epoch and operation ID so stale
  completions cannot modify replacement entries or corrupt in-flight
  accounting after clear().

  Move decoding, GPU texture mutation, notifications, callback destruction,
  and final resource releases outside the cache mutex. Revalidate operation
  identity between completion phases to preserve correctness across decode
  delays and notification reentrancy.

  Add regression coverage for stale same-key completions after cache reset.
2026-07-24 23:20:42 -03:00
Martín Lucas Golini
caa461a735 complete scoped ownership migration
- migrate themes, skins, icons, shaders, and shader programs to resource handles
  - make UIThemeManager scene-owned and publish resources through scopes and catalogs
  - retain shaders through their programs and expose non-owning GPU registries
  - replace FrameBuffer and VertexBuffer factory ownership with unique pointers
  - migrate engine, UI, tools, examples, tests, and eterm to the new ownership APIs
  - remove the obsolete raw-owning ResourceManager templates
  - document the completed Stage 7 architecture and remaining validation work
  - add ownership, registry, and scoped shader-program coverage
2026-07-24 22:45:31 -03:00
Martín Lucas Golini
6b277e508b migrate fonts to scoped resource ownership
- replace FontManager with per-ResourceScope FontService instances
  - publish font factories into explicit or default resource scopes
  - import default resources into UI scene scopes unless explicitly disabled
  - keep related font faces strongly owned without hot-path weak_ptr locking
  - add cached glyph advance queries without creating texture pages
  - fix font picker preview ownership, cleanup, and rapid switching
  - selectively evict TextLayout cache entries when referenced fonts unload
  - document FontService, ResourceCatalog, and cache invalidation semantics
  - migrate examples, tools, benchmarks, and tests to the scoped font API
  - expand coverage for font ownership, texture release, and layout caching
2026-07-24 01:54:51 -03:00
Martín Lucas Golini
373bd40e59 migrate texture atlases to scoped ownership
- replace TextureAtlasManager and GlobalTextureAtlas with catalog-backed atlas ownership
  - make TextureAtlas and TextureRegion creation return explicit resource handles
  - let atlases retain their textures and regions through shared ownership
  - add atlas publication, lookup, removal, and enumeration to ResourceCatalog and ResourceScope
  - make TextureAtlasLoader publish atlases and regions into an explicit resource scope
  - move theme atlas ownership into each theme resource catalog
  - migrate maps, editors, examples, and tests away from the global atlas manager
  - add scope-aware Sprite pattern-loading overloads while preserving default-scope compatibility
  - fix re-entrant style-state invalidation when applying styles creates new widgets
  - add atlas ownership, scoped Sprite lookup, and style-state regression coverage
  - update the resource ownership plan and texture atlas editor launch configuration
2026-07-23 01:41:11 -03:00
Martín Lucas Golini
574b6b9014 move nine-patches into scoped catalogs
Return shared handles from NinePatch creation and remove the process-wide
  NinePatchManager singleton.

  Extend ResourceCatalog with typed drawable-source ownership and expose
  drawable publication, lookup, and removal through ResourceScope. Preserve
  separate texture and drawable namespaces for direct typed lookup.

  Give each UITheme its own resource catalog and have scene-owned theme
  managers explicitly import and remove theme catalogs. Handle registered
  themes and default-only themes without leaking stale resource visibility
  between scenes.

  Update theme loading, Engine teardown, platform source manifests, and
  resource ownership tests for the catalog-based model.

  Document that remaining singleton resource managers must migrate to
  naturally owned catalogs and explicit scope imports instead of becoming
  new process-global semantic namespaces.
2026-07-22 22:07:00 -03:00
Martín Lucas Golini
2d8693295c add shared WebView resource cache:
Introduce WebResourceCache with partitioned sharing, per-document sessions,
navigation generations, leases, and canonical request keys.

Coalesce concurrent document, stylesheet, font, and image requests while
discarding stale navigation subscribers independently. Retain completed
resources with TTL/LRU and byte-budget policies, and periodically prune
expired unleased entries from UIWebView.

Route UISceneNode, UIWebView, UIImage, CSS background images, and remote
drawable resolution through the shared cache. Preserve ResourceScope entries
as explicit overrides and allow multiple WebViews to share a cache partition.

Keep image decode and texture replacement on the guarded graphics-thread
completion path. Exclude volatile Cookie and Referer values from cache
identity while preserving partition isolation and content-affecting variants.

Start TTL retention when the final document lease is released so Back/Forward
navigation can reuse resources regardless of how long the previous page was
open.

Avoid unstable pointers and iterators into unordered_dense storage when
tracking leases and pruning entries. Add ASan regression coverage for dense
map growth, navigation, eviction, partition isolation, request coalescing,
retry behavior, and cache retention.

Fully document cache partitions, sessions, generations, request identity,
ownership, threading, and maintenance behavior.
2026-07-22 02:22:38 -03:00
Martín Lucas Golini
f7dba042df Replace DrawableSearcher with scoped drawable resolution:
Add a scene-owned UI::DrawableResolver for resolving file, data, HTTP, and
named drawable references through each UISceneNode's current resource scope.

Move generic texture, atlas region, nine-patch, and sprite lookup into
Graphics::ResourceScope, preserving drawable resolution for pure Graphics
consumers without introducing a UI dependency.

Migrate UI images, sprites, menus, CSS parsing, and tests to the new resolver.
Resolve CSS icons through the requesting node's scene instead of the global
scene, preserving embedded-scene isolation.

Remove the obsolete DrawableSearcher API and update platform project manifests,
tests, and the shared-resource architecture plan.
2026-07-21 23:50:58 -03:00
Martín Lucas Golini
b5efd6d709 Graphics: refine drawable cloning and icon source rendering:
Rename Drawable::createInstance() to clone() and update drawable implementations,
typed helpers, consumers, tests, tools, and external modules.

Avoid retaining private icon clones for immediate single-threaded rendering in the
code editor and ecode plugins. Borrow cached per-size icon sources instead, restoring
temporary color changes after drawing, while preserving owned clones for widgets,
menus, models, and other stateful consumers.

Reduce common drawable allocation overhead by lazily creating DrawableResource
callback state, using inline callback storage and notification snapshots, and safely
supporting callback disconnection during notification.

Lazily allocate UIImage and UINodeDrawable asynchronous lifetime tokens only when
an uncached asynchronous load is actually scheduled.

Document the distinction between borrowed immediate rendering and independently
owned drawable state.
2026-07-21 21:16:32 -03:00
Martín Lucas Golini
953e0ea006 Merge branch 'develop' into feature/resource-shared-ownership 2026-07-21 15:38:11 -03:00
Martín Lucas Golini
2f18e4a2b5 Pump version, release commit. 2026-07-20 22:59:58 -03:00
Martín Lucas Golini
2e7958c8d2 Compilation fixes. 2026-07-20 10:38:22 -03:00
Martín Lucas Golini
dc377335b9 graphics: migrate drawables to shared ownership
- introduce DrawablePtr and per-consumer createInstance() semantics
  - add TextureDrawable wrappers backed by shared TexturePtr handles
  - migrate regions, sprites, nine-patches, state lists, skins, groups, gradients,
    UI widgets, tools, modules, ecode, and eeiv to shared drawable ownership
  - remove ownIt flags, manual drawable deletion, and unload-based lifetime handling
  - replace drawable callback IDs with RAII change connections
  - move Variant drawable storage outside its scalar union
  - split UIIcon source lookup from explicit drawable instance creation
  - retain icon instances used by rendering loops instead of cloning per frame
  - avoid shared source mutation in texture-region consumers
  - use drawable type tags instead of RTTI casts
  - fix nearest-size UIIcon lookup
  - document the drawable source/instance contract and add ownership tests
2026-07-20 01:09:36 -03:00
Martín Lucas Golini
04f600bef5 graphics: move texture ownership to catalogs and scopes
Add ResourceCatalog and ResourceScope to provide explicit strong ownership
  and deterministic semantic lookup independently from the live texture
  registry.

  Let Engine own the global catalog and default Graphics scope, and give
  each UISceneNode an isolated scope that can be explicitly shared with
  other scenes.

  Remove TextureFactory's strong texture retention and name/hash lookup.
  The factory now observes textures weakly for identity, diagnostics, and
  deferred destruction without controlling their semantic lifetime.

  Migrate drawable resolution, texture atlas loading, UI image caches,
  tile maps, ecode resources, and related tests to scoped lookup and
  publication.

  Allow final TexturePtr release from worker threads while keeping actual
  texture destruction deferred to the graphics thread. Fix mismatched
  pixel deallocation uncovered by asynchronous texture loading tests.

  Add ownership, scope isolation, scene sharing, worker release, and
  decoder allocation regression tests, and update the shared-resource
  architecture plan through Stage 3.
2026-07-19 23:06:23 -03:00
Martín Lucas Golini
8556bda68c migrate texture consumers to shared ownership
- return TexturePtr from texture creation and lookup APIs
  - retain texture handles in regions, atlases, fonts, framebuffers, sprites, UI, and maps
  - keep queued batch textures alive until rendering completes
  - preserve asynchronous atlas load results directly
  - replace TextureLoader unload semantics with reset
  - remove public texture deletion APIs and obsolete Sprite ownership flags
  - migrate bundled tools, examples, tests, ecode, and diagnostics
  - document Stage 2 completion and the temporary factory retention boundary
2026-07-19 21:27:30 -03:00
Martín Lucas Golini
b0129880d8 Add LSP snippet navigation and expansion support
Implement LSP snippet parsing and editing sessions with tab stops, linked placeholders, choices, variables, transforms, visual feedback, and multi-cursor insertion.
This adds snippet support for LSP completion items. User-defined snippets will be implemented separately.
Refs SpartanJ/ecode#111
2026-07-18 16:51:45 -03:00
Martín Lucas Golini
3dc7b0a5d4 Remove ResourceMetrics. 2026-07-15 12:53:04 -03:00
Martín Lucas Golini
0707225e13 Add shared texture lifetime scaffolding
- introduce process-wide ResourceId, resource handles, and shared metrics
  - manage textures through factory-owned control blocks and a weak live registry
  - defer final texture destruction until display-time batch work is flushed
  - diagnose externally retained textures during Engine shutdown
  - migrate texture identity APIs and consumers from Uint32 to ResourceId
  - decouple texture memory accounting from the TextureFactory singleton
  - replace UITextureViewer callbacks with generation-based weak snapshots
  - remove obsolete texture context-reload APIs and loader callback registry
  - add registry, identity, memory, restart, and deferred-release tests
  - mark Stage 1 complete in the shared-resource architecture plan
2026-07-15 01:42:46 -03:00
Martín Lucas Golini
0ae2537713 fix: bind UI resource deliveries to Engine lifetime
- add explicit open, closing, and closed states to the UISceneNode async delivery queue
    - reject delivery execution during shutdown and purge retained captures after scene producers join
    - reopen the queue cleanly when recreating Engine state in tests
    - add regressions for stale deliveries, retained captures, concurrent producers, and Engine restart
    - remove the obsolete and unused FrameBuffer context-loss reload API
    - simplify redundant namespace qualification in UI tests and ecode declarations
    - consolidate completed resource plans into the active ownership architecture
    - defer TextureLoader callback removal directly to Stage 1 live-texture observation
    - document the requirement to validate legacy lifecycles and prefer removing dead mechanisms
2026-07-14 21:05:39 -03:00
Martín Lucas Golini
7e66e77d89 fix: harden network and font resource lifetimes
- retain asynchronous HTTP operations until execution or queue disposal
  - make HTTP shutdown cancel and join queued and running shared-pool requests
  - avoid deadlocks when callbacks clear the HTTP pool
  - share atomic cancellation state across request copies
  - detect socket creation failures before configuring TCP or UDP sockets
  - release partially initialized mbedTLS state after failed handshakes
  - replace retained FreeType faces with bounded LRU probe-result caching
  - release non-trivial StaticLRU keys when clearing the cache
  - resolve the Texture Viewer close icon through the configured icon theme
  - add HTTP, TLS, UIWebView fan-out, font descriptor, and LRU regressions
  - update resource-refactor prerequisite and ownership planning documents
2026-07-14 02:16:01 -03:00
Martín Lucas Golini
8aa660104f Implemented the deterministic Engine teardown ordering in Engine destructor:
- Pool-owned HTTP clients stop first.
  - The active GL context is made current.
  - Scenes are destroyed before batches and resource managers.
  - Pending batches explicitly discard vertices and borrowed textures.
  - TextLayout cache clears before fonts.
  - Framebuffer/vertex managers and textures are released while Renderer/context remain alive.
  - ShaderProgramManager is destroyed before Renderer.
  - Windows and contexts are destroyed last.

The lifecycle test uncovered and fixed another bug: StaticLRU::clear() retained non-trivial values such as cached shared_ptr<TextLayout> objects. It now releases active values in LRUCache.
2026-07-14 00:03:23 -03:00
Martín Lucas Golini
6bc471fe3d fix: harden resource loading and memory tracking
- fix TextureAtlasLoader filter application across all textures
  - preserve unsigned Variant values as Type::Uint
  - explicitly delete unsafe Texture copy operations
  - define ResourceLoader progress for empty task lists
  - synchronize ResourceLoader status, tasks, and callbacks
  - join atlas loading before destroying callback-visible state
  - fix MemoryManager initialization and accounting races
  - add focused correctness and loader lifetime tests
  - document completed resource-refactor prerequisites
2026-07-13 00:55:54 -03:00
Martín Lucas Golini
f6bce5d044 Optimize hot UI accessors and CSS length parsing:
Inline frequently used scene and UI state accessors to reduce function
  call overhead during layout, rendering, and rich-text traversal.

  Add string-view numeric conversion support and parse CSS length values
  without temporary number or unit strings. Preserve existing string
  overloads for compatibility and keep CSS function parsing unchanged.

  Add focused parsing coverage and benchmarks. Full-suite profiling showed
  substantial reductions in layout invalidation, whitespace traversal, and
  CSS length parsing costs.
2026-07-11 00:10:56 -03:00
Martín Lucas Golini
edf316a5b6 Optimize CSS attribute selector matching:
Resolve standard property definitions and data-attribute classification
  when selectors are parsed, avoiding repeated specification lookups and
  attribute-name checks during matching.

  Fast-path existence-only data selectors without retrieving their values,
  while preserving all attribute operator behavior. Add standard-property
  coverage and an attribute-focused benchmark showing a 41.7% reduction
  in matching time.
2026-07-10 20:01:56 -03:00
Martín Lucas Golini
660d64c823 Optimize single-rule CSS selector matching:
Add a fast path that directly evaluates selectors containing one rule,
  avoiding combinator traversal and switch overhead for common class, ID,
  tag, and pseudo-class selectors.

  Move complex selector traversal into a dedicated function and cache rule
  counts in selector loops. Add focused matching coverage and document the
  Phase 7 benchmark results.
2026-07-10 19:51:05 -03:00