Commit Graph

119 Commits

Author SHA1 Message Date
Martín Lucas Golini
f200850941 Fix eterm tab closing and macOS menu integration
* Serialize tracked realloc and free bookkeeping to prevent cross-thread
    address reuse from corrupting the memory tracker during tab teardown.
  * Add concurrent allocation and terminal close/resize regression coverage.
  * Install a macOS-only File, Edit, and Window menu that mirrors eterm
    keybindings without binding Cmd+W.
  * Keep the native menu outside the splitter layout and document the canonical
    macOS build workflow.
2026-09-21 21:39:39 -03:00
Martín Lucas Golini
071bc5d697 Add optional smooth scrolling across UI scrollable widgets
Introduce UIScrollController to provide frame-rate-independent wheel
interpolation, touch dragging, and momentum for code editors, terminals,
scroll views, and scrollable widgets while preserving the legacy instant
scrolling path.

Add a UISceneNode-level smooth-scrolling policy. Embedded scenes inherit
the root scene setting, new widgets snapshot it during construction, and
setSmoothScrollEnabled() can optionally apply changes to existing widgets
across the complete embedded-scene hierarchy.

Move native macOS scrolling and title-bar helpers into PlatformHelper,
enable native momentum from UIApplication, and explicitly enable it in
ecode. Preserve precise SDL2 and SDL3 wheel deltas for fractional momentum
events without changing normal integer wheel steps.

Replace the separate editor and terminal preferences in ecode and eterm
with one global smooth-scrolling setting, including legacy configuration
migration, live updates, and localized settings text.

Improve UITouchDraggableWidget momentum handling and add regression tests
for scrolling interpolation, pixel-aligned editor positions, scene
inheritance, widget overrides, and immediate policy application.
2026-09-13 20:27:37 -03:00
Martín Lucas Golini
95d52cdbb3 eepp:
- add reusable-buffer String::toUtf8() conversion
  - extract shared find-bar CSS into UIFindBarStyle
  - reuse the shared style from UIDocFindReplace

  ecode:
  - enable terminal find, next, and previous shortcuts
  - install terminal bindings after conflicting editor bindings are removed

  eterm:
  - add searchable terminal history with plain text, RegEx, and LuaPattern modes
  - support case-sensitive and whole-word matching across wrapped rows
  - debounce searches and avoid unnecessary string allocations
  - add an animated find bar with status and wrapped result navigation
  - expose find commands through configurable keybindings and the context menu
  - render and navigate search matches in terminal history
  - forward right-button releases when applications capture the mouse
  - fix UITabWidgetSplitter ownership during shutdown

  tests:
  - cover UTF-8 buffer reuse and terminal search behavior
  - verify wrapped lines, Unicode, pattern modes, invalid expressions, and navigation
  - verify SGR right-button release encoding

  tooling:
  - clarify the mandatory optimized build workflow for performance work
  - require direct release test execution before falling back to Xvfb
2026-09-10 00:57:56 -03:00
Martín Lucas Golini
0e9f2e832f Optimize eterm Kitty graphics frame replacement
- swap decoded frames into reusable image storage
  - recycle previous frame allocations for subsequent transfers
  - avoid full-frame copies during anonymous image replacement
  - extend tests to verify safe allocation reuse across frames
  - document eterm and eeiv in the project introduction
2026-09-04 18:45:10 -03:00
Martín Lucas Golini
87431fe706 Merge branch 'develop' into feature/eterm-worker 2026-08-31 11:06:17 -03:00
Martín Lucas Golini
36200430aa Fix conflict discard and merge view copy commands
- add Discard actions for conflicted files and conflict groups
  - restore discarded conflicts from HEAD in both index and working tree
  - restrict regular discard actions to changed tracked files
  - preserve default editor commands when replacing an editor document
  - enable copying from the read-only merge-view side panels
  - cover conflict restoration and merge-side copying
  - document build parallelism and function-spacing conventions
2026-08-31 11:03:19 -03:00
Martín Lucas Golini
c5c6350920 eterm: harden threaded presentation and terminal protocol handling
- preserve CSI subparameter separators for modern SGR color sequences
  - fix synchronized updates and periodic presentation under sustained output
  - support OSC palette queries, resets, and color scheme notifications
  - implement alternate scroll, cursor style, and terminal version queries
  - preserve the configured cursor shape for default blinking cursor requests
  - recognize Kitty keyboard negotiation without falsely advertising support
  - recognize OSC 8 hyperlink markers without emitting parser errors
  - make release parser diagnostics opt-in through ETERM_LOG_ERRORS
  - update the Kitty keyboard protocol implementation plan for worker ownership
  - add regression coverage for rendering, colors, CSI modes, cursors, and OSC 8
