User:A1kmm/TextRun

From MozillaWiki
Jump to: navigation, search

Overview

This page is initially intended as a scratch-pad for which I can put my initial notes on text layout, and will be quite disorganised at this point. As I read the code I plan to update it and eventually get it to something which can be moved out of the User area and be used by others. Until then, note that some (most? all?) of the information here is probably wrong because I am not a layout expert and it hasn't been reviewed by anyone who is. Corrections are of course welcome.

Types of objects involved

nsTextFrame

A text frame represents a contiguous run of characters with the same style and the same content text node (although initially there may be features like first letter styles).

Text frames can be split into smaller frames and the text divided up between 'sibling frames' (and therefore, there can be several text frames for the same content text node).

nsLineLayout

nsLineLayout describes the state of the reflow of a series of lines (lines in the sense of space on the screen). The state does not hold any information about exactly what lines of text are associated with which line on the screen.

TextRunMappedFlow

TextRunUserData

gfxTextRun

Reflow process

This summary misses out a few corner cases to simplify the most common paths through the code. Refer to the code itself for the full details.

 * State bits which are used during and after the reflow are reset so they can be re-computed during reflow.
 * The total amount of content in the current frame (which is less than or equal to the length of the content text node) is assigned into maxContentLength to set an upper bound on this.