Documentation ¶
Overview ¶
Package layout produces a render tree from a styled tree.
Overview ¶
Early draft, nothing useful here yet.
BSD License ¶
Copyright (c) 2017–2020, Norbert Pillmayer ¶
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of this software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
- Constants
- Variables
- func BoxTreeToLayoutTree(boxRoot *boxtree.PrincipalBox, view *View) (syn synthesizedParams)
- func CalcBlockWidths(c frame.Container, inherited inheritedParams) (syn synthesizedParams)
- func LayoutBlockFormattingContext(ctx frame.Context, flowRoot *frame.FlowRoot) *frame.Box
- func LayoutInlineFormattingContext(ctx frame.Context, flowRoot *frame.FlowRoot) *frame.Box
- func NewContextFor(c frame.Container) frame.Context
- func SolveWidthBottomUp(c frame.Container, enclosing dimen.Dimen) (*frame.Box, error)
- func T() tracing.Trace
- type BlockContext
- type Event
- type EventQ
- type EventType
- type InlineContext
- type Page
- type View
Constants ¶
const ( TypeBlockFormattingContext frame.FormattingContextType = 100 TypeInlineFormattingContext frame.FormattingContextType = 101 )
Variables ¶
var ErrEnclosingWidthNotFixed error = errors.New("enclosing width not fixed")
var ErrHeightNotFixed error = errors.New("height of context not determined")
var ErrNotAPercentageDimension error = errors.New("input dimension not a percentage dimension")
Functions ¶
func BoxTreeToLayoutTree ¶
func BoxTreeToLayoutTree(boxRoot *boxtree.PrincipalBox, view *View) (syn synthesizedParams)
func CalcBlockWidths ¶
Potentially recursive call to nested containers
func NewContextFor ¶
NewContextFor creates a formatting context for a container. If c already has a context set, this context will be returned.
func SolveWidthBottomUp ¶
Types ¶
type BlockContext ¶
type BlockContext struct {
frame.ContextBase
}
BlockContext establishes a CSS block formatting context.
“Block-level boxes are boxes that participate in a block formatting context. Each block-level element generates a principal block-level box that contains descendant boxes and generated content and is also the box involved in any positioning scheme. Some block-level elements may generate additional boxes in addition to the principal box [for example,]: 'list-item' elements. These additional boxes are placed with respect to the principal box.”
A new BFC will behave much like the outermost document in that it becomes a mini-layout inside the main layout. A BFC contains everything inside it, float and clear only apply to items inside the same formatting context, and margins only collapse between elements in the same formatting context.
func Block ¶
func Block(ctx frame.Context) *BlockContext
func NewBlockContext ¶
func NewBlockContext(c frame.Container, isRoot bool) *BlockContext
func (*BlockContext) AddContained ¶
func (ctx *BlockContext) AddContained(c frame.Container)
func (*BlockContext) Type ¶
func (ctx *BlockContext) Type() frame.FormattingContextType
type EventQ ¶
type EventQ struct {
// contains filtered or unexported fields
}
A EventQ implements heap.Interface and holds events.
func (*EventQ) Pop ¶
func (q *EventQ) Pop() interface{}
Pop is part of interface container/heap. Not intended for client use.
func (*EventQ) Push ¶
func (q *EventQ) Push(x interface{})
Push is part of interface container/heap. Not intended for client use.
type InlineContext ¶
type InlineContext struct { frame.ContextBase // contains filtered or unexported fields }
func Inline ¶
func Inline(ctx frame.Context) *InlineContext
func NewInlineContext ¶
func NewInlineContext(c frame.Container, isRoot bool) *InlineContext
func (*InlineContext) AddContained ¶
func (ctx *InlineContext) AddContained(c frame.Container)
func (*InlineContext) Type ¶
func (ctx *InlineContext) Type() frame.FormattingContextType