2026-08-31 03:01:40 -03:00
Martín Lucas Golini
0fa99ab9d2 Expand Git History actions and branch management
- Add SmartGit-inspired context actions to Git History commits, including checkout, merge, fast-forward merge, cherry-pick, revert, branch creation, tag creation, and copying commit IDs or complete messages.
  - Order commit actions into consistent operation, ref-creation, and clipboard groups. Hide the redundant Show in Git History action inside detached history tabs while retaining it in the source-control sidebar.
  - Add a Working Tree / Index context menu with status-aware Commit and Stage actions. Track staged and unstaged availability in the history model and keep it synchronized as repository status changes.
  - Extend the Git command wrapper with operations for creating branches at commits, creating and deleting tags, deleting remote branches, cherry-picking commits, and reverting commits.
  - Support deleting tags and remote branches from the Branches view. When deleting a local branch with an upstream, optionally delete its tracked remote branch as part of the operation.
  - Add confirmation and input dialogs for branch, tag, remote-deletion, and revert workflows. Disable history-changing commit actions while another Git operation is active.
2026-08-29 15:11:08 -03:00
Martín Lucas Golini
66d22ea5bb Add integrated Git conflict resolution workflow
Introduce a three-pane UIMergeView with an editable shared result
document, conflict navigation and acceptance actions, live diff
highlighting, synchronized scrolling, and contextual pane labels.

Read conflict stages directly from Git's index, detect paused merge
operations, restore conflict sessions, and support resolving, staging,
recreating, continuing, committing, and aborting operations.

Add repository-aware conflict state handling, safe asynchronous
lifetimes, merge operation UI, configurable key modifiers, i18n
strings, and focused merge-view and Git conflict tests.
2026-08-27 22:18:58 -03:00
Martín Lucas Golini
301b7458d2 graphics: improve native system font fallback
Initialize SystemFontResolver when enabled and make its lifecycle and font-list
population thread-safe.

Use native codepoint fallback matching through Fontconfig on Linux, BSD, and
Haiku, DirectWrite on Windows, and Core Text on macOS and iOS. Preserve the
cached FreeType scan as a fallback when native matching is unavailable.

Enable system fonts by default for UIApplication and warm the font database in
the background. Allow applications to override the policy and disable the
automatic default in the unit-test runner.

Fix glyph fallback checks to respect the resolver's enabled state and add
coverage for concurrent warm-up and shaped symbol fallback.

Update efsw.
2026-08-23 16:59:23 -03:00
Martín Lucas Golini
681841e11d Create unit-test windows hidden from the start while preserving hardware OpenGL rendering. Force double buffering for hidden X11 windows so framebuffer capture reads the rendered back buffer reliably, and keep SDL2/SDL3 behavior consistent. Update unit-test documentation to use direct desktop execution by default, with Xvfb retained for headless environments.
This change might break unit-tests in other platforms, next CI run will let us know.
2026-08-22 14:11:11 -03:00
Martín Lucas Golini
36e54fe2a3 Add reactive UI data binding and observable collections
Introduce observable and computed values, typed widget bindings, validation groups, UI properties, commands, and UI-thread delivery.

Add observable vector and list model support for incrementally updated collections, with filtering and source-row mapping.

Modernize the Flight Booker and CRUD examples and add focused data handling and collection examples demonstrating the new APIs.

Organize the UI binding headers under ui/databinding, expand test coverage for notification and lifetime semantics, and document API selection, validation, ownership, threading, and performance behavior.
2026-08-22 01:00:04 -03:00
Martín Lucas Golini
cc87ed6924 Add CSS paint ordering and stacking contexts to HTML widgets
Implement spec-oriented paint phases for normal flow, floats, and
positioned descendants, including atomic stacking groups and applicable
z-index handling for flex and grid items.

Share cached ordering between drawing and hit testing, propagate
invalidation across stacking scopes, and preserve ancestor transforms
and clipping for promoted descendants.

