Commit Graph
73 Commits
Author SHA1 Message Date
Liu 844802374d feat(css): support cursor property with standard keyword values
Register the `cursor` property (36 standard keywords, no url() images),
add css_cursor_t, a 6-bit type_bits field and the 34 new keywords, and
implement css_cascade_cursor(). Defaults to `auto`.
2026-10-17 21:16:46 +08:00
Liu 604e9226e8 feat(css): add CSS property inheritance support 2026-10-17 21:16:44 +08:00
Liu 812391f1f5 feat(css): support CSS Color 4 rgb alpha syntax 2026-10-17 21:16:41 +08:00
Liu ae5b7d2ed9 feat(css): add text-decoration property 2026-10-17 21:16:41 +08:00
Liu eb793c5959 fix(css): destroy temporary parsed style values 2026-10-17 21:16:38 +08:00
Liu 3801fdc10f refactor(yutil): rename public APIs and migrate timer to ptk
- charset module renamed to encoding (decode/encode kept)
- time: get_time_ms → y_gettime, sleep_ms → y_sleep
- time: delete get_time_us, get_time_delta, sleep_s
- string: strdup2 → y_strdup, wcsdup2 → y_wcsdup
- string: strtolower → y_strlower, strtrim → y_strtrim
- string: wcstrim → y_wcstrim, strhash → y_strhash
- string: strreplace → y_strreplace, strsplit → y_strsplit
- string: delete wcsreplace, cmdsplit
- math: delete y_iround, y_pow2
- timer module migrated from yutil to ptk as internal timer_scheduler
- WinMain simplified to use __argc/__argv instead of cmdsplit

BREAKING CHANGE: all renamed yutil public APIs require downstream
  to update function names. Deleted APIs require code changes:
  - get_time_us: use y_gettime() for ms timestamps
  - get_time_delta: use y_gettime() - start instead
  - sleep_s: use y_sleep(ms) with millisecond argument
  - wcsreplace: no replacement, had zero callers
  - cmdsplit: WinMain now uses __argc/__argv from CRT
  - timer_list_*: migrated to ptk timer_scheduler_*;
    ptk_reset_timer still available for external use
2026-08-05 22:42:26 +08:00
Liu 6cd01b468e chore: update copyright comment 2026-08-05 22:42:22 +08:00
Liu 7f9f52b904 chore: update copyright and email 2026-08-05 22:42:16 +08:00
Liu f54cd12539 feat(css): add gap, row-gap and column-gap support
Add the CSS gap shorthand and its row-gap/column-gap longhands for flex
containers.

- Register row-gap/column-gap as longhand properties and gap as a
  shorthand accepting [ normal | <length-percentage> ]{1,2}.
- Add css_gap_t (CSS_GAP_INHERIT/SET/NORMAL) and corresponding
  type/unit/value fields on css_computed_style_t.
- Implement cascade logic in lib/css/src/properties/gap.c, resolving
  normal to zero and rejecting auto.
- Apply gaps in ui_flexbox_layout: main-axis gap participates in line
  size, wrap detection, justify-content space and per-item positioning;
  cross-axis gap participates in cross-size accumulation and line
  positioning. The last item/line never gets a trailing gap. Percentage
  gaps resolve against the container content-box on the corresponding
  axis.
- Cover gap parsing/cascading in lib/css/tests (single/two values,
  axis-only, normal, percentage) and add a flex layout integration test
  exercising column-gap, row-gap, wrapped two-value gap and normal.
2026-08-05 22:41:30 +08:00
Liu 3d2a8dc35a fix(css): reset parse target on '}' to avoid stale property name
When parsing a value-less declaration that ended with '}' (e.g. inside
`.gap-2 { gap: 8px }` where `gap` is not yet a supported property),
the parser stayed in CSS_PARSER_TARGET_VALUE state. The next rule was
then fed into the value parser with style_parser.property already
cleared, producing misleading "unsupported property" errors and
corrupting subsequent parsing.

Switch target to CSS_PARSER_TARGET_NONE on '}' and to
CSS_PARSER_TARGET_KEY on ';' inside the switch, mirroring the
end-of-block / end-of-declaration semantics. Add an assert to catch any
future regression where css_parser_commit is reached without a
property name.
2026-08-05 22:41:30 +08:00
Liu 3a867040d1 build(xmake): fix package name, target naming and example install
- Remove per-lib set_project() calls that overrode the global lcui
  project name; xmake show now correctly reports the project as lcui.
- Move per-lib set_version() into the corresponding target() block so
  each sub-library keeps an independent version usable for standalone
  packaging.
- Add set_default(false) and set_group(examples) to all pandagl
  examples so they are no longer picked up by xmake package.
- Rename targets to use dashes for consistency:
    pandagl_cairo_example  -> pandagl-cairo-example
    preview_block_layout   -> preview-block-layout
    preview_flex_layout    -> preview-flex-layout
    preview_scrollbar      -> preview-scrollbar
    preview_widget_opacity -> preview-widget-opacity
- Bump yutil submodule to drop its set_project() call as well.
2026-08-05 22:41:23 +08:00
Liu 75dbca815d test: reorganize test suite with xmake test integration
Restructure the test infrastructure with these changes:

* Extend libctest with ctest_suite_t, ctest_parse_args, ctest_run_suites and CTEST_MAIN macro to standardize test entry points; support --grep / --grep= / --list / --interactive flags; add ctest-tests for self-tests.

* Regroup tests by lib boundary: sink unit tests into lib/<name>/tests/ with <lib>_<topic> entry function names, move fixtures into lib/<name>/tests/fixtures/, rename top-level tests/cases/ to tests/integration/ for cross-lib integration tests.

