Quellcode durchsuchen

Add browser background repeat, position and size

Johannes Zellner vor 1 Woche
Ursprung
Commit
6874d1fcaf

+ 12 - 9
AGENTS.md

@@ -811,7 +811,9 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   the browser both use it.  `browser_html.c/h` is a tolerant HTML tree + the
   CSS subset: external `<link rel=stylesheet>` sheets (in document order,
   inline `<style>` last), tag/class/id and descendant/child selectors,
-  colours/`rgba()`, solid backgrounds and a stretched `background-image`,
+  colours/`rgba()`, solid backgrounds and `background-image` with
+  `repeat`/`position`/`size` (`auto` keeps the legacy stretch, `cover` and
+  `contain` scale the image), plus the `background` shorthand URL,
   font size (`px`/`%`/`em`/`rem`, resolved against the parent for `em`/`%`),
   the `font` shorthand, numeric weights, `!important`, line-height,
   alignment, margins, padding, per-side borders, `list-style: none`,
@@ -827,7 +829,7 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   `@font-face` loads one regular TTF per family from a local path or HTTP URL
   (the browser fetches remote faces before layout).  The compatibility
   ladder is `testdata/browser/compat/`
-  (`make compat-serve`); pages 010–037 and 030a pass (036a needs the
+  (`make compat-serve`); pages 010–038 and 030a pass (036a needs the
   POST echo server).  Inline
   `<svg>` subtrees and closed `<details>` are skipped (not renderable), and
   `<video>` gets a placeholder box.  The default page canvas follows
@@ -1543,13 +1545,14 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
     assigned to `innerHTML`, and `style`/`dataset` cover inline state rather
     than computed style.  Libraries that need those APIs (jQuery plugins
     beyond Bootstrap's tooltip, Angular apps that use `$http`) still log
-    errors even though the static page renders.  CSS also lacks
-    `background-repeat`/`position`/`size` (a background image is stretched
-    to its box), the rest of `transform` (`translate` only), sticky beyond
-    the top edge, border-radius clipping of descendant content, gradients/
-    box-shadow/transitions (a gradient background falls back to its last
-    solid colour), or CSS `color-mix`.  CSS custom properties (`var()`),
-    flex rows with wrap/grow/gap/justify/align, two-track and
+    errors even though the static page renders.  CSS also lacks multiple
+    background layers, `background-attachment`, the rest of `transform`
+    (`translate` only), sticky beyond the top edge, border-radius clipping
+    of descendant content, gradients/box-shadow/transitions (a gradient
+    background falls back to its last solid colour), or CSS `color-mix`.
+    A non-uniform `background-size` uses the width scale for both axes.
+    CSS custom properties (`var()`), flex rows with wrap/grow/gap/justify/
+    align, two-track and
     `repeat(auto-fit, minmax(...))` grids, inline-block runs, basic
     proportional table columns, table rowspan/colspan/percentage columns and
     inline SVG (`rect`, `line`, `path` with M/L/H/V, and `text`) are

+ 110 - 9
browser.c

@@ -3038,6 +3038,10 @@ static void draw_bg_image(struct lay *l, struct ngui_rect box,
 {
 	struct br_image *bi;
 	struct img_blit b;
+	int tw, th, x, y, rep_x, rep_y, posx, posy;
+	unsigned int scale = 65536;
+	int legacy, tiles = 0, rows = 0;
+	int cx1, cy1, cx2, cy2;
 
 	if (!st->bg_image || box.w <= 0 || box.h <= 0)
 		return;
@@ -3045,22 +3049,119 @@ static void draw_bg_image(struct lay *l, struct ngui_rect box,
 	    doc.nodes[node].bg_img_index >= image_count)
 		return;
 	bi = &images[doc.nodes[node].bg_img_index];
-	if (bi->state != 1 || bi->img.w <= 0)
+	if (bi->state != 1 || bi->img.w <= 0 || bi->img.h <= 0)
 		return;
+
+	legacy = st->bg_size_kind == 0 && st->bg_repeat == 0 &&
+		 st->bg_pos_x_kind == 0 && st->bg_pos_x == 0 &&
+		 st->bg_pos_y_kind == 0 && st->bg_pos_y == 0;
+	if (legacy) {
+		scale = ((unsigned int)box.w << 16) / bi->img.w;
+		tw = box.w;
+		th = (int)(((unsigned int)bi->img.h * scale) >> 16);
+		x = box.x;
+		y = box.y;
+		rep_x = rep_y = 0;
+	} else {
+		if (st->bg_size_kind == 3 || st->bg_size_kind == 4) {
+			unsigned int sx = ((unsigned int)box.w << 16) /
+					  bi->img.w;
+			unsigned int sy = ((unsigned int)box.h << 16) /
+					  bi->img.h;
+
+			scale = st->bg_size_kind == 3 ?
+				(sx > sy ? sx : sy) : (sx < sy ? sx : sy);
+		} else if (st->bg_size_kind == 1 ||
+			   st->bg_size_kind == 2) {
+			int w = st->bg_size_w;
+			int h = st->bg_size_h;
+
+			if (st->bg_size_kind == 2) {
+				if (w)
+					w = box.w * w / 100;
+				if (h)
+					h = box.h * h / 100;
+			}
+			if (w)
+				scale = ((unsigned int)w << 16) / bi->img.w;
+			else if (h)
+				scale = ((unsigned int)h << 16) / bi->img.h;
+		}
+		tw = (int)(((unsigned int)bi->img.w * scale) >> 16);
+		th = (int)(((unsigned int)bi->img.h * scale) >> 16);
+		if (tw < 1)
+			tw = 1;
+		if (th < 1)
+			th = 1;
+		posx = st->bg_pos_x_kind == 1 ?
+			(box.w - tw) * st->bg_pos_x / 100 : st->bg_pos_x;
+		posy = st->bg_pos_y_kind == 1 ?
+			(box.h - th) * st->bg_pos_y / 100 : st->bg_pos_y;
+		x = box.x + posx;
+		y = box.y + posy;
+		rep_x = st->bg_repeat == 0 || st->bg_repeat == 2;
+		rep_y = st->bg_repeat == 0 || st->bg_repeat == 3;
+		if (rep_x) {
+			int m = (x - box.x) % tw;
+
+			if (m > 0)
+				m -= tw;
+			x = box.x + m;
+		}
+		if (rep_y) {
+			int m = (y - box.y) % th;
+
+			if (m > 0)
+				m -= th;
+			y = box.y + m;
+		}
+	}
+
+	cx1 = box.x > page_rect.x ? box.x : page_rect.x;
+	cy1 = box.y > page_rect.y ? box.y : page_rect.y;
+	cx2 = box.x + box.w;
+	cy2 = box.y + box.h;
+	if (cx2 > page_rect.x + page_rect.w - 12)
+		cx2 = page_rect.x + page_rect.w - 12;
+	if (cy2 > page_rect.y + page_rect.h)
+		cy2 = page_rect.y + page_rect.h;
+	if (cx1 >= cx2 || cy1 >= cy2)
+		return;
+
 	b.dst = l->ui->px;
 	b.dst_w = l->ui->w;
 	b.dst_h = l->ui->h;
-	b.clip_x = page_rect.x;
-	b.clip_y = page_rect.y;
-	b.clip_w = page_rect.w - 12;
-	b.clip_h = page_rect.h;
-	b.x = box.x;
-	b.y = box.y;
-	b.scale = ((unsigned int)box.w << 16) / bi->img.w;
+	b.clip_x = cx1;
+	b.clip_y = cy1;
+	b.clip_w = cx2 - cx1;
+	b.clip_h = cy2 - cy1;
+	b.scale = scale;
 	b.bg = ui.theme.bg;
 	b.bg2 = ui.theme.bg;
 	b.flags = IMG_BLIT_OVER_DST;
-	img_draw(&bi->img, &b);
+
+	{
+		int row_x = x;
+
+		for (;;) {
+			for (;;) {
+				b.x = x;
+				b.y = y;
+				img_draw(&bi->img, &b);
+				if (!rep_x || ++tiles > 512)
+					break;
+				x += tw;
+				if (x >= box.x + box.w)
+					break;
+			}
+			if (!rep_y || ++rows > 64)
+				break;
+			y += th;
+			if (y >= box.y + box.h)
+				break;
+			x = row_x;
+		}
+	}
 }
 
 static int run_width(const struct lay_run *r)

+ 261 - 18
browser_html.c

@@ -2278,7 +2278,10 @@ static int str_eq(const char *a, const char *b)
 /* ---- CSS ---- */
 
 enum {
-	PROP_COLOR, PROP_BG, PROP_BG_IMAGE, PROP_FONT_PX, PROP_FONT_UNIT,
+	PROP_COLOR, PROP_BG, PROP_BG_IMAGE, PROP_BG_REPEAT,
+	PROP_BG_POS_X_KIND, PROP_BG_POS_X, PROP_BG_POS_Y_KIND, PROP_BG_POS_Y,
+	PROP_BG_SIZE_KIND, PROP_BG_SIZE_W, PROP_BG_SIZE_H,
+	PROP_FONT_PX, PROP_FONT_UNIT,
 	PROP_BOLD, PROP_ITALIC, PROP_MONO, PROP_FONT_FACE,
 	PROP_ALIGN, PROP_UNDERLINE,
 	PROP_DISPLAY, PROP_MT, PROP_MR, PROP_MB, PROP_ML,
@@ -3124,6 +3127,194 @@ static int next_token(const char *s, unsigned int len, unsigned int *pos,
 	return 1;
 }
 
+static int bg_number(const char *s, unsigned int len, signed short *val,
+		      unsigned char *kind)
+{
+	unsigned int i = 0;
+	long v = 0;
+	int neg = 0, digits = 0, pct = 0;
+
+	if (i < len && (s[i] == '-' || s[i] == '+')) {
+		neg = s[i] == '-';
+		i++;
+	}
+	while (i < len && s[i] >= '0' && s[i] <= '9') {
+		v = v * 10 + (s[i] - '0');
+		digits = 1;
+		i++;
+	}
+	if (i < len && s[i] == '.') {
+		i++;
+		while (i < len && s[i] >= '0' && s[i] <= '9')
+			i++;
+	}
+	if (!digits)
+		return 0;
+	if (i < len && s[i] == '%') {
+		pct = 1;
+		i++;
+	} else if (i + 2 <= len && ci_eq_n(s + i, "px", 2)) {
+		i += 2;
+	}
+	if (i != len)
+		return 0;
+	if (neg)
+		v = -v;
+	if (v < -4096)
+		v = -4096;
+	if (v > 4096)
+		v = 4096;
+	*val = (signed short)v;
+	*kind = (unsigned char)(pct ? 1 : 0);
+	return 1;
+}
+
+static int bg_keyword(const char *s, unsigned int len, signed short *val,
+		      int *vertical)
+{
+	*vertical = 0;
+	if (len == 4 && ci_eq_n(s, "left", 4)) {
+		*val = 0;
+		return 1;
+	}
+	if (len == 5 && ci_eq_n(s, "right", 5)) {
+		*val = 100;
+		return 1;
+	}
+	if (len == 3 && ci_eq_n(s, "top", 3)) {
+		*val = 0;
+		*vertical = 1;
+		return 1;
+	}
+	if (len == 6 && ci_eq_n(s, "bottom", 6)) {
+		*val = 100;
+		*vertical = 1;
+		return 1;
+	}
+	if (len == 6 && ci_eq_n(s, "center", 6)) {
+		*val = 50;
+		return 1;
+	}
+	return 0;
+}
+
+static void add_bg_position(struct br_decl *out, unsigned int *nout,
+			    const char *s, unsigned int len, int important)
+{
+	unsigned int pos = 0, ts, te;
+	signed short val[2] = { 50, 50 };
+	unsigned char kind[2] = { 1, 1 };
+	int vert[2] = { 0, 0 }, n = 0;
+
+	while (n < 2 && next_token(s, len, &pos, &ts, &te)) {
+		signed short v;
+		int is_vert;
+
+		if (bg_keyword(s + ts, te - ts, &v, &is_vert)) {
+			val[n] = v;
+			kind[n] = 1;
+			vert[n] = is_vert;
+		} else if (bg_number(s + ts, te - ts, &v, &kind[n])) {
+			val[n] = v;
+			vert[n] = 0;
+		} else {
+			n++;
+			continue;
+		}
+		n++;
+	}
+	if (n == 1) {
+		if (vert[0]) {
+			decl_add(out, nout, PROP_BG_POS_X_KIND, 1, important);
+			decl_add(out, nout, PROP_BG_POS_X, 50, important);
+			decl_add(out, nout, PROP_BG_POS_Y_KIND, kind[0],
+				 important);
+			decl_add(out, nout, PROP_BG_POS_Y, val[0], important);
+		} else {
+			decl_add(out, nout, PROP_BG_POS_X_KIND, kind[0],
+				 important);
+			decl_add(out, nout, PROP_BG_POS_X, val[0], important);
+			decl_add(out, nout, PROP_BG_POS_Y_KIND, 1, important);
+			decl_add(out, nout, PROP_BG_POS_Y, 50, important);
+		}
+		return;
+	}
+	if (n >= 2) {
+		int x = vert[0] && !vert[1] ? 1 : 0;
+		int y = 1 - x;
+
+		decl_add(out, nout, PROP_BG_POS_X_KIND, kind[x], important);
+		decl_add(out, nout, PROP_BG_POS_X, val[x], important);
+		decl_add(out, nout, PROP_BG_POS_Y_KIND, kind[y], important);
+		decl_add(out, nout, PROP_BG_POS_Y, val[y], important);
+	}
+}
+
+static void add_bg_size(struct br_decl *out, unsigned int *nout,
+			const char *s, unsigned int len, int important)
+{
+	unsigned int pos = 0, ts, te;
+	signed short w = 0, h = 0;
+	unsigned char kw = 0, kh = 0;
+	int n = 0;
+
+	while (n < 2 && next_token(s, len, &pos, &ts, &te)) {
+		if (n == 0 && te - ts == 5 && ci_eq_n(s + ts, "cover", 5)) {
+			decl_add(out, nout, PROP_BG_SIZE_KIND, 3, important);
+			return;
+		}
+		if (n == 0 && te - ts == 7 &&
+		    ci_eq_n(s + ts, "contain", 7)) {
+			decl_add(out, nout, PROP_BG_SIZE_KIND, 4, important);
+			return;
+		}
+		if (te - ts == 4 && ci_eq_n(s + ts, "auto", 4)) {
+			n++;
+			continue;
+		}
+		{
+			signed short v;
+			unsigned char k;
+
+			if (bg_number(s + ts, te - ts, &v, &k)) {
+				if (n == 0) {
+					w = v;
+					kw = k;
+				} else {
+					h = v;
+					kh = k;
+				}
+			}
+		}
+		n++;
+	}
+	decl_add(out, nout, PROP_BG_SIZE_KIND, kw ? 2 : (n ? 1 : 0), important);
+	decl_add(out, nout, PROP_BG_SIZE_W, w, important);
+	decl_add(out, nout, PROP_BG_SIZE_H, h, important);
+	(void)kh;
+}
+
+static void add_bg_image_decl(struct br_decl *out, unsigned int *nout,
+			      const char *v, unsigned int vl, int important)
+{
+	unsigned int i;
+
+	for (i = 0; i + 4 <= vl; i++) {
+		if (ci_eq_n(v + i, "url(", 4)) {
+			unsigned int st = i + 4, en = st;
+			int idx;
+
+			while (en < vl && v[en] != ')')
+				en++;
+			idx = register_bg_url(v + st, en - st);
+			if (idx)
+				decl_add(out, nout, PROP_BG_IMAGE, idx,
+					 important);
+			return;
+		}
+	}
+}
+
 static int parse_len_token(const char *s, unsigned int len, int *out)
 {
 	unsigned int pos = 0;
@@ -4002,29 +4193,53 @@ static void parse_decls(struct br_doc *d, const char *s,
 				a = BR_ALIGN_RIGHT;
 			decl_add(out, nout, PROP_ALIGN, a, important);
 		} else if (str_eq(prop, "background-image")) {
-			const char *v = s + vstart;
-			unsigned int vl = vend - vstart, i;
-
-			for (i = 0; i + 4 <= vl; i++)
-				if (ci_eq_n(v + i, "url(", 4))
-					break;
-			if (i + 4 < vl) {
-				unsigned int st = i + 4, en = st;
-				int idx;
+			add_bg_image_decl(out, nout, s + vstart,
+					  vend - vstart, important);
+		} else if (str_eq(prop, "background-repeat")) {
+			int r = 0;
 
-				while (en < vl && v[en] != ')')
-					en++;
-				idx = register_bg_url(v + st, en - st);
-				if (idx)
-					decl_add(out, nout, PROP_BG_IMAGE,
-						 idx, important);
-			}
+			if (contains_ci_len(s + vstart, vend - vstart,
+					    "no-repeat"))
+				r = 1;
+			else if (contains_ci_len(s + vstart, vend - vstart,
+						 "repeat-x"))
+				r = 2;
+			else if (contains_ci_len(s + vstart, vend - vstart,
+						 "repeat-y"))
+				r = 3;
+			decl_add(out, nout, PROP_BG_REPEAT, r, important);
+		} else if (str_eq(prop, "background-position")) {
+			add_bg_position(out, nout, s + vstart, vend - vstart,
+					important);
+		} else if (str_eq(prop, "background-size")) {
+			add_bg_size(out, nout, s + vstart, vend - vstart,
+				    important);
 		} else if (str_eq(prop, "background-color") ||
 			   str_eq(prop, "background")) {
 			unsigned short c;
+			int is_bg = str_eq(prop, "background");
+
+			if (is_bg) {
+				add_bg_image_decl(out, nout, s + vstart,
+						  vend - vstart, important);
+				if (contains_ci_len(s + vstart, vend - vstart,
+						    "no-repeat"))
+					decl_add(out, nout, PROP_BG_REPEAT, 1,
+						 important);
+				else if (contains_ci_len(s + vstart,
+							 vend - vstart,
+							 "repeat-x"))
+					decl_add(out, nout, PROP_BG_REPEAT, 2,
+						 important);
+				else if (contains_ci_len(s + vstart,
+							 vend - vstart,
+							 "repeat-y"))
+					decl_add(out, nout, PROP_BG_REPEAT, 3,
+						 important);
+			}
 			if (parse_color(s + vstart, vend - vstart, &c))
 				decl_add(out, nout, PROP_BG, c, important);
-			else if (str_eq(prop, "background") &&
+			else if (is_bg &&
 				 find_color_last(s + vstart, vend - vstart, &c))
 				decl_add(out, nout, PROP_BG, c, important);
 		} else if (str_eq(prop, "font-size")) {
@@ -5795,6 +6010,30 @@ static void apply_decl(struct br_style *st, const struct br_decl *dcl)
 	case PROP_BG_IMAGE:
 		st->bg_image = (unsigned short)dcl->val;
 		break;
+	case PROP_BG_REPEAT:
+		st->bg_repeat = (unsigned char)dcl->val;
+		break;
+	case PROP_BG_POS_X_KIND:
+		st->bg_pos_x_kind = (unsigned char)dcl->val;
+		break;
+	case PROP_BG_POS_X:
+		st->bg_pos_x = (signed short)dcl->val;
+		break;
+	case PROP_BG_POS_Y_KIND:
+		st->bg_pos_y_kind = (unsigned char)dcl->val;
+		break;
+	case PROP_BG_POS_Y:
+		st->bg_pos_y = (signed short)dcl->val;
+		break;
+	case PROP_BG_SIZE_KIND:
+		st->bg_size_kind = (unsigned char)dcl->val;
+		break;
+	case PROP_BG_SIZE_W:
+		st->bg_size_w = (unsigned short)dcl->val;
+		break;
+	case PROP_BG_SIZE_H:
+		st->bg_size_h = (unsigned short)dcl->val;
+		break;
 	case PROP_FONT_PX:
 		st->font_raw = (unsigned short)dcl->val;
 		break;
@@ -6052,6 +6291,10 @@ void br_style_for(struct br_doc *d, unsigned int node,
 	*out = *parent;
 	out->has_bg = 0;
 	out->bg_image = 0;
+	out->bg_repeat = 0;
+	out->bg_pos_x_kind = out->bg_pos_y_kind = 0;
+	out->bg_pos_x = out->bg_pos_y = 0;
+	out->bg_size_kind = out->bg_size_w = out->bg_size_h = 0;
 	out->float_left = 0;
 	out->clear = 0;
 	out->list_item = 0;

+ 5 - 0
browser_html.h

@@ -90,6 +90,11 @@ struct br_style {
 	unsigned short bg;
 	unsigned short border_c[4]; /* top, right, bottom, left */
 	unsigned short bg_image;    /* 1-based background URL, 0 none */
+	unsigned char bg_repeat;    /* 0 repeat, 1 no-repeat, 2 repeat-x, 3 repeat-y */
+	unsigned char bg_pos_x_kind, bg_pos_y_kind; /* 0 px, 1 percent */
+	signed short bg_pos_x, bg_pos_y;
+	unsigned char bg_size_kind; /* 0 auto/stretch, 1 px, 2 percent, 3 cover, 4 contain */
+	unsigned short bg_size_w, bg_size_h;
 	unsigned char has_bg;
 	unsigned char font_px;      /* 8..48 */
 	unsigned short font_raw;    /* font-size before unit resolution */

Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 1
docs/userland.html


+ 68 - 0
testdata/browser/compat/038-background-props.html

@@ -0,0 +1,68 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>038 background properties</title>
+<style>
+html, body { margin: 0; padding: 0; background: #ffffff; color: #202020; }
+body { font-family: sans-serif; font-size: 13px; padding: 10px; }
+h1 { font-size: 20px; margin: 0 0 6px 0; }
+p { margin: 0 0 10px 0; }
+.pane { float: left; width: 440px; margin-left: 10px; }
+.label { background: #eeeeee; padding: 4px 6px; margin-bottom: 4px; }
+.row { clear: both; margin-bottom: 10px; }
+.tile { width: 194px; height: 128px;
+        background: #dddddd url(TILE.PNG) repeat; background-size: 64px; }
+.tile-ref { width: 194px; height: 128px; background-color: #dddddd; }
+.tile-img { float: left; width: 64px; height: 64px; }
+.pos { width: 194px; height: 122px; background-color: #dddddd;
+       background-image: url(PIC.BMP); background-size: 64px;
+       background-position: 20px 10px; background-repeat: no-repeat; }
+.pos-ref { width: 194px; height: 122px; background-color: #dddddd;
+           padding: 10px 0 0 20px; box-sizing: border-box; }
+.contain { width: 120px; height: 60px; background-color: #dddddd;
+           background-image: url(PIC.BMP); background-size: contain;
+           background-position: center; background-repeat: no-repeat; }
+.contain-ref { width: 120px; height: 60px; background-color: #dddddd;
+               padding-left: 12px; box-sizing: border-box; }
+.cover { width: 120px; height: 120px; background-color: #dddddd;
+         background-image: url(TILE.PNG); background-size: cover;
+         background-repeat: no-repeat; }
+.caption { clear: both; color: #555555; padding-top: 2px; }
+</style>
+</head>
+<body>
+<h1>038 &middot; background repeat, position and size</h1>
+<p>Each pair must look identical. The tile source is 64&times;64; PIC.BMP is 194&times;122.</p>
+<div class="pane">
+  <div class="label">A &middot; background properties</div>
+  <div class="row"><div class="tile"></div>
+    <div class="caption">background shorthand URL, repeat, size: 64px</div></div>
+  <div class="row"><div class="pos"></div>
+    <div class="caption">no-repeat, position: 20px 10px, size: 64px</div></div>
+  <div class="row"><div class="contain"></div>
+    <div class="caption">contain, centered</div></div>
+  <div class="row"><div class="cover"></div>
+    <div class="caption">cover in a 120&times;120 box</div></div>
+</div>
+<div class="pane">
+  <div class="label">B &middot; reference</div>
+  <div class="row"><div class="tile-ref">
+    <img class="tile-img" src="TILE.PNG" width="64" height="64">
+    <img class="tile-img" src="TILE.PNG" width="64" height="64">
+    <img class="tile-img" src="TILE.PNG" width="64" height="64">
+    <img class="tile-img" src="TILE.PNG" width="64" height="64">
+    <img class="tile-img" src="TILE.PNG" width="64" height="64">
+    <img class="tile-img" src="TILE.PNG" width="64" height="64">
+  </div><div class="caption">six 64&times;64 images, 3 per row</div></div>
+  <div class="row"><div class="pos-ref">
+    <img src="PIC.BMP" width="64">
+  </div><div class="caption">image at 20,10, width 64</div></div>
+  <div class="row"><div class="contain-ref">
+    <img src="PIC.BMP" width="95">
+  </div><div class="caption">image width 95, centered</div></div>
+  <div class="row"><div><img src="TILE.PNG" width="120" height="120"></div>
+    <div class="caption">120&times;120 image</div></div>
+</div>
+</body>
+</html>

+ 3 - 3
testdata/browser/compat/README

@@ -17,13 +17,13 @@ Serve this directory from the host and open it on the board:
   browser http://<host>:8000/            # board
   browser http://10.0.2.2:8000/         # QEMU with -netdev user
 
-Status: 010-037 and 030a pass.  036a needs the POST echo server:
+Status: 010-038 and 030a pass.  036a needs the POST echo server:
 
   python3 testdata/browser/compat/post_server.py
   browser /floppy1/036a.htm      # action is http://10.0.2.2:8765/echo
 
-Still missing from the ladder: background repeat/position/size, the rest of
-transform, sticky bottom/container clamping, and calc() beyond widths.
+Still missing from the ladder: the rest of transform (scale/rotate),
+sticky bottom/container clamping, and calc() beyond widths.
 
 Rules for new pages:
   - one behaviour per page;

BIN
testdata/browser/compat/TILE.PNG


+ 1 - 0
testdata/browser/compat/index.html

@@ -60,6 +60,7 @@ a { color: #0645ad; }
 <tr><td>036</td><td><a href="036-form-events.html">form events</a></td><td>addEventListener, bubbling, preventDefault, form.elements</td><td class="pass">PASS</td></tr>
 <tr><td>036a</td><td><a href="036a-post.html">POST form</a></td><td>POST submission to <code>/echo</code> (needs <code>post_server.py</code>)</td><td class="pass">PASS</td></tr>
 <tr><td>037</td><td><a href="037-font-face.html">@font-face</a></td><td>custom TTF family and missing-URL fallback</td><td class="pass">PASS</td></tr>
+<tr><td>038</td><td><a href="038-background-props.html">background props</a></td><td>repeat, position, contain/cover and the shorthand URL</td><td class="pass">PASS</td></tr>
 </table>
 </body>
 </html>

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.