Add regression coverage for paint order, hit testing, reparenting,
clipping, flex ordering, and the old Reddit layout. Document the
supported stacking model and remove the completed implementation plan.
2026-08-14 01:43:34 -03:00
Martín Lucas Golini
bf750761ae ecode: add customizable debugger panel layouts
- add a reusable right-side panel managed at the application level
  - migrate debugger tabs to UITabWidgetSplitter instances
  - support moving and splitting debugger tabs across bottom and right panels
  - restrict debugger tab drops to debugger-owned panel targets
  - serialize debugger tab layouts, panel state, and table column widths
  - add pixel and percentage column-width modes to UIAbstractTableView
  - support XML/CSS configuration and an optional width-mode context menu
  - preserve percentage totals across resizing, fit-to-content, minimum widths,
    scrollbar changes, and pixel-density rounding
  - add splitter edge hiding while preserving splitter-always-show precedence
  - use EventConnection ownership for safe widget and controller lifetimes
  - validate serialized splitter layouts with structural limits
  - display project-relative source paths in debugger stack frames
  - add ecode localization strings, CSS documentation, tests, and agent rules
2026-08-14 00:17:29 -03:00
Martín Lucas Golini
b6cdc83818 ui: add typed value conversion errors
Replace boolean output-parameter converters with UIValueResult so conversion failures can provide numeric codes and optional diagnostics without exposing partially converted values.
Expose observable converter error state from UIDataBind, UIProperty, and UIValueBinding.
Reject invalid widget input without changing the model or propagating it to sibling widgets, while keeping programmatic model updates authoritative.
Migrate ecode's custom output parser converter, expand binding tests, and document the data-handling architecture and next form-validation
phase.
2026-08-09 00:52:00 -03:00
Martín Lucas Golini
120471343c Fixed both CI issues.
- MSVC:
      - Removed lambda-based eeNew expansion in favor of typed MemoryManager::trackNew().
      - Added macro expansion indirection.
      - Enabled MSVC’s conforming preprocessor with /Zc:preprocessor across Premake 4/5 static libraries, shared libraries, and executables.
      - Verified generated VS2022 projects contain the flag, including eterm-static and eepp-maps-static.
      - Added explicit standard-library includes to memorymanagerglobal.cpp.

  - Linux/macOS release tests:
      - MemoryManager.tracesPlainNew is now compiled only with EE_MEMORY_MANAGER, since global tracing is intentionally debug-only.

Added new plan to improve PropertyIdSet.
2026-08-05 11:53:36 -03:00
Martín Lucas Golini
445aac792d Fix CSS auto margins for replaced HTML elements
Model HTML images as replaced UIHTMLWidget elements with independent loading, sizing, and rendering behavior.

Resolve auto margins according to each element's formatting context, including normal-flow blocks, positioned elements, flex items, and grid items. Preserve intrinsic sizing for block-level images with width:auto and constrain them through CSS min/max dimensions.

Correct absolute-positioned containing-block coordinates and rich-text handling of atomic inline elements. Add regression coverage for centered images, deferred image loading, grid margins, positioned elements, and document flow after image loading.

Document the remaining work required for dynamically changing non-atomic inline elements.

Avoid saving eeiv configuration during destruction (fixes window state saving).
2026-08-04 13:32:22 -03:00
Martín Lucas Golini
bfe72a439b Optimize compile times by isolating chrono usage
- move chrono implementation details out of the public Clock header
  - define Sys system time as Unix epoch milliseconds
  - add getUnixTimestamp() for epoch timestamps in seconds
  - replace chrono wall-clock usage in ecode plugins with Sys APIs
  - update existing Sys time callers for the new millisecond contract
  - remove redundant chrono inclusion from HTTP tests
  - remove the completed user-defined snippets plan

This prevents chrono and std::format internals from being instantiated across large portions of the project while preserving timestamp precision.
2026-08-03 00:10:00 -03:00
Martín Lucas Golini
48b7e7c21f ui: improve HTML inline layout and old Reddit rendering
- implement per-side CSS border styles and patterned rendering
  - preserve rectangular rasterization for thin dotted borders
  - separate CSS and native-widget border defaults
  - correct inline atomic-box and vertical-align baseline layout
  - collapse adjacent block margins in rich-text flow
  - preserve forced line breaks and formatting margins
  - size HTML text inputs from font ascent and descent
  - expose replaced-control text baselines to inline layout
  - enforce single-owner painting for inline backgrounds and borders
  - enable and update the old Reddit visual regression golden
  - add generic layout, border, and form-control regression tests
  - document spec-first HTML work and project build conventions
