Documentation
¶
Overview ¶
Package boxes defines the basic elements of the formatting structure, as a tree of boxes.
This tree is build from an HTML document by this package, but the boxes are not correctly positionned yet (see the layout package).
Index ¶
- Constants
- Variables
- func HitArea(box Box) pr.Rectangle
- func IsInput(box Box) bool
- func IsMonolithic(box Box) bool
- func ProcessTextTransform(box Box)
- func ProcessWhitespace(box Box, followingCollapsibleSpace bool) bool
- func SerializedBoxEquals(l1, l2 []SerBox) bool
- func UpdateCounters(state *tree.PageState, style pr.ElementStyle)
- type Area
- type AtomicInlineLevelBoxITF
- type BC
- type Background
- type BackgroundLayer
- type Bleed
- type BlockBox
- type BlockBoxITF
- type BlockContainerBoxITF
- type BlockLevelBox
- type BlockLevelBoxITF
- type BlockReplacedBox
- type BlockReplacedBoxITF
- type Border
- type BorderGrids
- type Box
- func AnonymousTableBoxes(box Box) Box
- func BlockInInline(box Box) Box
- func ContentToBoxes(style pr.ElementStyle, parentBox Box, quoteDepth []int, ...) []Box
- func CopyWithChildren(box Box, newChildren []Box) Box
- func CreateAnonymousBox(box Box) Box
- func Deepcopy(b Box) Box
- func Descendants(b Box) []Box
- func DescendantsPlaceholders(b Box, placeholders bool) []Box
- func FlexBoxes(box Box) Box
- func GridBoxes(box Box) Box
- func InlineInBlock(box Box) Box
- func LineBoxAnonymousFrom(parent Box, children []Box) Box
- type BoxFields
- func (box *BoxFields) AllChildren() []Box
- func (b *BoxFields) BorderBoxX() pr.Float
- func (b *BoxFields) BorderBoxY() pr.Float
- func (b *BoxFields) BorderHeight() pr.Float
- func (b *BoxFields) BorderWidth() pr.Float
- func (box *BoxFields) CachedCounterValues() tree.CounterValues
- func (box *BoxFields) ContainingBlock() (width, height pr.MaybeFloat)
- func (b *BoxFields) ContentBoxX() pr.Float
- func (b *BoxFields) ContentBoxY() pr.Float
- func (box *BoxFields) ElementTag() string
- func (box *BoxFields) GetBookmarkLabel() string
- func (box *BoxFields) GetWrappedTable() TableBoxITF
- func (b *BoxFields) IsAbsolutelyPositioned() bool
- func (box *BoxFields) IsAttachment() bool
- func (b *BoxFields) IsFloated() bool
- func (b *BoxFields) IsFootnote() bool
- func (b *BoxFields) IsInNormalFlow() bool
- func (b *BoxFields) IsRunning() bool
- func (b *BoxFields) MarginHeight() pr.Float
- func (b *BoxFields) MarginWidth() pr.Float
- func (box *BoxFields) MissingLink() tree.Box
- func (b *BoxFields) PaddingBoxX() pr.Float
- func (b *BoxFields) PaddingBoxY() pr.Float
- func (b *BoxFields) PaddingHeight() pr.Float
- func (b *BoxFields) PaddingWidth() pr.Float
- func (b *BoxFields) PageValues() (pr.Page, pr.Page)
- func (*BoxFields) RemoveDecoration(box *BoxFields, start, end bool)
- func (b *BoxFields) ResetSpacing(side Side)
- func (b *BoxFields) RoundedBorderBox() RoundedBox
- func (b *BoxFields) RoundedBoxRatio(ratio pr.Float) RoundedBox
- func (b *BoxFields) RoundedContentBox() RoundedBox
- func (b *BoxFields) RoundedPaddingBox() RoundedBox
- func (box *BoxFields) SetCachedCounterValues(cv tree.CounterValues)
- func (box *BoxFields) SetMissingLink(b tree.Box)
- func (BoxFields) Translate(box Box, dx, dy pr.Float, ignoreFloats bool)
- type BoxITF
- type BoxType
- type Context
- type FlexBox
- type FlexBoxITF
- type FlexContainerBoxITF
- type FootnoteAreaBox
- type FootnoteAreaBoxITF
- type GridBox
- type GridBoxITF
- type GridContainerBoxITF
- type ImageFetcher
- type InlineBlockBox
- type InlineBlockBoxITF
- type InlineBox
- type InlineBoxITF
- type InlineFlexBox
- type InlineFlexBoxITF
- type InlineGridBox
- type InlineGridBoxITF
- type InlineLevelBox
- type InlineLevelBoxITF
- type InlineReplacedBox
- type InlineReplacedBoxITF
- type InlineTableBox
- type InlineTableBoxITF
- type LineBox
- type LineBoxITF
- type MarginBox
- type MarginBoxITF
- type MaybePoint
- type PageBox
- type PageBoxITF
- type ParentBoxITF
- type Point
- type Position
- type Repeat
- type ReplacedBox
- type ReplacedBoxITF
- type RoundedBox
- type Score
- type SerBox
- type Side
- type TableBox
- type TableBoxITF
- type TableCaptionBox
- type TableCaptionBoxITF
- type TableCellBox
- type TableCellBoxITF
- type TableColumnBox
- type TableColumnBoxITF
- type TableColumnGroupBox
- type TableColumnGroupBoxITF
- type TableRowBox
- type TableRowBoxITF
- type TableRowGroupBox
- type TableRowGroupBoxITF
- type TextBox
- type TextBoxITF
- type URLResolver
Constants ¶
const ( AbsolutePlaceholderT = BoxType(0xFF - 2) StackingContextT = BoxType(0xFF - 1) )
Variables ¶
Functions ¶
func IsMonolithic ¶ added in v0.0.10
Return whether this box is monolithic. See https://www.w3.org/TR/css-break-3/#monolithic
func ProcessTextTransform ¶
func ProcessTextTransform(box Box)
func ProcessWhitespace ¶
ProcessWhitespace executes the first part of "The 'white-space' processing model". See https://www.w3.org/TR/CSS21/text.html#white-space-model and https://drafts.csswg.org/css-text-3/#white-space-rules The default value of followingCollapsibleSpace shoud be `false`.
func SerializedBoxEquals ¶
func UpdateCounters ¶
func UpdateCounters(state *tree.PageState, style pr.ElementStyle)
Handle the “counter-*“ properties.
Types ¶
type AtomicInlineLevelBoxITF ¶
type AtomicInlineLevelBoxITF interface { InlineLevelBoxITF // contains filtered or unexported methods }
An atomic box in an inline formatting context. This inline-level box cannot be split for line breaks.
type Background ¶
type Background struct { ImageRendering pr.String Layers []BackgroundLayer Color parser.RGBA }
type BackgroundLayer ¶
type BlockBox ¶
type BlockBox struct { BlockLevelBox BoxFields }
func BlockBoxAnonymousFrom ¶
func NewBlockBox ¶
type BlockBoxITF ¶
type BlockBoxITF interface { BlockContainerBoxITF BlockLevelBoxITF // contains filtered or unexported methods }
A block-level box that is also a block container. A non-replaced element with a “display“ value of “block“, “list-item“ generates a block box.
type BlockContainerBoxITF ¶
type BlockContainerBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
A box that contains only block-level boxes or only line boxes. A box that either contains only block-level boxes or establishes an inline formatting context and thus contains only line boxes. A non-replaced element with a “display“ value of “block“, “list-item“, “inline-block“ or 'table-cell' generates a block container box.
type BlockLevelBox ¶
type BlockLevelBox struct {
Clearance pr.MaybeFloat
}
func (*BlockLevelBox) BlockLevel ¶
func (b *BlockLevelBox) BlockLevel() *BlockLevelBox
type BlockLevelBoxITF ¶
type BlockLevelBoxITF interface { BoxITF // contains filtered or unexported methods }
A box that participates in an block formatting context. An element with a “display“ value of “block“, “list-item“ or “table“ generates a block-level box.
func BuildFormattingStructure ¶
func BuildFormattingStructure(elementTree *utils.HTMLNode, styleFor *tree.StyleFor, resolver URLResolver, baseUrl string, targetCollector *tree.TargetCollector, cs counters.CounterStyle, footnotes *[]Box, ) BlockLevelBoxITF
Build a formatting structure (box tree) from an element tree.
type BlockReplacedBox ¶
type BlockReplacedBox struct { BlockLevelBox ReplacedBox }
func NewBlockReplacedBox ¶
func NewBlockReplacedBox(style pr.ElementStyle, element *html.Node, pseudoType string, replacement images.Image) BlockReplacedBox
func (*BlockReplacedBox) Box ¶
func (b *BlockReplacedBox) Box() *BoxFields
func (BlockReplacedBox) Copy ¶
func (b BlockReplacedBox) Copy() Box
func (BlockReplacedBox) Type ¶
func (BlockReplacedBox) Type() BoxType
type BlockReplacedBoxITF ¶
type BlockReplacedBoxITF interface { BlockLevelBoxITF ReplacedBoxITF // contains filtered or unexported methods }
A box that is both replaced and block-level. A replaced element with a “display“ value of “block“, “liste-item“ or “table“ generates a block-level replaced box.
type BorderGrids ¶
type BorderGrids struct {
Vertical, Horizontal [][]Border
}
type Box ¶
type Box interface { tree.Box Type() BoxType Box() *BoxFields Copy() Box AllChildren() []Box Translate(box Box, dx, dy pr.Float, ignoreFloats bool) RemoveDecoration(box *BoxFields, isStart, isEnd bool) PageValues() (pr.Page, pr.Page) }
Box is the common interface grouping all possible boxes
func AnonymousTableBoxes ¶
Remove and add boxes according to the table model.
Take and return a “Box“ object.
func BlockInInline ¶
Build the structure of blocks inside lines.
Inline boxes containing block-level boxes will be broken in two boxes on each side on consecutive block-level boxes, each side wrapped in an anonymous block-level box.
This is the second case in https://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level
Eg. if this is given:: BlockBox[ LineBox[ InlineBox[ TextBox["Hello."], ], InlineBox[ TextBox["Some "], InlineBox[ TextBox["text"] BlockBox[LineBox[TextBox["More text"]]], BlockBox[LineBox[TextBox["More text again"]]], ], BlockBox[LineBox[TextBox["And again."]]], ] ] ] this is returned:: BlockBox[ AnonymousBlockBox[ LineBox[ InlineBox[ TextBox["Hello."], ], InlineBox[ TextBox["Some "], InlineBox[TextBox["text"]], ] ] ], BlockBox[LineBox[TextBox["More text"]]], BlockBox[LineBox[TextBox["More text again"]]], AnonymousBlockBox[ LineBox[ InlineBox[ ] ] ], BlockBox[LineBox[TextBox["And again."]]], AnonymousBlockBox[ LineBox[ InlineBox[ ] ] ], ]
func ContentToBoxes ¶
func ContentToBoxes(style pr.ElementStyle, parentBox Box, quoteDepth []int, counterValues tree.CounterValues, resolver URLResolver, targetCollector *tree.TargetCollector, cs counters.CounterStyle, context Context, page Box, ) []Box
Takes the value of a “content“ property and yield boxes.
func CopyWithChildren ¶
Create a new equivalent box (preserving the concrete type) with given [newChildren].
func CreateAnonymousBox ¶ added in v0.0.2
CreateAnonymousBox create anonymous boxes in box descendants according to layout rules.
func Descendants ¶
Descendants returns `b` and its children, and their children, etc...
func DescendantsPlaceholders ¶ added in v0.0.10
func FlexBoxes ¶
Remove and add boxes according to the flex model. See https://www.w3.org/TR/css-flexbox-1/#flex-items
func GridBoxes ¶ added in v0.0.10
Remove and add boxes according to the grid model. See https://drafts.csswg.org/css-grid-2/#grid-item
func InlineInBlock ¶
Build the structure of lines inside blocks and return a new box tree.
Consecutive inline-level boxes in a block container box are wrapped into a line box, itself wrapped into an anonymous block box.
This line box will be broken into multiple lines later.
This is the first case in https://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level
Example:
BlockBox[ TextBox["Some "], InlineBox[TextBox["text"]], BlockBox[ TextBox["More text"], ] ]
is turned into::
BlockBox[ AnonymousBlockBox[ LineBox[ TextBox["Some "], InlineBox[TextBox["text"]], ] ] BlockBox[ LineBox[ TextBox["More text"], ] ] ]
func LineBoxAnonymousFrom ¶
type BoxFields ¶
type BoxFields struct { // Original html node, needed for post-processing. // May be nil, like for PageBox and MarginBox Element *html.Node PseudoType string // Keep track of removed collapsing spaces for wrap opportunities. LeadingCollapsibleSpace bool TrailingCollapsibleSpace bool // Default, may be overriden on instances. IsTableWrapper bool IsFlexItem bool IsGridItem bool IsForRootElement bool IsColumn bool IsLeader bool BookmarkLabel string StringSet pr.ContentProperties Style pr.ElementStyle FirstLetterStyle pr.ElementStyle PositionX, PositionY pr.Float Width, Height, MinWidth, MaxWidth, MinHeight, MaxHeight pr.MaybeFloat Top, Bottom, Left, Right pr.MaybeFloat MarginTop, MarginBottom, MarginLeft, MarginRight pr.MaybeFloat PaddingTop, PaddingBottom, PaddingLeft, PaddingRight pr.MaybeFloat BorderTopWidth, BorderRightWidth, BorderBottomWidth, BorderLeftWidth pr.Float BorderTopLeftRadius, BorderTopRightRadius, BorderBottomRightRadius, BorderBottomLeftRadius Point ViewportOverflow string Children []Box Footnote Box Baseline pr.MaybeFloat ComputedHeight pr.MaybeFloat ContentHeight pr.Float VerticalAlign string // For table cells, [true] when no children is either floated or in normal flow Empty bool Colspan int Rowspan int GridX int Index int FlexBasis pr.DimOrS FlexBaseSize, TargetMainSize, Adjustment, HypotheticalMainSize pr.Float FlexFactor, ScaledFlexShrinkFactor pr.Float Frozen bool GetCells func() []Box // closure which may have default implementation or be set Background *Background RemoveDecorationSides [4]bool BorderImage images.Image // contains filtered or unexported fields }
BoxFields is an abstract base class for all boxes.
func (*BoxFields) AllChildren ¶
func (*BoxFields) BorderBoxX ¶
Absolute horizontal position of the border box.
func (*BoxFields) BorderBoxY ¶
Absolute vertical position of the border box.
func (*BoxFields) BorderHeight ¶
Height of the border box.
func (*BoxFields) CachedCounterValues ¶
func (box *BoxFields) CachedCounterValues() tree.CounterValues
func (*BoxFields) ContainingBlock ¶
func (box *BoxFields) ContainingBlock() (width, height pr.MaybeFloat)
ContainingBlock implements an interface required for layout.
func (*BoxFields) ContentBoxX ¶
Absolute horizontal position of the content box.
func (*BoxFields) ContentBoxY ¶
Absolute vertical position of the content box.
func (*BoxFields) ElementTag ¶
ElementTag returns the html tag name of the element and an optionnal pseudo type (in the form tag::pseudoType)
func (*BoxFields) GetBookmarkLabel ¶
func (*BoxFields) GetWrappedTable ¶
func (box *BoxFields) GetWrappedTable() TableBoxITF
func (*BoxFields) IsAbsolutelyPositioned ¶
Return whether this box is in the absolute positioning scheme.
func (*BoxFields) IsAttachment ¶
Return whether this link should be stored as a PDF attachment
func (*BoxFields) IsFootnote ¶ added in v0.0.2
Return whether this box is a footnote.
func (*BoxFields) IsInNormalFlow ¶
Return whether this box is in normal flow.
func (*BoxFields) MarginHeight ¶
Height of the margin box (aka. outer box).
func (*BoxFields) MarginWidth ¶
Width of the margin box (aka. outer box).
func (*BoxFields) MissingLink ¶
func (*BoxFields) PaddingBoxX ¶
Absolute horizontal position of the padding box.
func (*BoxFields) PaddingBoxY ¶
Absolute vertical position of the padding box.
func (*BoxFields) PaddingHeight ¶
Height of the padding box.
func (*BoxFields) PaddingWidth ¶
Width of the padding box.
func (*BoxFields) PageValues ¶
Return start and end page values.
func (*BoxFields) RemoveDecoration ¶
func (*BoxFields) ResetSpacing ¶
Set to 0 the margin, padding and border of “side“.
func (*BoxFields) RoundedBorderBox ¶
func (b *BoxFields) RoundedBorderBox() RoundedBox
Return the position, size and radii of the rounded border box.
func (*BoxFields) RoundedBoxRatio ¶
func (b *BoxFields) RoundedBoxRatio(ratio pr.Float) RoundedBox
func (*BoxFields) RoundedContentBox ¶
func (b *BoxFields) RoundedContentBox() RoundedBox
Return the position, size and radii of the rounded content box.
func (*BoxFields) RoundedPaddingBox ¶
func (b *BoxFields) RoundedPaddingBox() RoundedBox
Return the position, size and radii of the rounded padding box.
func (*BoxFields) SetCachedCounterValues ¶
func (box *BoxFields) SetCachedCounterValues(cv tree.CounterValues)
func (*BoxFields) SetMissingLink ¶
type BoxType ¶
type BoxType uint8
BoxType represents a box type.
const ( AtomicInlineLevelT BoxType BlockT BlockContainerT BlockLevelT BlockReplacedT T FlexT FlexContainerT FootnoteAreaT GridT GridContainerT InlineBlockT InlineT InlineFlexT InlineGridT InlineLevelT InlineReplacedT InlineTableT LineT MarginT PageT ParentT ReplacedT TableT TableCaptionT TableCellT TableColumnT TableColumnGroupT TableRowT TableRowGroupT TextT )
func (BoxType) IsClassical ¶ added in v0.0.10
IsClassical returns true for all standard boxes defined in this package, but false for the special ones, defined in other packages, like AbsolutePlaceholder or StackingContext.
func (BoxType) IsInProperParents ¶
IsInProperParents returns true if `t` is one of the the proper parents of `type_`
func (BoxType) IsInstance ¶
Returns true is the box is an instance of t.
type FlexBox ¶
type FlexBox struct { BlockLevelBox BoxFields }
func FlexBoxAnonymousFrom ¶
func NewFlexBox ¶
type FlexBoxITF ¶
type FlexBoxITF interface { BlockLevelBoxITF FlexContainerBoxITF // contains filtered or unexported methods }
A box that is both block-level and a flex container. It behaves as block on the outside and as a flex container on the inside.
type FlexContainerBoxITF ¶
type FlexContainerBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
A box that contains only flex-items.
type FootnoteAreaBox ¶ added in v0.0.2
Box displaying footnotes, as defined in GCPM.
func NewFootnoteAreaBox ¶ added in v0.0.2
func NewFootnoteAreaBox(page *PageBox, style pr.ElementStyle) *FootnoteAreaBox
func (*FootnoteAreaBox) Box ¶ added in v0.0.2
func (b *FootnoteAreaBox) Box() *BoxFields
func (FootnoteAreaBox) Copy ¶ added in v0.0.2
func (b FootnoteAreaBox) Copy() Box
func (FootnoteAreaBox) Type ¶ added in v0.0.2
func (FootnoteAreaBox) Type() BoxType
type FootnoteAreaBoxITF ¶ added in v0.0.2
type FootnoteAreaBoxITF interface { BlockBoxITF // contains filtered or unexported methods }
Box displaying footnotes, as defined in GCPM.
type GridBox ¶ added in v0.0.10
type GridBox struct { BlockLevelBox BoxFields }
func GridBoxAnonymousFrom ¶ added in v0.0.10
func NewGridBox ¶ added in v0.0.10
type GridBoxITF ¶ added in v0.0.10
type GridBoxITF interface { BlockLevelBoxITF GridContainerBoxITF // contains filtered or unexported methods }
A box that is both block-level and a grid container. It behaves as block on the outside and as a grid container on the inside.
type GridContainerBoxITF ¶ added in v0.0.10
type GridContainerBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
A box that contains only grid-items.
type ImageFetcher ¶ added in v0.0.10
type ImageFetcher = func(url, forcedMimeType string, orientation pr.SBoolFloat) images.Image
type InlineBlockBox ¶
type InlineBlockBox struct {
BoxFields
}
func InlineBlockBoxAnonymousFrom ¶
func InlineBlockBoxAnonymousFrom(parent Box, children []Box) *InlineBlockBox
func NewInlineBlockBox ¶
func NewInlineBlockBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *InlineBlockBox
func (*InlineBlockBox) Box ¶
func (b *InlineBlockBox) Box() *BoxFields
func (InlineBlockBox) Copy ¶
func (b InlineBlockBox) Copy() Box
func (InlineBlockBox) Type ¶
func (InlineBlockBox) Type() BoxType
type InlineBlockBoxITF ¶
type InlineBlockBoxITF interface { AtomicInlineLevelBoxITF BlockContainerBoxITF // contains filtered or unexported methods }
A box that is both inline-level and a block container. It behaves as inline on the outside and as a block on the inside. A non-replaced element with a 'display' value of 'inline-block' generates an inline-block box.
type InlineBox ¶
type InlineBox struct { InlineLevelBox BoxFields }
func InlineBoxAnonymousFrom ¶
func NewInlineBox ¶
func (InlineBox) RemoveDecoration ¶
type InlineBoxITF ¶
type InlineBoxITF interface { InlineLevelBoxITF ParentBoxITF // contains filtered or unexported methods }
An inline box with inline children. A box that participates in an inline formatting context and whose content also participates in that inline formatting context. A non-replaced element with a “display“ value of “inline“ generates an inline box.
type InlineFlexBox ¶
type InlineFlexBox struct { InlineLevelBox BoxFields }
func InlineFlexBoxAnonymousFrom ¶
func InlineFlexBoxAnonymousFrom(parent Box, children []Box) *InlineFlexBox
func NewInlineFlexBox ¶
func NewInlineFlexBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *InlineFlexBox
func (*InlineFlexBox) Box ¶
func (b *InlineFlexBox) Box() *BoxFields
func (InlineFlexBox) Copy ¶
func (b InlineFlexBox) Copy() Box
func (InlineFlexBox) RemoveDecoration ¶
func (u InlineFlexBox) RemoveDecoration(b *BoxFields, start, end bool)
func (InlineFlexBox) Type ¶
func (InlineFlexBox) Type() BoxType
type InlineFlexBoxITF ¶
type InlineFlexBoxITF interface { FlexContainerBoxITF InlineLevelBoxITF // contains filtered or unexported methods }
A box that is both inline-level and a flex container. It behaves as inline on the outside and as a flex container on the inside.
type InlineGridBox ¶ added in v0.0.10
type InlineGridBox struct { InlineLevelBox BoxFields }
func InlineGridBoxAnonymousFrom ¶ added in v0.0.10
func InlineGridBoxAnonymousFrom(parent Box, children []Box) *InlineGridBox
func NewInlineGridBox ¶ added in v0.0.10
func NewInlineGridBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *InlineGridBox
func (*InlineGridBox) Box ¶ added in v0.0.10
func (b *InlineGridBox) Box() *BoxFields
func (InlineGridBox) Copy ¶ added in v0.0.10
func (b InlineGridBox) Copy() Box
func (InlineGridBox) RemoveDecoration ¶ added in v0.0.10
func (u InlineGridBox) RemoveDecoration(b *BoxFields, start, end bool)
func (InlineGridBox) Type ¶ added in v0.0.10
func (InlineGridBox) Type() BoxType
type InlineGridBoxITF ¶ added in v0.0.10
type InlineGridBoxITF interface { GridContainerBoxITF InlineLevelBoxITF // contains filtered or unexported methods }
A box that is both inline-level and a grid container. It behaves as inline on the outside and as a grid container on the inside.
type InlineLevelBox ¶
type InlineLevelBox struct{}
func (*InlineLevelBox) RemoveDecoration ¶
func (*InlineLevelBox) RemoveDecoration(box *BoxFields, start, end bool)
type InlineLevelBoxITF ¶
type InlineLevelBoxITF interface { BoxITF // contains filtered or unexported methods }
A box that participates in an inline formatting context. An inline-level box that is not an inline box is said to be "atomic". Such boxes are inline blocks, replaced elements and inline tables. An element with a “display“ value of “inline“, “inline-table“, or “inline-block“ generates an inline-level box.
type InlineReplacedBox ¶
type InlineReplacedBox struct {
ReplacedBox
}
func InlineReplacedBoxAnonymousFrom ¶
func InlineReplacedBoxAnonymousFrom(parent Box, replacement images.Image) *InlineReplacedBox
func NewInlineReplacedBox ¶
func NewInlineReplacedBox(style pr.ElementStyle, element *html.Node, pseudoType string, replacement images.Image) InlineReplacedBox
func (*InlineReplacedBox) Box ¶
func (b *InlineReplacedBox) Box() *BoxFields
func (InlineReplacedBox) Copy ¶
func (b InlineReplacedBox) Copy() Box
func (InlineReplacedBox) RemoveDecoration ¶
func (u InlineReplacedBox) RemoveDecoration(b *BoxFields, start, end bool)
func (InlineReplacedBox) Type ¶
func (InlineReplacedBox) Type() BoxType
type InlineReplacedBoxITF ¶
type InlineReplacedBoxITF interface { AtomicInlineLevelBoxITF ReplacedBoxITF // contains filtered or unexported methods }
A box that is both replaced and inline-level. A replaced element with a “display“ value of “inline“, “inline-table“, or “inline-block“ generates an inline-level replaced box.
type InlineTableBox ¶
type InlineTableBox struct {
TableBox
}
func InlineTableBoxAnonymousFrom ¶
func InlineTableBoxAnonymousFrom(parent Box, children []Box) *InlineTableBox
func NewInlineTableBox ¶
func NewInlineTableBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *InlineTableBox
func (*InlineTableBox) Box ¶
func (b *InlineTableBox) Box() *BoxFields
func (InlineTableBox) Copy ¶
func (b InlineTableBox) Copy() Box
func (InlineTableBox) Type ¶
func (InlineTableBox) Type() BoxType
type InlineTableBoxITF ¶
type InlineTableBoxITF interface { TableBoxITF // contains filtered or unexported methods }
Box for elements with “display: inline-table“
type LineBox ¶
type LineBox struct { BoxFields ResumeAt tree.ResumeStack TextIndent pr.MaybeFloat TextOverflow string BlockEllipsis pr.TaggedString }
func NewLineBox ¶
type LineBoxITF ¶
type LineBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
A box that represents a line in an inline formatting context. Can only contain inline-level boxes. In early stages of building the box tree a single line box contains many consecutive inline boxes. Later, during layout phase, each line boxes will be split into multiple line boxes, one for each actual line.
type MarginBox ¶
func NewMarginBox ¶
func NewMarginBox(atKeyword string, style pr.ElementStyle) *MarginBox
type MarginBoxITF ¶
type MarginBoxITF interface { BlockContainerBoxITF // contains filtered or unexported methods }
Box in page margins, as defined in CSS3 Paged Media
type MaybePoint ¶
type MaybePoint [2]pr.MaybeFloat
func (MaybePoint) V ¶
func (mp MaybePoint) V() Point
type PageBox ¶
type PageBox struct { BoxFields CanvasBackground *Background FixedBoxes []Box PageType utils.PageElement }
func NewPageBox ¶
func NewPageBox(pageType utils.PageElement, style pr.ElementStyle) *PageBox
type PageBoxITF ¶
type PageBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
Box for a page. Initially the whole document will be in the box for the root element. During layout a new page box is created after every page break.
type ParentBoxITF ¶
type ParentBoxITF interface { BoxITF // contains filtered or unexported methods }
A box that has children.
type Position ¶
type Position struct { Point MaybePoint String string }
type ReplacedBox ¶
func NewReplacedBox ¶
func NewReplacedBox(style pr.ElementStyle, element *html.Node, pseudoType string, replacement images.Image) ReplacedBox
func (*ReplacedBox) Box ¶
func (b *ReplacedBox) Box() *BoxFields
func (ReplacedBox) Copy ¶
func (b ReplacedBox) Copy() Box
func (*ReplacedBox) Replaced ¶
func (b *ReplacedBox) Replaced() *ReplacedBox
func (ReplacedBox) Type ¶
func (ReplacedBox) Type() BoxType
type ReplacedBoxITF ¶
type ReplacedBoxITF interface { BoxITF // contains filtered or unexported methods }
A box whose content is replaced. For example, “<img>“ are replaced: their content is rendered externally and is opaque from CSS’s point of view.
type RoundedBox ¶
type TableBox ¶
type TableBox struct { BoxFields BlockLevelBox ColumnWidths, ColumnPositions []pr.Float ColumnGroups []*TableColumnGroupBox CollapsedBorderGrid BorderGrids SkippedRows int SkipCellBorderTop, SkipCellBorderBottom bool }
func NewTableBox ¶
func TableBoxAnonymousFrom ¶
func (*TableBox) AllChildren ¶
type TableBoxITF ¶
type TableBoxITF interface { BlockLevelBoxITF ParentBoxITF // contains filtered or unexported methods }
Box for elements with “display: table“
type TableCaptionBox ¶
type TableCaptionBox struct {
BlockBox
}
func NewTableCaptionBox ¶
func NewTableCaptionBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *TableCaptionBox
func TableCaptionBoxAnonymousFrom ¶
func TableCaptionBoxAnonymousFrom(parent Box, children []Box) *TableCaptionBox
func (*TableCaptionBox) Box ¶
func (b *TableCaptionBox) Box() *BoxFields
func (TableCaptionBox) Copy ¶
func (b TableCaptionBox) Copy() Box
func (TableCaptionBox) Type ¶
func (TableCaptionBox) Type() BoxType
type TableCaptionBoxITF ¶
type TableCaptionBoxITF interface { BlockBoxITF // contains filtered or unexported methods }
Box for elements with “display: table-caption“
type TableCellBox ¶
type TableCellBox struct {
BoxFields
}
func NewTableCellBox ¶
func NewTableCellBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *TableCellBox
func TableCellBoxAnonymousFrom ¶
func TableCellBoxAnonymousFrom(parent Box, children []Box) *TableCellBox
func (*TableCellBox) Box ¶
func (b *TableCellBox) Box() *BoxFields
func (TableCellBox) Copy ¶
func (b TableCellBox) Copy() Box
func (TableCellBox) Type ¶
func (TableCellBox) Type() BoxType
type TableCellBoxITF ¶
type TableCellBoxITF interface { BlockContainerBoxITF // contains filtered or unexported methods }
Box for elements with “display: table-cell“
type TableColumnBox ¶
type TableColumnBox struct {
BoxFields
}
func NewTableColumnBox ¶
func NewTableColumnBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *TableColumnBox
func TableColumnBoxAnonymousFrom ¶
func TableColumnBoxAnonymousFrom(parent Box, children []Box) *TableColumnBox
func (*TableColumnBox) Box ¶
func (b *TableColumnBox) Box() *BoxFields
func (TableColumnBox) Copy ¶
func (b TableColumnBox) Copy() Box
func (TableColumnBox) Type ¶
func (TableColumnBox) Type() BoxType
type TableColumnBoxITF ¶
type TableColumnBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
Box for elements with “display: table-column“
type TableColumnGroupBox ¶
type TableColumnGroupBox struct {
BoxFields
}
func NewTableColumnGroupBox ¶
func NewTableColumnGroupBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *TableColumnGroupBox
func TableColumnGroupBoxAnonymousFrom ¶
func TableColumnGroupBoxAnonymousFrom(parent Box, children []Box) *TableColumnGroupBox
func (*TableColumnGroupBox) Box ¶
func (b *TableColumnGroupBox) Box() *BoxFields
func (TableColumnGroupBox) Copy ¶
func (b TableColumnGroupBox) Copy() Box
func (TableColumnGroupBox) Type ¶
func (TableColumnGroupBox) Type() BoxType
type TableColumnGroupBoxITF ¶
type TableColumnGroupBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
Box for elements with “display: table-column-group“
type TableRowBox ¶
type TableRowBox struct {
BoxFields
}
func NewTableRowBox ¶
func NewTableRowBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *TableRowBox
func TableRowBoxAnonymousFrom ¶
func TableRowBoxAnonymousFrom(parent Box, children []Box) *TableRowBox
func (*TableRowBox) Box ¶
func (b *TableRowBox) Box() *BoxFields
func (TableRowBox) Copy ¶
func (b TableRowBox) Copy() Box
func (TableRowBox) Type ¶
func (TableRowBox) Type() BoxType
type TableRowBoxITF ¶
type TableRowBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
Box for elements with “display: table-row“
type TableRowGroupBox ¶
type TableRowGroupBox struct {
BoxFields
}
func NewTableRowGroupBox ¶
func NewTableRowGroupBox(style pr.ElementStyle, element *html.Node, pseudoType string, children []Box) *TableRowGroupBox
func TableRowGroupBoxAnonymousFrom ¶
func TableRowGroupBoxAnonymousFrom(parent Box, children []Box) *TableRowGroupBox
func (*TableRowGroupBox) Box ¶
func (b *TableRowGroupBox) Box() *BoxFields
func (TableRowGroupBox) Copy ¶
func (b TableRowGroupBox) Copy() Box
func (TableRowGroupBox) Type ¶
func (TableRowGroupBox) Type() BoxType
type TableRowGroupBoxITF ¶
type TableRowGroupBoxITF interface { ParentBoxITF // contains filtered or unexported methods }
Box for elements with “display: table-row-group“
type TextBox ¶
type TextBox struct { InlineLevelBox BoxFields TextLayout text.EngineLayout // setup during layout Text []rune }
func NewTextBox ¶
func TextBoxAnonymousFrom ¶
func (TextBox) CopyWithText ¶
Return a new TextBox identical to this one except for the text.
func (TextBox) RemoveDecoration ¶
type TextBoxITF ¶
type TextBoxITF interface { InlineLevelBoxITF // contains filtered or unexported methods }
A box that contains only text and has no box children. Any text in the document ends up in a text box. What CSS calls "anonymous inline boxes" are also text boxes.
type URLResolver ¶ added in v0.0.2
type URLResolver struct { Fetch utils.UrlFetcher FetchImage ImageFetcher }