* Add tests/scenes/ for reusable widget tree builders shared by integration cases and visual preview binaries; add tests/previews/ with 4 diagnostic binaries (flex_layout, block_layout, widget_opacity, scrollbar).

* Rewrite all describe/equal description strings using 'should ...' style or noun topic names; drop redundant lcui_quit/lcui_main calls from integration cases.

* Integrate xmake test via add_tests(\default\) and a shared tests.runnable rule defined in the root xmake.lua; the rule wraps the test binary with drmemory (Windows) or valgrind (Linux) when option memcheck=y.

* Drop the lcui-tests aggregation: lcui-tests now contains only integration cases and scenes, not the union of lib tests. Use xmake test to run everything across libs.

* Fix .clang-format: InsertNewlineAtEndOfFile -> InsertNewlineAtEOF (correct key for clang-format 16+).

* Update AGENTS.md with the new test layout, naming rules, description style and run commands.

* Update CI to use xmake test and xmake f --memcheck=y instead of per-lib runs.
2026-08-05 22:41:12 +08:00
OrbisAI Security 259c6ad696 fix(css): stack buffer overflow in selector fullname construction
Multiple unbounded strcpy() calls in lib/css/src/selector
2026-08-05 22:41:08 +08:00
Liu f07b06d154 refactor(css): const css_propdef_t * 2026-03-31 21:20:28 +08:00
rewine 8f205eca97 fix: format-overflow error in gcc 14
log:
format-overflow 从 gcc 14 开始被视为`错误`而非`警告`
> error: lib/css/src/library.c:448:41: 错误:‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
>  448 |                 sprintf(fullname, "%s %s", link->group->name, selector);
>      |

参考:
https://stackoverflow.com/questions/73769693/how-to-fix-warning-sprintf-swriting-a-termination-nul-past-the-end-ot-the-dest
2025-03-04 10:27:13 +08:00
Liu 940a0fc33a chore: update copyright 2025-01-05 23:29:56 +08:00
Liu 24f3192b9a refactor: update LCUI's dependencies on ui-widgets and ui-router 2024-12-29 23:37:24 +08:00
Liu cfa605110e style: add BOM header 2024-12-23 00:02:48 +08:00
Liu 5a866286c5 style: clear uninitialized warnings 2024-12-22 23:17:11 +08:00
Liu 6851e9aef3 refactor: change type naming style 2024-12-22 23:14:13 +08:00
Liu d1493e315d feat: new layout process 2024-12-22 23:14:13 +08:00
Liu fcff153784 fix(ui): correct width calculation 2024-12-07 13:30:30 +08:00
Liu 1f35451526 feat(ui): add css background-clip property 2024-12-07 13:30:30 +08:00
Liu 85c34e6c31 feat(css): support selector containing escape characters 2024-12-07 13:30:30 +08:00
Liu c15d7a605e fix(css): destroy strpool after destroying the style rules 2024-12-07 13:30:29 +08:00
Liu 5efe7f3ae9 fix(ui): the class change of ancestor widgets did not trigger style refresh 2024-12-07 13:30:29 +08:00
Liu e37dffa510 fix(css): the space property in the style declaration is not set correctly 2024-12-07 13:30:28 +08:00
Liu 375e03bd36 feat: replace custom bool type with bool type in stdbool.h 2024-12-07 13:30:28 +08:00
Liu 68a0f0d828 feat: DPI awareness 2024-09-19 00:06:05 +08:00
Liu 6e5dac2a00 fix(css): incorrect percentage width computed value 2024-09-19 00:06:05 +08:00
Liu e4b0eb4d8d feat: DPI awareness 2024-09-19 00:06:04 +08:00
Liu bc3a910512 refactor(css): libcss_bool_t -> bool 2024-09-19 00:06:00 +08:00
Liu 4b72d14763 fix(css): incorrect percentage width computed value 2024-07-28 22:02:52 +08:00
Liu a6dea4de1a fix(css): CONVER -> COVER 2024-05-13 22:49:22 +08:00
Liu d60ec9227d chore: update copyright year 2024-05-13 22:49:22 +08:00
Liu 185b726108 fix(css): the left property is not cascaded 2024-05-13 22:49:21 +08:00
Liu d683955090 build: do not default to building test programs 2024-05-13 22:49:20 +08:00
Liu 023b35e245 chore: add copyright header 2024-05-13 22:49:20 +08:00
Liu 5c8186faad refactor: clear compiler warnings 2024-05-13 22:49:19 +08:00
Liu 59e3220370 style: euqal -> equal 2024-05-13 22:49:18 +08:00
Liu 549f8077a6 fix(ui): correct widget box comparison and dirty rectangle collection 2024-05-13 22:49:17 +08:00
Liu 322f57fb7f fix(ui): correct flex item width compute 2024-05-13 22:49:16 +08:00
Liu 43f1fdc972 fix(css): remove quotes from the value of font-family 2023-10-15 20:26:10 +08:00
Liu 7f409cb120 feat(css): add border-top/right/bottom/left shorthand properties 2023-08-27 17:55:05 +08:00
Liu 4294314ac0 fix(css): correct cascading of background-size 2023-08-20 16:24:16 +08:00
Liu 34071c8334 fix(css): correct single value parsing of background-position 2023-08-20 12:38:24 +08:00
Liu 3c9c3dd8f7 refactor(css): css_key_* -> css_prop_* 2023-06-09 23:49:15 +08:00
Liu 329b7c192d refactor: simplify naming and function parameters 2023-06-07 23:39:01 +08:00
Liu bb17087d0b feat(ui): rename textview to text 2023-05-14 22:13:47 +08:00
Liu c5d66f6357 fix(ui): background image not loaded 2023-05-14 21:36:22 +08:00