Commit Graph

4523 Commits

Author SHA1 Message Date
Martín Lucas Golini
f5ce1589e3 Some snippets improvements to support insertTextFormat (SpartanJ/ecode/discussions#929).
Closes SpartanJ/ecode#933
2026-07-18 13:31:06 -03:00
Martín Lucas Golini
0a7984b17d Register cmake.in.
Detect as function call something like `name ()` in Vala.
2026-07-17 12:30:18 -03:00
Martín Lucas Golini
41f58374bd Pre register new extensions. 2026-07-17 12:18:41 -03:00
Martín Lucas Golini
c1830e3ccf Corrected Genie. 2026-07-17 10:44:46 -03:00
Martín Lucas Golini
8745871c8c Closes SpartanJ/ecode#924 SpartanJ/ecode#925 SpartanJ/ecode#926 2026-07-16 13:44:04 -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
513ef0f12b Move backward implementation to its own module but still have an special version for ecode. Integrate backward into unit-tests. 2026-07-13 11:00:35 -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
e9ac61c31b Skip UTF-8 BOM magic when loading HTML in gumbo. 2026-07-11 01:12:23 -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
ebae37b462 Respect user-set SDL hints if set, otherwise use own eepp defaults (this is for SpartanJ/ecode#921). 2026-07-10 20:52:05 -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
Martín Lucas Golini
d29dbb1cc1 Optimize stylesheet matching with class-based indexing:
Index class-anchored selectors by one mandatory class hash so widgets
  only evaluate rules associated with their own classes instead of
  scanning every class-only rule in the global bucket.

  Preserve selector correctness by validating the complete rule after
  candidate lookup, and retain stylesheet source order across independent
  index buckets for equal-specificity cascade resolution.

  Update index clearing, copying, marker removal, and style insertion
  paths. Add focused candidate coverage and a legacy full-scan benchmark,
  showing a 63% lookup-time reduction on a class-heavy stylesheet.
2026-07-10 19:31:15 -03:00
Martín Lucas Golini
3e29da6a2e Optimize CSS selector matching with cached hashes
Cache tag, ID, and class hashes in selector rules and widgets to avoid
  repeated string comparisons during selector matching.

  Store widget class hashes in a single-element SmallVector so the common
  zero and one-class cases remain allocation-free. Reorder UINode and
  UIWidget members to recover padding, keeping UIWidget at its original
  1144-byte size.

  Add selector matching benchmarks and regression coverage for class
  mutation, compound selectors, and hash cache synchronization. Document
  the measured Phase 5 performance and memory results.
2026-07-10 17:13:13 -03:00
Martín Lucas Golini
bb9a733008 Fix StyleSheetStyle::clearCachedProperties. 2026-07-10 02:30:11 -03:00
Martín Lucas Golini
4150eb2df6 - Universal selectors now return early only when no non-pseudo class, ID, or attribute requirements exist.
- Added computed-style and direct matcher tests for *.foo, *[href], and plain *.
2026-07-10 01:44:16 -03:00
Martín Lucas Golini
6b4179b896 Optimize CSS selector traversal and fix sibling combinators:
- inline hot-path node and stylesheet traversal accessors
  - correct adjacent and general sibling matching direction
  - preserve inverse sibling operator behavior
  - add selector traversal and sibling regression tests
2026-07-10 01:26:06 -03:00
Martín Lucas Golini
2bc18f0ded Enable SDL_HINT_FORCE_RAISEWINDOW by default. 2026-07-10 01:01:21 -03:00
Martín Lucas Golini
ea42c21121 Fix Android CI. 2026-07-09 21:06:57 -03:00
Martín Lucas Golini
ce2a73dd3e Fix in HTML context some specific CSS queries.
Fix several indirect leaks.
Added epp CSS Selector Optimization Plan.
2026-07-09 19:51:57 -03:00
Martín Lucas Golini
b0685060f3 Fix GL context memory leak.
Fix flaky test on macOS.
2026-07-09 12:33:44 -03:00
Martín Lucas Golini
5787e895ba Fix HTML font-weight resolution for @font-face variants
Apply @font-face weights to loaded variable fonts, preserve author
font-family names for internal font-face aliases, and re-resolve text fonts
when style or weight changes after initial font selection.

Also updates the font-weight native variant plan to reflect the current
architecture and remaining work around static native weight variants.
2026-07-09 02:03:19 -03:00
Martín Lucas Golini
95d0a8881a Fix CSS var resolution during style application
Resolve CSS variable values at the points where properties are applied,
inherited, propagated, and used to seed transitions. This prevents raw
var() values from leaking into widget state or transition start/end
values when style attributes, inherited properties, or state-dependent
rules are involved.

Also refresh style definitions when widgets load so selector-dependent
rules are evaluated with the final widget context, and add regression
coverage for inline style vars, inherited vars, parent-state child rules,
tab close opacity, and foreground tint transitions.
2026-07-08 20:48:27 -03:00
Martín Lucas Golini
9e0335e048 Fix assuming in CRLF files CRLF lines in all cases. 2026-07-08 00:53:40 -03:00
Martín Lucas Golini
d4ddfd9e7e Try to recover stack trace from unit-tests in macOS CI. 2026-07-08 00:48:04 -03:00
Martín Lucas Golini
7c931bf72e Fix again in UIScrollView scroll visibility.
Fix `whitespace: pre`.
2026-07-08 00:14:08 -03:00
Martín Lucas Golini
fbfc599dbb - Fix timed TCP connects for high POSIX file descriptors
Use poll() for POSIX TcpSocket timed connects instead of select().
select() cannot safely handle descriptor values >= FD_SETSIZE, so a
process with many open sockets/resources could fail new HTTPS requests
even when only one socket was being waited on. This showed up in the
HTML compat module when loading request-heavy pages such as old Reddit.

Keep the Windows path on select(), since Winsock does not use nfds as a
POSIX descriptor limit and this code only waits on one socket.

Also initialize HttpConnection::mIsKeepAlive in the TcpSocket-taking
constructor, matching the default constructor and avoiding undefined
connection lifetime state.

Add a regression test that reserves file descriptors past FD_SETSIZE and
verifies a timed localhost TcpSocket connect still succeeds.

- Treat drawable ref "none" as clearing the layer drawable instead of
trying to load it as a drawable/image reference.

- Round the scroll view inner width up before deciding horizontal
scrollbar visibility, avoiding fractional pixel overflow from creating
a bogus horizontal scrollbar.
2026-07-07 00:46:59 -03:00
Martín Lucas Golini
b7facf4b37 Fix isInlineBlock in UITextSpan: floated inline-block spans were no longer considered isInlineBlock() because UITextSpan::isInlineBlock() required float:none. 2026-07-06 12:42:38 -03:00
Martín Lucas Golini
bf0c6e8b11 Fix in Flex layout interacting with float elements. 2026-07-06 12:27:53 -03:00
Martín Lucas Golini
3f304e9c80 Float minor fix. 2026-07-06 11:48:35 -03:00
Martín Lucas Golini
c9add7047b Fix floated auto-width sizing and line-height text placement
Preserve shrink-to-fit widths for floated HTML boxes whose CSS width is
auto, instead of letting their own block layout expand them back to the
containing block width. This matches the CSS float model and fixes floated
list-item menus where hover boxes were much wider than their content.

Also separate RichText visual font metrics from CSS line-box metrics. Text
runs now keep native font height for drawing while line layout still uses
CSS line-height, allowing the expected half-leading offset for vertically
centered text in block anchors.
2026-07-06 01:42:38 -03:00
Martín Lucas Golini
e984c87105 Implement CSS box-sizing for HTML layout sizing
Add CSS box-sizing support for HTML widgets and route CSS-specified
width/height conversion through virtual sizing hooks. Resolve percentage
CSS sizes against the containing block content box, and apply content-box
or border-box conversion consistently across block, flex, grid, table,
and rich text layout paths.

Keep table wrapper width behavior compatible with CSS table layout by
overriding the table width conversion separately, so padded percentage
tables do not overflow their assigned wrapper width.

Add focused regressions for block padding, flex-basis sizing, grid
containers, table containers, and the border rendering cases that depend
on explicit border-box sizing.
2026-07-06 00:32:17 -03:00
Martín Lucas Golini
2c59d9b4e2 Merge branch 'feature/uiwebview' into develop 2026-07-05 20:47:25 -03:00
Martín Lucas Golini
87c56142ee Forgot to make these recursive in UISceneNode, needed by the UIWidgetInspector:
/** Enables or disables focus highlighting in this scene and embedded UI scenes. */
	void setHighlightFocusRecursive( bool highlight );

	/** Enables or disables box debug drawing in this scene and embedded UI scenes. */
	void setDrawBoxesRecursive( bool draw );

	/** Enables or disables debug-data drawing in this scene and embedded UI scenes. */
	void setDrawDebugDataRecursive( bool debug );
2026-07-05 20:00:50 -03:00
Martín Lucas Golini
ab14972fd3 TextureFactory small refactor.
Fix in getTextureCacheName.
2026-07-05 19:21:23 -03:00
Martín Lucas Golini
4f3e5309a4 Fix broken resource cache for images and layout drawables. 2026-07-05 00:55:37 -03:00
Martín Lucas Golini
ffbfe0a646 Fix stack-overflow in HTML widget elements with unresolvable percentage height.
Fix textarea sizing bug with percentage height.
2026-07-05 00:31:36 -03:00
Martín Lucas Golini
d56135c2d1 Fix CSS specificity rules.
Added control over the UISceneNode children and added setHighlightOverRecursive. This allows us to inspect nested UISceneNodes.
Fix hit-box bug when changing display.
2026-07-05 00:14:02 -03:00
Martín Lucas Golini
b192bcde1e Fix stale width being reused during the deferred CSS relayout. This happened when a display was being switched and during the layout change we didn't reset to the initial state. 2026-07-04 20:41:40 -03:00
Martín Lucas Golini
627d22163b Fixed an layout invalidation bug where we were discarding real invalidations.
Allow to defer `<img defer src>` (useful for local tests).
2026-07-04 16:14:47 -03:00
Martín Lucas Golini
3938536bff Merge branch 'develop' into feature/uiwebview 2026-07-04 01:25:49 -03:00
Martín Lucas Golini
8b32f26b9f Some extra optimizations to CSS selector. 2026-07-04 01:25:42 -03:00
Martín Lucas Golini
9975e2a17d Merge branch 'develop' into feature/uiwebview 2026-07-04 00:13:15 -03:00
Martín Lucas Golini
592186ae73 Singleton implementation optimization. 2026-07-04 00:13:06 -03:00