Gecko:Continuation Model: Difference between revisions

Jump to navigation Jump to search
m
Add <code> block to make function names and class names easier to read.
(Replace mxr with searchfox, and update reflow status to reflect changes in bug 775624.)
m (Add <code> block to make function names and class names easier to read.)
Line 1: Line 1:
== Continuations in the Frame Tree ==
== Continuations in the Frame Tree ==


To render a DOM node, represented as nsIContent object, Gecko creates zero or more frames (nsIFrame objects). Each frame represents a rectangular area usually corresponding to the node's CSS box as described by the CSS specs. Simple elements are often representable with exactly one frame, but sometimes an element needs to be represented with more than one frame. For example, text breaking across lines:
To render a DOM node, represented as <code>nsIContent</code> object, Gecko creates zero or more frames (<code>nsIFrame</code> objects). Each frame represents a rectangular area usually corresponding to the node's CSS box as described by the CSS specs. Simple elements are often representable with exactly one frame, but sometimes an element needs to be represented with more than one frame. For example, text breaking across lines:
<pre>
<pre>
   xxxxxx AAAA
   xxxxxx AAAA
Line 24: Line 24:
Another case where a single DOM node is represented by multiple frames is when a text node contains bidirectional text (e.g. both Hebrew and English text). In this case, the text node and its inline ancestors are split so that each frame contains only unidirectional text.  
Another case where a single DOM node is represented by multiple frames is when a text node contains bidirectional text (e.g. both Hebrew and English text). In this case, the text node and its inline ancestors are split so that each frame contains only unidirectional text.  


The first frame for an element is called the '''primary frame'''. The other frames are called '''continuation frames'''. Primary frames are created by nsCSSFrameConstructor in response to content insertion notifications. Continuation frames are created during bidi resolution, and during reflow, when reflow detects that a content element cannot be fully laid out within the constraints assigned (e.g., when inline text will not fit within a particular width constraint, or when a block cannot be laid out within a particular height constraint).
The first frame for an element is called the '''primary frame'''. The other frames are called '''continuation frames'''. Primary frames are created by <code>nsCSSFrameConstructor</code> in response to content insertion notifications. Continuation frames are created during bidi resolution, and during reflow, when reflow detects that a content element cannot be fully laid out within the constraints assigned (e.g., when inline text will not fit within a particular width constraint, or when a block cannot be laid out within a particular height constraint).


Continuation frames created during reflow are called "fluid" continuations (or "in-flows"). Other continuation frames (currently, those created during bidi resolution), are, in contrast, "non-fluid". The NS_FRAME_IS_FLUID_CONTINUATION state bit indicates whether a continuation frame is fluid or not.
Continuation frames created during reflow are called "fluid" continuations (or "in-flows"). Other continuation frames (currently, those created during bidi resolution), are, in contrast, "non-fluid". The <code>NS_FRAME_IS_FLUID_CONTINUATION</code> state bit indicates whether a continuation frame is fluid or not.


The frames for an element are put in a doubly-linked list. The links are accessible via nsIFrame::GetNextContinuation and nsIFrame::GetPrevContinuation. If only fluid continuations are to be accessed, nsIFrame::GetNextInFlow and nsIFrame::GetPrevInFlow are used instead.
The frames for an element are put in a doubly-linked list. The links are accessible via <code>nsIFrame::GetNextContinuation</code> and <code>nsIFrame::GetPrevContinuation</code>. If only fluid continuations are to be accessed, <code>nsIFrame::GetNextInFlow</code> and <code>nsIFrame::GetPrevInFlow</code> are used instead.


The following diagram shows the relationship between the original frame tree considering just primary frames, and a possible layout with breaking and continuations:
The following diagram shows the relationship between the original frame tree considering just primary frames, and a possible layout with breaking and continuations:
Line 43: Line 43:


Certain kinds of frames create multiple child frames for the same content element:
Certain kinds of frames create multiple child frames for the same content element:
* nsSimplePageSequence creates multiple page children, each one associated with the entire document, separated by page breaks
* <code>nsSimplePageSequence</code> creates multiple page children, each one associated with the entire document, separated by page breaks
* nsColumnSetFrame creates multiple block children, each one associated with the column element, separated by column breaks
* <code>nsColumnSetFrame</code> creates multiple block children, each one associated with the column element, separated by column breaks
* nsBlockFrame creates multiple inline children, each one associated with the same inline element, separated by line breaks, or by changes in text direction
* <code>nsBlockFrame</code> creates multiple inline children, each one associated with the same inline element, separated by line breaks, or by changes in text direction
* nsTableColFrame creates non-fluid continuations for itself if it has span="N" and N > 1
* <code>nsTableColFrame</code> creates non-fluid continuations for itself if it has span="N" and N > 1


=== Overflow Container Continuations ===
=== Overflow Container Continuations ===
Confirmed users
886

edits

Navigation menu