It does this as follows:
Firstly it traverses through those nodes that form part of the fixed content and calculates the total cost of all the fixed content as well as the contribution that the fixed content makes to the total content cost. This traversal covers the root elements of the DissectableAreas but does not cover their contents. It also creates a list of any shard link elements so that they can be processed in the second phase.
It then traverses the contents of each DissectableArea in turn annotating each node with information needed by the dissector and also updating the total content cost.
The reason for separating this out into two phases is that the second phase has to determine whether the overhead of an element or the cost of a text node is variable, i.e. references shared content that is not referenced from within fixed content. Obviously it is not possible to know whether shared content is referred to from fixed content without first visiting all the fixed content.
After all the above has been done it then checks to make sure that the DissectableAreas have been initialised properly which means that all DissectableAreas have been initialised and that all of them have at least one next and one previous link.
Shard links must be outside a DissectableArea but must specify the DissectableArea that they belong to. These references are resolved by this class as part of its work.
The shard links towards their owning DissectableArea's overhead. They do not affect either the fixed content or total content costs.
|
|