2026-08-02 17:48:53 -03:00
Martín Lucas Golini
2df0861d76 Fix CSS auto margins for inline HTML images
Resolve auto margins according to the element's formatting context instead of applying native block centering to every HTML child.
Inline-level replaced elements, inline-blocks, floats, and out-of-flow boxes now use zero-valued auto margins in rich-text measurement and positioning, while normal-flow blocks retain horizontal auto-margin resolution. This prevents asynchronously loaded images from feeding stale calculated margins back into their inline ancestors and producing unbounded document widths, as observed on the Asahi Linux site.
Add synchronous and threaded WebView regression coverage using the Asahi fixture, including its weighted host layout and asynchronous SVG loading.
Document the follow-up plan for explicit formatting-role margin resolution, shared image-content composition, and rebasing UIHTMLImage on UIHTMLWidget.
2026-08-02 01:47:38 -03:00
Martín Lucas Golini
eb7398f9ec Fix HTML loading stalls on large modern pages
- batch asynchronous HTTP stylesheets and apply them in a single reload
  - skip unsupported block at-rules without leaking nested rules
  - prevent scripts nested in unknown custom elements from entering the render tree
  - add regression coverage for unsupported at-rules and nested scripts
  - document the Ninja release workflow for performance testing
2026-08-02 00:55:03 -03:00
Martín Lucas Golini
da4d201eeb Implemented both opt-out settings for vscode config load, although enabled by default:
```json
  // autocomplete.json
  {
    "config": {
      "load_vscode_snippets": false
    }
  }

  // debugger.json
  {
    "config": {
      "load_vscode_launch_config": false
    }
  }
```

Disabling them affects only .vscode imports. Personal/.ecode snippets and .ecode/launch.json continue loading normally.

Refs SpartanJ/ecod€#111
2026-08-01 01:38:14 -03:00
Martín Lucas Golini
1dc8195187 - add a searchable Insert Snippet Universal Locator provider
- support runtime locator provider registration and removal
- filter snippets with workspace-relative include/exclude globs
- add the remaining VS Code-compatible snippet variables
- support camelcase, pascalcase, snakecase, and kebabcase modifiers
- reuse the existing insertion flow for locator-selected snippets
- expand snippet parser and store test coverage
- update the implementation plan and C/C++ example snippets

Refs: SpartanJ/ecode#111
2026-07-29 18:49:01 -03:00
Martín Lucas Golini
683b35b249 feat(ecode): add VS Code-compatible user snippets
Add user-defined snippet support to the autocomplete plugin, including
language-specific, global, .vscode, and .ecode project snippets.

Support JSONC parsing, scopes, hot reload, source-aware ranking, exact
prefix replacement, multi-cursor insertion, contextual indentation,
variables, transforms, choices, linked placeholders, and tab navigation.

Recognize .code-snippets files as JSON and preserve existing LSP snippet
completion behavior.

Refs SpartanJ/ecode#111
2026-07-29 01:11:01 -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
9f4ae9e83c Font SubPixel antialiasing support for eterm and ui_html. 2026-07-25 21:24:45 -03:00
Martín Lucas Golini
27a57960f4 SubPixel hinting support. 2026-07-25 18:59:20 -03:00
Martín Lucas Golini
ed46508df4 Merge branch 'feature/resource-shared-ownership' into develop 2026-07-25 01:36:21 -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
2e2d3f808f Add plan for HTML paint order and stacking context support 2026-07-23 13:13:52 -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
fb433715fc release stale web resources and avoid diagnostic texture pinning
Advance the web resource cache generation only when the replacement
  document is installed, after the previous document and its asynchronous
  loads have been detached. This prevents outgoing document nodes from
  acquiring leases under the new generation.

  Add UIWebView coverage for delayed document replacement, stale resource
  release, and periodic cache pruning.

  Make Texture Viewer thumbnails observe textures through weak handles and
  retain them only for the duration of drawing. Keep explicit selection as
  the only operation that pins a texture, so opening the diagnostic viewer
  no longer prevents unused textures from being released.

  Update the shared-resource ownership plan to document the replacement-time
  navigation boundary.
2026-07-22 20:15:29 -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
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
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
ab4bb0ddfa Fix HTTP pool callback re-entry deadlock:
Destroy pooled HTTP clients after releasing the pool mutex so joined
  callbacks can safely re-enter the global pool.

  Add a regression test covering concurrent pool clearing and callback
  re-entry. Document the revised texture lifetime architecture and track
  the prerequisite bugs discovered during the resource ownership audit.
2026-07-12 20:50:39 -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