Skip to content

Commit 4a443c3

Browse files
committed
lhp: add DLO layout support
Add a dlo-based layout callback for use with lhp. If lhp_dl_render() is used as the Lws Html/CSS parser callback, it produces a display_list representation of the Html as DLOs, referencing the appropriate CSS to drive the layout as best it can. The display list can be rasterized on to an lws_display using the display's state object lds->disp->blit(lds, (uint8_t *)&dl, &box);
1 parent 3063fe8 commit 4a443c3

File tree

16 files changed

+28236
-49
lines changed

16 files changed

+28236
-49
lines changed

CMakeLists-implied-options.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ if (LWS_WITH_SECURE_STREAMS_PROXY_API)
132132
set(LWS_WITH_LWS_DSH 1)
133133
set(LWS_WITH_UNIX_SOCK 1)
134134
set(LWS_WITH_SYS_SMD 1)
135+
set(LWS_WITH_SECURE_STREAMS 1)
135136
endif()
136137

137138
if (NOT LWS_WITH_NETWORK)
@@ -158,6 +159,7 @@ if (NOT LWS_WITH_NETWORK)
158159
set(LWS_WITH_LWS_DSH 0)
159160
set(LWS_WITH_THREADPOOL 0)
160161
set(LWS_WITH_SYS_SMD 0)
162+
set(LWS_WITH_LHP 0)
161163
endif()
162164

163165
if (LWS_WITH_CGI)
@@ -363,8 +365,10 @@ endif()
363365

364366
set(LWS_WITH_CLIENT 1)
365367
if (LWS_WITHOUT_CLIENT)
366-
set(LWS_WITH_CLIENT)
368+
set(LWS_WITH_CLIENT 0)
367369
set(LWS_WITH_SECURE_STREAMS 0)
370+
set(LWS_WITH_SECURE_STREAMS_PROXY_API 0)
371+
set(LWS_WITH_LHP 0)
368372
endif()
369373
set(LWS_WITH_SERVER 1)
370374
if (LWS_WITHOUT_SERVER)
@@ -381,6 +385,11 @@ if (LWS_WITH_OTA)
381385
set(LWS_WITH_GZINFATE 1)
382386
endif()
383387

388+
if (LWS_WITH_LHP)
389+
set(LWS_WITH_CLIENT 1)
390+
set(LWS_WITH_SECURE_STREAMS 1)
391+
endif()
392+
384393
# using any abstract protocol enables LWS_WITH_ABSTRACT
385394

386395
#if (LWS_WITH_SMTP)

contrib/assets/LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Asset Provanance and licenses
2+
3+
### bluecat.jpg.h
4+
5+
Licence: CC0
6+
Source: https://commons.wikimedia.org/wiki/File:Startled_blue-eyed_cat_(Unsplash).jpg
7+
Archive: https://archive.is/Bi4tR
8+
9+
### cat1.png.h
10+
11+
License: CC0
12+
Source: https://commons.wikimedia.org/wiki/File:Cat_looking_outside_the_window.jpg
13+
Archive: https://archive.is/Rocwf
14+
15+
### exclaim80.png.h & no-right.png.h
16+
17+
License: CC0
18+
Source: [email protected] inkscape
19+

contrib/assets/bluecat.jpg.h

+1,952
Large diffs are not rendered by default.

contrib/assets/cat1.png.h

+23,399
Large diffs are not rendered by default.

contrib/assets/exclaim80.png.h

+880
Large diffs are not rendered by default.

contrib/assets/no-right.png.h

+257
Large diffs are not rendered by default.

include/libwebsockets/lws-context-vhost.h

+3
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,9 @@ struct lws_context_creation_info {
808808
* proxy. NULL means to use the default wsi-based client support */
809809
#endif
810810

811+
#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)
812+
#endif
813+
811814
int rlimit_nofile;
812815
/**< 0 = inherit the initial ulimit for files / sockets from the startup
813816
* environment. Nonzero = try to set the limit for this process.

lib/core-net/vhost.c

+2
Original file line numberDiff line numberDiff line change
@@ -1014,11 +1014,13 @@ lws_create_vhost(struct lws_context *context,
10141014
lwsl_vhost_err(vh, "lws_context_init_server_ssl failed");
10151015
goto bail1;
10161016
}
1017+
#if defined(LWS_WITH_CLIENT)
10171018
if (lws_fi(&vh->fic, "vh_create_ssl_cli") ||
10181019
lws_context_init_client_ssl(info, vh)) {
10191020
lwsl_vhost_err(vh, "lws_context_init_client_ssl failed");
10201021
goto bail1;
10211022
}
1023+
#endif
10221024
#if defined(LWS_WITH_SERVER)
10231025
lws_context_lock(context, __func__);
10241026
if (lws_fi(&vh->fic, "vh_create_srv_init"))

lib/core/alloc.c

+8
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ _realloc(void *ptr, size_t size, const char *reason)
178178
allocated -= malloc_usable_size(ptr);
179179
#endif
180180
free(ptr);
181+
#if defined(LWS_PLAT_FREERTOS)
182+
lwsl_debug("%s: free heap %d\n", __func__,
183+
#if defined(LWS_AMAZON_RTOS)
184+
(unsigned int)xPortGetFreeHeapSize() - (int)size);
185+
#else
186+
(unsigned int)esp_get_free_heap_size() - (int)size);
187+
#endif
188+
#endif
181189
}
182190

183191
return NULL;

lib/misc/CMakeLists.txt

+18-12
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,26 @@ if (LWS_WITH_DLO)
8282
misc/dlo/dlo-font-mcufont.c
8383
misc/dlo/dlo-text.c)
8484

85-
if (LWS_WITH_UPNG)
86-
list(APPEND SOURCES
87-
misc/dlo/dlo-png.c)
88-
endif()
85+
if (LWS_WITH_SECURE_STREAMS AND LWS_WITH_CLIENT)
86+
list(APPEND SOURCES
87+
misc/dlo/dlo-ss.c)
88+
endif()
8989

90-
if (LWS_WITH_JPEG)
91-
list(APPEND SOURCES
92-
misc/dlo/dlo-jpeg.c)
93-
endif()
90+
if (LWS_WITH_UPNG AND LWS_WITH_SECURE_STREAMS AND LWS_WITH_CLIENT)
91+
list(APPEND SOURCES
92+
misc/dlo/dlo-png.c)
93+
endif()
9494

95-
if (LWS_WITH_SECURE_STREAMS)
96-
list(APPEND SOURCES
97-
misc/dlo/dlo-ss.c)
98-
endif()
95+
if (LWS_WITH_JPEG AND LWS_WITH_SECURE_STREAMS AND LWS_WITH_CLIENT)
96+
list(APPEND SOURCES
97+
misc/dlo/dlo-jpeg.c)
98+
endif()
99+
100+
if (LWS_WITH_LHP AND LWS_WITH_DLO AND LWS_WITH_SECURE_STREAMS AND LWS_WITH_CLIENT)
101+
list(APPEND SOURCES
102+
misc/dlo/dlo-lhp.c
103+
)
104+
endif()
99105

100106
endif() #dlo
101107

0 commit comments

Comments
 (0)