Skip to content

Commit 4f924cf

Browse files
committed
rename RenderItem, RenderItemLogOptions
rendering is too generic; this is the layout tree, which is referred to as the "tree" in the upcoming refactor
1 parent 17a8309 commit 4f924cf

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/layout-box.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface LogicalArea {
2020
inlineSize: number | undefined;
2121
}
2222

23-
export interface RenderItemLogOptions {
23+
export interface TreeLogOptions {
2424
containingBlocks?: boolean;
2525
css?: keyof Style
2626
paragraphText?: string;
@@ -32,7 +32,7 @@ export interface PrelayoutContext {
3232
lastPositionedArea: BoxArea
3333
}
3434

35-
export abstract class RenderItem {
35+
export abstract class TreeNode {
3636
public style: Style;
3737

3838
constructor(style: Style) {
@@ -75,11 +75,11 @@ export abstract class RenderItem {
7575
return false;
7676
}
7777

78-
abstract logName(log: Logger, options?: RenderItemLogOptions): void;
78+
abstract logName(log: Logger, options?: TreeLogOptions): void;
7979

8080
abstract getLogSymbol(): string;
8181

82-
log(options?: RenderItemLogOptions, log?: Logger) {
82+
log(options?: TreeLogOptions, log?: Logger) {
8383
const flush = !log;
8484

8585
log ||= new Logger();
@@ -154,7 +154,7 @@ export abstract class RenderItem {
154154
}
155155
}
156156

157-
export abstract class Box extends RenderItem {
157+
export abstract class Box extends TreeNode {
158158
public id: string;
159159
/**
160160
* General boolean bitfield shared by all box subclasses. The bits labeled
@@ -511,7 +511,7 @@ export abstract class Box extends RenderItem {
511511
}
512512
}
513513

514-
logName(log: Logger, options?: RenderItemLogOptions) {
514+
logName(log: Logger, options?: TreeLogOptions) {
515515
log.text('Box');
516516
}
517517

src/layout-flow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
sliceIfcRenderText
1616
} from './layout-text.ts';
1717
import {getImage} from './layout-image.ts';
18-
import {Box, FormattingBox, RenderItem} from './layout-box.ts';
18+
import {Box, FormattingBox, TreeNode} from './layout-box.ts';
1919

2020
import type {InlineMetrics, ShapedItem, InlineFragment} from './layout-text.ts';
2121
import type {BoxArea, PrelayoutContext} from './layout-box.ts';
@@ -1199,7 +1199,7 @@ export function layoutFloatBox(box: BlockLevel, ctx: LayoutContext) {
11991199
}
12001200
}
12011201

1202-
export class Break extends RenderItem {
1202+
export class Break extends TreeNode {
12031203
public className = 'break';
12041204

12051205
isBreak(): this is Break {

src/layout-text.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {basename, loggableText, Logger} from './util.ts';
2-
import {Box, RenderItem} from './layout-box.ts';
2+
import {Box, TreeNode} from './layout-box.ts';
33
import {Style} from './style.ts';
44
import {
55
ReplacedBox,
@@ -19,7 +19,7 @@ import {createItemizeState, itemizeNext} from './text-itemize.ts';
1919

2020
import type {LoadedFontFace} from './text-font.ts';
2121
import type {HbFace, HbFont} from './text-harfbuzz.ts';
22-
import type {RenderItemLogOptions} from './layout-box.ts';
22+
import type {TreeLogOptions} from './layout-box.ts';
2323
import type {TextAlign, WhiteSpace} from './style.ts';
2424
import type {BlockLevel, InlineLevel, BlockContainer, LayoutContext} from './layout-flow.ts';
2525

@@ -70,7 +70,7 @@ export function prevGrapheme(text: string, index: number) {
7070
return graphemeStart < index ? graphemeStart : index;
7171
}
7272

73-
export class Run extends RenderItem {
73+
export class Run extends TreeNode {
7474
public textStart: number;
7575
public textEnd: number;
7676

@@ -111,7 +111,7 @@ export class Run extends RenderItem {
111111
return true;
112112
}
113113

114-
logName(log: Logger, options?: RenderItemLogOptions) {
114+
logName(log: Logger, options?: TreeLogOptions) {
115115
log.text(`${this.textStart},${this.textEnd}`);
116116
if (options?.paragraphText) {
117117
log.text(` "${loggableText(options.paragraphText.slice(this.textStart, this.textEnd))}"`);

0 commit comments

Comments
 (0)