Peach: Local-first video metadata scraper and media manager.
perf(web): 馆藏与关注卡片按封面和元信息区跳过屏外渲染
longmeidao99953e78abab
diff --git a/frontend/e2e/design.test.ts b/frontend/e2e/design.test.tsindex 3ff1d7631..8dd615003 100644--- a/frontend/e2e/design.test.ts+++ b/frontend/e2e/design.test.ts@@ -1576,27 +1576,32 @@ describe('设计决定', () => {}});- it('跳过渲染的卡片不裁掉贴着左缘的头像悬停描边', { timeout: 60_000 }, async () => {+ it('跳过渲染的元信息区不裁掉贴着边的头像悬停描边', { timeout: 60_000 }, async () => {const opened = await openCatalog(browser);try {- /* 视口外跳过渲染连带 paint containment,卡里画出卡片盒的像素一律裁掉;几何照算,- 所以这里比的是描边外沿与裁切边,不是与卡片盒。 */+ /* 视口外跳过渲染连带 paint containment,元信息区里画出盒外的像素一律裁掉;几何照算,+ 所以这里比的是描边外沿与裁切边,不是与元信息区的盒子。头像贴着它的左缘和上缘。 */const avatar = opened.page.locator('#grid .grid > article.card .meta > .mav').first();await avatar.hover();const edges = await avatar.evaluate((element) => {- const card = element.closest('article.card')!;- const style = getComputedStyle(card);+ const meta = element.closest('.meta')!;+ const style = getComputedStyle(meta);const ring = Number(/0px 0px 0px (\d+(?:\.\d+)?)px/.exec(getComputedStyle(element).boxShadow)?.[1]);+ const margin = parseFloat(style.overflowClipMargin || '0');+ const box = element.getBoundingClientRect();+ const clip = meta.getBoundingClientRect();return {contained: style.contentVisibility === 'auto',- ring, ringLeft: element.getBoundingClientRect().left - ring,- clipLeft: card.getBoundingClientRect().left - parseFloat(style.overflowClipMargin || '0'),+ ring, ringLeft: box.left - ring, ringTop: box.top - ring,+ clipLeft: clip.left - margin, clipTop: clip.top - margin,};});- assert.ok(edges.contained, '首页卡片不再跳过渲染:这条用例守的裁切前提变了,改用例');+ assert.ok(edges.contained, '首页卡片的元信息区不再跳过渲染:这条用例守的裁切前提变了,改用例');assert.ok(edges.ring > 0, '头像悬停没有描边');assert.ok(edges.ringLeft >= edges.clipLeft - .5,`头像描边外沿 ${edges.ringLeft}px 越过了裁切边 ${edges.clipLeft}px,左半圈会被裁掉`);+ assert.ok(edges.ringTop >= edges.clipTop - .5,+ `头像描边上沿 ${edges.ringTop}px 越过了裁切边 ${edges.clipTop}px,上半圈会被裁掉`);} finally {await opened.close();}diff --git a/frontend/e2e/offscreen-cards.test.ts b/frontend/e2e/offscreen-cards.test.tsnew file mode 100644index 000000000..63dbb2f3f--- /dev/null+++ b/frontend/e2e/offscreen-cards.test.ts@@ -0,0 +1,207 @@+/* 视口外的卡片跳过渲染:封面和元信息区交给浏览器按视口取舍,卡片盒照常排版。+ *+ * 这几条守的是跳过渲染的副作用:屏外卡确实被跳过、没渲染过的卡按估计高度排进来之后+ * 整页高度和卡片位置不跳、Ctrl+F 仍找得到屏外卡里的字。演示库只有十来条,一屏就放完,+ * 这里把目录响应放大成一长列,编号改成互不相同,封面请求再改写回原来那条。 */+import assert from 'node:assert/strict';+import { after, before, describe, it } from 'node:test';++import type { Browser, Page } from 'playwright-core';++import { launch, settle, visit, VIEWPORTS, type Visit } from './harness.ts';++const DESKTOP = VIEWPORTS.find((viewport) => !viewport.mobile)!;+const CLONES = 150;+const CLONE_BASE = 900_000;+const PROBE_TAG = '屏外探针';++interface CatalogPayload {+ total: number;+ items: Array<Record<string, unknown>>;+}++/** 目录首屏换成 `CLONES` 张卡:每三张有一张带标签,最后一张带一枚独有的标签给查找用。 */+async function openLongCatalog(browser: Browser): Promise<Visit> {+ const opened = await visit(browser, '/', DESKTOP);+ const { page } = opened;+ const original = new Map<number, number>();+ let baseline: CatalogPayload | undefined;+ await page.route(/\/api\/items\?/, async (route) => {+ const url = new URL(route.request().url());+ if (url.searchParams.get('offset') !== '0') {+ await route.continue();+ return;+ }+ baseline ??= await (await route.fetch()).json() as CatalogPayload;+ const source = baseline.items.filter((item) => !item.part_group && !item.edition_group);+ const items = Array.from({ length: CLONES }, (_, index) => {+ const item = structuredClone(source[index % source.length]);+ original.set(CLONE_BASE + index, Number(item.id));+ item.id = CLONE_BASE + index;+ item.tags = index === CLONES - 1 ? [PROBE_TAG] : index % 3 === 0 ? ['演示'] : [];+ return item;+ });+ await route.fulfill({ status: 200, contentType: 'application/json',+ body: JSON.stringify({ ...baseline, total: CLONES, items }) });+ });+ await page.route((url) => original.has(Number(url.searchParams.get('id'))), async (route) => {+ const url = new URL(route.request().url());+ url.searchParams.set('id', String(original.get(Number(url.searchParams.get('id')))));+ await route.continue({ url: url.toString() });+ });+ await page.reload({ waitUntil: 'load' });+ await page.waitForFunction((count) => document.querySelectorAll('#grid .card').length >= count, CLONES,+ { timeout: 15_000 });+ await settle(page);+ return opened;+}++/** 关注页换成 `CLONES` 条合成的更新:演示库没有关注来源。字段照 `/api/follow` 的形状,+ * 不带缩略图,不发外站请求;每三条有一条带标签,屏外卡因此有高矮两种元信息区。 */+async function openLongFollow(browser: Browser): Promise<Visit> {+ const opened = await visit(browser, '/', DESKTOP);+ const { page } = opened;+ const source = { id: 1, provider: 'rule34xxx', provider_label: 'Rule34.xxx', ref: 'demo', label: '演示来源',+ author_name: '演示作者', author_key: 'name:演示作者', official_avatar_url: null, avatar_url: null,+ url: 'https://example.invalid/', semantics: 'work', enabled: true, entity_id: null, entity_name: null,+ can_backfill: false, backfill_page: 0, created_at: '2026-09-01T00:00:00Z', last_checked_at: null,+ last_status: 'ok', last_error: null, history_exhausted: true };+ const groups = Array.from({ length: CLONES }, (_, index) => ({+ release_key: `demo-${index}`, variants: [], duplicates: [], providers: ['rule34xxx'], has_wip: false,+ is_release: false, newest_at: '2026-09-01T00:00:00Z',+ primary: {+ id: CLONE_BASE + index, provider: 'rule34xxx', provider_label: 'Rule34.xxx', resource_provider: 'rule34xxx',+ source_id: 1, source_label: '演示来源', external_id: String(index), title: `演示更新 ${index}`,+ author: '演示作者', summary: null, url: `https://example.invalid/${index}`, thumb_url: null,+ published_at: '2026-09-01T00:00:00Z', published_precision: 'exact', version: null, duration: 60,+ variant_kind: 'main', variant_label: null, status: 'new', asset_id: null, media_needs_credential: false,+ media_error: null, has_media: false, media_kind: 'video', width: 1280, height: 720, media_type: null,+ playable: false, media_items: [], hidden_media: [], resource_urls: [],+ tags: index % 3 === 0 ? ['演示'] : [], detail_tags: [], tag_types: {},+ },+ }));+ const body = { ok: true, sources: [source], author_aliases: [], alias_suggestions: [], suggestions: [], groups,+ counts: { new: CLONES, seen: 0, saved: 0, ignored: 0 }, sort: 'new', dir: 'desc', seed: 1,+ facets: { authors: [], providers: [], tags: [], works: [] }, offset: 0, limit: CLONES, has_more: false,+ providers: ['rule34xxx'] };+ await page.route(/\/api\/follow(\?|$)/, (route) => route.fulfill({ status: 200, contentType: 'application/json',+ body: JSON.stringify(body) }));+ await page.goto(new URL('/follow', page.url()).toString(), { waitUntil: 'load' });+ await page.waitForFunction((count) => document.querySelectorAll('.followlist>.card').length >= count, CLONES,+ { timeout: 15_000 });+ await settle(page);+ return opened;+}++/** 一屏一屏滚到底再滚回顶,每步等两帧,让每张卡都至少渲染过一次。 */+function roundTrip(page: Page): Promise<void> {+ return page.evaluate(async () => {+ const frame = () => new Promise(requestAnimationFrame);+ for (const direction of [1, -1]) {+ for (let step = 0; step < 500; step++) {+ const y = scrollY;+ scrollBy(0, direction * innerHeight * .9);+ await frame();+ await frame();+ if (scrollY === y) break;+ }+ }+ });+}++describe('视口外的卡片', () => {+ let browser: Browser;++ before(async () => {+ browser = await launch();+ });++ after(async () => {+ await browser.close();+ });++ it('跳过封面与元信息区的渲染,Ctrl+F 仍找得到屏外卡里的字', { timeout: 60_000 }, async () => {+ const opened = await openLongCatalog(browser);+ try {+ const state = await opened.page.evaluate((tag) => {+ const last = [...document.querySelectorAll<HTMLElement>('#grid .card')].at(-1)!;+ const parts = [last.querySelector('.pic')!, last.querySelector('.meta')!];+ // 跳过的是元素的内容,元素自己仍在排版里:查它的第一个子元素。+ const skipped = parts.map((part) => !part.firstElementChild!.checkVisibility({ contentVisibilityAuto: true }));+ const box = last.getBoundingClientRect();+ /* 侧栏的标签列表里也有这枚标签,排在文档前面;往下接着找,直到落进那张卡。 */+ const find = (window as unknown as { find(text: string): boolean }).find.bind(window);+ let hits = 0;+ while (hits < 5 && find(tag)) {+ hits++;+ const node = getSelection()?.anchorNode;+ if (node && last.contains(node)) break;+ }+ const hit = getSelection()?.anchorNode;+ return {+ values: parts.map((part) => getComputedStyle(part).contentVisibility),+ skipped, below: box.top - innerHeight, height: box.height,+ hits, inLast: !!hit && last.contains(hit),+ };+ }, PROBE_TAG);+ assert.deepEqual(state.values, ['auto', 'auto'], '屏外卡的封面和元信息区没有交给浏览器按视口取舍');+ assert.ok(state.below > 1000, `最后一张卡离视口只有 ${state.below}px,放大的列表不够长`);+ assert.deepEqual(state.skipped, [true, true], '屏外卡的封面或元信息区仍在渲染');+ assert.ok(state.height > 0, '屏外卡的 getBoundingClientRect 量出了零高');+ assert.ok(state.inLast, `页内查找没有落到屏外那张卡的标签上(命中 ${state.hits} 次)`);+ assert.deepEqual(opened.problems, []);+ } finally {+ await opened.close();+ }+ });++ for (const [where, open, selector] of [+ ['馆藏', openLongCatalog, '#grid .card'],+ ['关注', openLongFollow, '.followlist>.card'],+ ] as const) {+ it(`${where}:长距离往返之后整页高度和深处那张卡的位置不跳,屏外量到的几何与渲染后一致`, { timeout: 90_000 }, async () => {+ const opened = await open(browser);+ try {+ const { page } = opened;+ const measure = () => page.evaluate((cardSelector) => {+ const cards = [...document.querySelectorAll(cardSelector)];+ const deep = cards[Math.floor(cards.length * .8)];+ return { height: document.documentElement.scrollHeight,+ deep: deep.getBoundingClientRect().top + scrollY, y: scrollY,+ view: deep.getBoundingClientRect().top,+ skipping: getComputedStyle(deep.querySelector('.meta')!).contentVisibility,+ meta: deep.querySelector('.meta')!.getBoundingClientRect().height };+ }, selector);+ /* 首屏之外的卡此刻都没渲染过,高度全按估计值;往返一趟之后每张都记住了自己的实际+ 尺寸。两次量到的差就是估计值的误差,一行差一点,累积到深处就是滚动条在跳。 */+ const fresh = await measure();+ assert.equal(fresh.skipping, 'auto', `${where}的屏外卡不跳过渲染,量不到估计值的误差`);+ await roundTrip(page);+ const rendered = await measure();+ assert.ok(Math.abs(rendered.height - fresh.height) <= 1,+ `整页高度从 ${fresh.height} 变成 ${rendered.height}:元信息区的估计高度与实际不符`);+ assert.ok(Math.abs(rendered.deep - fresh.deep) <= 1,+ `深处那张卡从 ${fresh.deep} 挪到 ${rendered.deep}`);++ /* 停在深处,滚到底再回来:同一个 scrollY 下那张卡应该还在原处。 */+ await page.evaluate((y) => scrollTo(0, y), rendered.deep - 300);+ await page.waitForTimeout(300);+ const parked = await measure();+ /* 跳过渲染时量到的几何要和渲染后一致:卡里有别的子元素抢空间时,内容不参与最小尺寸的+ 元信息区会被压扁,整张卡的高度不变,从外面看不出来,只有量它自己才露馅。 */+ assert.ok(Math.abs(fresh.meta - parked.meta) <= 1,+ `屏外卡的元信息区量出 ${fresh.meta}px,渲染后是 ${parked.meta}px`);+ await roundTrip(page);+ await page.evaluate((y) => scrollTo(0, y), parked.y);+ await page.waitForTimeout(300);+ const back = await measure();+ assert.equal(back.y, parked.y, '回不到原来的滚动位置');+ assert.ok(Math.abs(back.view - parked.view) <= 1,+ `回到同一滚动位置后那张卡在视口里从 ${parked.view} 挪到 ${back.view}`);+ assert.deepEqual(opened.problems, []);+ } finally {+ await opened.close();+ }+ });+ }+});diff --git a/frontend/e2e/sidebar-motion.test.ts b/frontend/e2e/sidebar-motion.test.tsindex 56bb58b6e..92a67ad08 100644--- a/frontend/e2e/sidebar-motion.test.ts+++ b/frontend/e2e/sidebar-motion.test.ts@@ -24,6 +24,8 @@ interface Toggle {mainRight: number;railW: number;viewport: number;+ /** 点击后 300ms(过渡的时长)里出了几帧,首帧算点击那一刻。 */+ frames: number;}/** 点一下左上角的切换键,等 `body` 的 `padding-left` 与抽屉的 `width` 两段过渡都停下。 */@@ -36,6 +38,16 @@ async function toggle(page: Page): Promise<Toggle> {let mapsDuring = -1;let opticDuring = '';const timer = setTimeout(() => reject(new Error(`过渡没有结束,还差 ${[...pending].join('、')}`)), 5_000);+ /* 帧数从点击那一刻数到 300ms:主线程被一次整页重排占住多久,这段里就少出多少帧。 */+ let clicked = 0;+ let frames = 1;+ let counting = true;+ const tick = (now: number) => {+ if (!counting) return;+ if (now - clicked <= 300) frames++;+ requestAnimationFrame(tick);+ };+ const window300 = new Promise<void>((done) => setTimeout(done, 320));const onEnd = (event: TransitionEvent) => {const key = event.target === document.body && event.propertyName === 'padding-left' ? 'padding-left': event.target === drawer && event.propertyName === 'width' ? 'width' : '';@@ -47,7 +59,8 @@ async function toggle(page: Page): Promise<Toggle> {if (pending.size) return;clearTimeout(timer);window.removeEventListener('transitionend', onEnd, true);- requestAnimationFrame(() => requestAnimationFrame(() => {+ void window300.then(() => requestAnimationFrame(() => requestAnimationFrame(() => {+ counting = false;const drawerBox = drawer.getBoundingClientRect();const mainBox = document.querySelector('#main')!.getBoundingClientRect();resolve({@@ -62,11 +75,14 @@ async function toggle(page: Page): Promise<Toggle> {mainRight: mainBox.right,railW: parseFloat(getComputedStyle(document.body).getPropertyValue('--railW')),viewport: document.documentElement.clientWidth,+ frames,});- }));+ })));};// 挂在 window 的捕获阶段:比页面挂在 document 上的补画先拿到这一次结束。window.addEventListener('transitionend', onEnd, true);+ clicked = performance.now();+ requestAnimationFrame(tick);document.querySelector<HTMLElement>('#filterBtn')!.click();}));}@@ -110,6 +126,10 @@ describe('侧栏开合', () => {assert.ok(Math.abs(state.mainLeft - state.railW) <= .5, `${name}后主区左缘 ${state.mainLeft},应落在 --railW ${state.railW}`);assert.ok(Math.abs(state.mainRight - state.viewport) <= 1, `${name}后主区右缘 ${state.mainRight} 没有贴到视口右缘 ${state.viewport}`);assert.ok(state.drawerRight <= state.mainLeft, `${name}后抽屉右缘 ${state.drawerRight} 压进了主区`);+ /* 下限只拦「整段过渡被一次长任务吞掉、直接跳到终态」:除了点击那一帧,300ms 里至少+ 还要出一帧中间帧。本机无头 Chrome 收起 10~15 帧、展开 30~38 帧;CPU 降速 6 倍后+ 收起 2 帧、展开 4 帧,CI 的慢机落在这两档之间。 */+ assert.ok(state.frames >= 2, `${name}过渡的 300ms 里只出了 ${state.frames} 帧,主线程整段被占住`);}assert.equal(collapsed.open, false);assert.equal(expanded.open, true);diff --git a/tests/test_source_assertion_ratchet.py b/tests/test_source_assertion_ratchet.pyindex 4c7e3e14b..66a7429dd 100644--- a/tests/test_source_assertion_ratchet.py+++ b/tests/test_source_assertion_ratchet.py@@ -53,7 +53,7 @@ BASELINE: dict[str, int] = {"test_web_e2e.py": 2,"test_web_js.py": 1,"test_web_settings.py": 8,- "test_web_ui.py": 4513,+ "test_web_ui.py": 4509,"test_windows_update.py": 3,}diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex b832e1d3e..1af3671fa 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -1957,7 +1957,7 @@ class WebUiSourceTests(unittest.TestCase):# 不再给其中一种额外加一行高度。self.assertPageContains('body[data-density="dense"] .grid>.card{padding-top:7px}')self.assertPageContains('body[data-density="dense"] .card .mtext{display:grid;grid-template-rows:1.35em 1.35em 30px;')- self.assertPageContains('gap:3px;height:calc(2.7em + 36px);overflow:hidden}')+ self.assertPageContains('gap:3px;height:var(--card-meta-block);overflow:hidden}')self.assertPageContains('body[data-density="dense"] .card .meta .s{height:1.35em;min-height:0;flex-wrap:nowrap;overflow:hidden;white-space:nowrap}')self.assertPageContains('body[data-density="dense"] .card .ctags{height:30px;align-items:flex-start;flex-wrap:nowrap;overflow:hidden}')self.assertPageContains('body[data-density="dense"] .card .meta .watchcount{display:none}')@@ -2765,28 +2765,6 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("body .card:not(.junkcard,.resourcecard):hover .pic{filter:saturate(.9) brightness(.94)}")- def test_catalog_cards_skip_rendering_outside_the_viewport(self):- """馆藏网格的卡片交给浏览器按视口取舍,一屏滚动只算屏上那几十张。-- 连续加载到 1525 张时帧间隔 18.2 ms,仍在 16.7 ms 的帧预算附近(ADR-0031- 「馆藏网格连续加载的实测」)。`auto 320px` 只是占位,渲染过的卡记住自己的尺寸。-- 四类卡在规则之外。Mix 卡和分卷/版次卡的叠层纸边靠 transform 抬到卡片盒外- 7px,跳过渲染连带的 paint containment 会把那一截裁掉;垃圾文件卡自己声明占位- 高度,这条选择器压过去会把它改矮;竖屏带的卡横着排在 `.srow` 里,320px 与- 9:16 的封面对不上。- """- cards = (Path(__file__).resolve().parents[1]- / "web/css/12-cards.css").read_text(encoding="utf-8")- selector = "#grid article.card:not(.mixcard,.partcard,.junkcard,.scard){"- self.assertIn(selector, cards, "跳过渲染只施加给馆藏网格里不带叠层的卡片")- rule = cards[cards.index(selector) + len(selector):]- rule = rule[:rule.index("}")]- self.assertIn("content-visibility:auto", rule)- self.assertIn("contain-intrinsic-size:auto 320px", rule)- # 垃圾文件卡的占位高度归它自己,所以它留在上面那条的 `:not()` 里。- self.assertIn("content-visibility:auto;contain-intrinsic-size:auto 360px", cards)-def test_big_jav_layout_crops_to_the_front_cover(self):"""大图=宽度不变、高度拉长,只留封套右侧那块正封。diff --git a/web/css/12-cards.css b/web/css/12-cards.cssindex c4b79b11f..ed2b26f8c 100644--- a/web/css/12-cards.css+++ b/web/css/12-cards.css@@ -142,18 +142,34 @@ body.refreshing #batchAction svg,.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--tile),1fr))}.card{cursor:pointer;display:flex;flex-direction:column;gap:8px;min-width:0;border-radius:var(--surface-radius);position:relative;transition:transform .18s ease,filter .18s ease,background-color .15s ease,box-shadow .15s ease;transform-origin:center}-/* 视口外的卡片跳过渲染:一屏滚动要算的只剩屏上那几十张,连续加载到一千五百张时帧间隔- 仍在预算附近(实测见 ADR-0031「馆藏网格连续加载的实测」)。`auto 320px` 是占位高度,- 没渲染过的卡先按 320px 排进来,渲染过的记住自己的实际尺寸。- 跳过渲染连带 paint containment:卡里任何画到卡片盒外的东西都会被裁掉,贴着卡片左缘的- 头像一悬停,那圈 2px 焦点环的左半边就没了。`overflow-clip-margin` 把裁切边往外放到- 8px,和整张卡的悬停面同宽;卡里的东西不要画出这一圈,`frontend/e2e/design.test.ts`- 按几何检查。- 四类卡不在其内:Mix 卡和分卷/版次卡的叠层纸边靠 transform 抬到卡片盒外 7px,Safari- 不认 `overflow-clip-margin`,那一截在它上面照样被裁;垃圾文件卡自己声明了更高的占位值;- 竖屏带的卡横着排在 `.srow` 里,320px 与 9:16 的封面对不上。 */-#grid article.card:not(.mixcard,.partcard,.junkcard,.scard){- content-visibility:auto;contain-intrinsic-size:auto 320px;overflow-clip-margin:8px}+/* 馆藏和关注网格里,视口外的卡片跳过渲染:滚动和侧栏开合时要算的只剩屏上那几十张。+ 跳过的是卡里的两块,封面 `.pic` 和元信息区 `.meta`;卡片盒本身照常排版,所以屏外卡的+ 高度里只有元信息区一项是估计值。+ - 封面高度由 `aspect-ratio` 从列宽推出,跳过渲染时照样成立,列宽随视口和侧栏开合怎么+ 变都与真实渲染一致。卡高随列宽在 270~590px 之间变(JAV 大图一档最高),整张卡+ 跳过就只能给一个固定占位,对不上所有版式,没渲染过的卡越多滚动条漂得越远。+ - 元信息区高度不随列宽变,由它自己的排版 token 推出,见 `--card-meta-block`:两行标题+ (`.meta .t` 的 2.7em)、一行归属(1lh,关注卡另有 21px 的最小高度)、`.mtext` 的 3px+ 行距;有标签的卡再加一行标签(`.ctags` 的高度)和一道行距,关注卡的徽章行 `.fbadges`+ 同理(`.fbadge` 一行字加上下 2px 内边距和 1px 边框)。密集一档的高度是 `.mtext` 固定的+ 三行,同一个变量。+ 叠层纸边画在 `.pic` 外面,不在裁切范围里,Mix 卡、分卷/版次卡和竖屏带的卡一并适用。+ 跳过渲染连带 paint containment:元信息区里画出盒外的像素会被裁掉,贴着左缘的头像一+ 悬停,那圈 2px 焦点环就缺一截。`overflow-clip-margin` 把裁切边往外放 8px,和整张卡的+ 悬停面同宽,`frontend/e2e/design.test.ts` 按几何检查;Safari 不认这个属性,那边贴边的+ 描边和焦点环仍会被裁掉一截。+ 图片墙不在其内:它的封面没有固定比例,高度取自图片本身,跳过渲染时会按零高排版。 */+.meta{--card-meta-byline:1lh;--card-meta-tags:0px;--card-meta-badges:0px;+ --card-meta-block:calc(var(--fs-md)*2.7 + 3px + var(--card-meta-byline) + var(--card-meta-badges) + var(--card-meta-tags))}+.meta:has(>.mtext>.ctags){--card-meta-tags:calc(var(--fs-xs)*1.45 + var(--tag-pad-y)*2 + 2px + 3px)}+.followitem .meta{--card-meta-byline:max(1lh,21px)}+.followitem .meta:has(>.mtext>.fbadges){--card-meta-badges:calc(1lh + 6px + 3px)}+:is(#grid,.followlist:not(.followphotowall)) .card :is(.pic,.meta){content-visibility:auto}+/* `flex-shrink:0`:跳过渲染时元信息区的内容不参与最小尺寸,卡里有别的子元素要抢空间时它会+ 被压扁。关注卡的 `.fstate` 是 `flex:1 1 100%`,不钉住的话屏外关注卡的元信息区只剩 21px。+ 渲染时它本来就压不动(自动最小尺寸就是内容高度),钉住不改变屏上的排版。 */+:is(#grid,.followlist:not(.followphotowall)) .card .meta{flex-shrink:0;+ contain-intrinsic-block-size:auto var(--card-meta-block);overflow-clip-margin:8px}/* 叠层往上溢出到行间距里,卡片本体不为它留白。留白的写法(padding-top:7px)会把整张卡压低 7px 并加高 7px,同一行里 Mix、分卷、版次卡的封面和下面的文字就比邻居矮一截;往上堆之后卡片盒和普通卡完全同高,下沿自然平齐。@@ -437,8 +453,9 @@ body[data-density="dense"] .card .ctags .tg{max-width:100%;overflow:hidden;text-同一网格不会再被大小、观看次数或长身份撑成四行。分卷卡已有 7px 叠层空间,密集网格的普通卡也保留同一高度,避免每行是否出现分卷卡决定整行高度。 */body[data-density="dense"] .grid>.card{padding-top:7px}+body[data-density="dense"] .card .meta{--card-meta-block:calc(2.7em + 36px)}body[data-density="dense"] .card .mtext{display:grid;grid-template-rows:1.35em 1.35em 30px;- gap:3px;height:calc(2.7em + 36px);overflow:hidden}+ gap:3px;height:var(--card-meta-block);overflow:hidden}body[data-density="dense"] .card .meta .t{display:block;max-width:100%;min-height:1.35em;overflow:hidden;-webkit-line-clamp:unset;white-space:nowrap;text-overflow:ellipsis}body[data-density="dense"] .card .meta .s{height:1.35em;min-height:0;flex-wrap:nowrap;overflow:hidden;white-space:nowrap}