diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/doc/obsolete/layout-internals.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/doc/obsolete/layout-internals.html')
-rw-r--r-- | layout/doc/obsolete/layout-internals.html | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/layout/doc/obsolete/layout-internals.html b/layout/doc/obsolete/layout-internals.html new file mode 100644 index 000000000..916f943c3 --- /dev/null +++ b/layout/doc/obsolete/layout-internals.html @@ -0,0 +1,101 @@ +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="Author" content="Nisheeth Ranjan"> + <meta name="GENERATOR" content="Mozilla/4.5 [en]C-NSCP (WinNT; U) [Netscape]"> + <title>HTML Layout Internals</title> +</head> +<body> + +<h1> +HTML Layout Internals</h1> + +<h2> +Big picture</h2> +An HTML document comes in from netlib into the HTML parser. The parser +creates parser nodes and feeds them to the content sink. The content +sink constructs a content model that represents the hierarchical structure +of the document. As different sub-trees in the content model are +fully available, the stylesheet processor iterates over them and creates +the corresponding frame hierarchy. The frames recursively layout +and render themselves. +<p>The part that we are going to drill down into is the code in the block +and inline frame classes. Block and inline are the two primary display +types specified in CSS and are used in the layout of most of the HTML tags. +The table related tags have their own display types like "table-cell", +"table-row", etc. and their implementation is a separate topic in itself. +<h2> +Block and inline code</h2> +The main classes involved in the layout of HTML documents are nsBlockFrame +and nsInlineFrame, both of which inherit from nsContainerFrame (why?). +These classes are persistent across reflows and are organized in a hierarchy +to constitute the frame model of the Gecko system. The frame model +is derived by applying style and presentation semantics to the content +model. Each frame in the frame model has a one to one correspondence +with a rectangular region on the presentation context (screen, printer, +etc.) and contains the formatting information needed to render that rectangle. +The block and inline frame classes implement the nsIFrame and nsIHTMLReflow +interfaces. The nsIFrame interface contains methods for managing +child frames and linkage with sibling frames, accessing the style context +associated with the frame, painting the frame, and handling events that +are passed in from the widget hierarchy. The nsIHTMLReflow interface +inherits from the nsIReflow interface and adds methods related to word +breaking and whitespace querying. The nsIReflow interface defines +the Reflow() method that initiates the reflow process along with the +DidReflow() method that get calledafter the reflow process. +nsReflowState and nsReflowMetrics are parameters to +the templatized nsIReflow interface: the former is used to hold state during +reflow of a frame and the latter is used to return the frame's desired +size and alignment to the parent frame during the reflow process. +<p>nsBlockReflowContext and nsBlockReflowState both hold state information +during the reflow process. nsBlockReflowContext encapsulates the +state and algorithm for reflowing child block frames. nsBlockReflowState +contains state and methods used by a block frame to reflow itself. +Both these classes are instantiated once per block frame. +<p>The nsLineLayout class is the engine used by the block and inline frame +classes to layout themselves on a line. Frames get passed in to the +nsLineLayout class via the BeginSpan() and EndSpan() methods. Each +span represents a run of frames with the same style data (???). Other +methods exist on the nsLineLayout class to position and size the frames +on the current line. +<p>nsBlockBandData is the class used to manage the processing of the space-manager +(nsSpaceManager) band data. It provides HTML/CSS specific semantics +on top of the general space management facilities provided by nsSpaceManager. +<p>nsSpaceManager is a class that is told about regions that reserve space +and exposes methods to query for available space in a given band. +<p>The nsLineBox class represents a horizontal line of frames and is singly +linked to the next line box in the document. It is basically a container +of a frame list that share the property of being on the same line in the +formatted output of the document. +<p>The nsTextRun class holds on to a list of frames containing pieces of +text that form a logical text run. This is needed because a single +text run can occur on leaves at many levels of the document's content tree. +This class gives the text layout process an efficient way to get access +to text runs and, so, determine where word breaks should occur. +<h2> +Questions</h2> +What are anonymous blocks (nsBlockFrame.h)? +<br>What is the difference between a span and a band (nsLineLayout)? +<br>Why do nsBlockFrame and nsInlineFrame both inherit from nsContainerFrame? +<h2> +To Do</h2> + +<ol> +<li> +Provide more information about methods and state of each of the classes +above.</li> + +<li> +Give a description of how the above classes interact with each other as +a simple HTML document is laid out. Then, add in different features +to the HTML that exercise different areas of the code, like floats, anonymous +blocks, etc.</li> +</ol> + +</body> +</html> |