Table Reflow Internals
|
nsIStyleSet
, wrapped by similarly named ones on
nsIPresContext
:
ResolveStyleContextFor
: For elements.ResolvePseudoStyleContextFor
: for
pseudo-elements (:first-letter
,
:before
, etc.)ResolveStyleContextForNonElement
: skips rule
matching and uses root rule node (text frame optimization)StyleSetImpl::FileRules
, find the correct rule
node, and find a current child of the parent (“sibling
sharing”) or create a new child.FrameManager::ReResolveStyleContext
destroys and
recreates style contexts for existing frames (rule node pointer
immutable).ReResolveStyleContext
is messy because it needs to
create and parent style contexts correctly (sibling
sharing may not be the same) rather than just changing data.
[design flaw, again]nsIFrame::GetParentStyleContextFrame
.ReResolveStyleContext
calculates differences
(repaint, reflow, reframe, etc.) between style old and new style
contexts and does appropriate cleanupnsIStyleContext::CalcStyleDifference
, which
only computes differences for structs that have been
requested. (I'll call this the data-struct-based hint
mechanism.)nsIFrameManager::ComputeStyleChangeFor
processes the change list, which has been built to avoid
duplication.ReParentStyleContext
, used in a few
places (usually during frame construction), but it's broken (has
many bugs that ReResolveStyleContext
used
to have).ReResolveStyleContext
if the attribute has
an effect. nsIStyleSheet::AttributeAffectsStyle
(should be on nsIStyleRuleProcessor
).:hover
,
:active
, etc.) using
nsIStyleRuleProcessor::HasStateDependentStyle
,
which is much more accurate. The CSSRuleProcessor
implementation does a slightly modified form of selector
matching to implement it (includes matching on the middle of
selectors to catch p:hover a
).style
attribute (“inline
style”) changes in a different
way from other changes to style rules.nsIStyleRule
, since there could be an
!important
rule that overrides it, which would
allow dynamic changes to put the style attribute in multiple
places in the rule tree. However, we maintain a hashtable just
for inline style rules so that we don't have to walk the whole
tree to find the nodes.nsCSSFrameConstructor::AttributeChanged
only
reresolves style on the subtree of the element, just like other
attribute changes.AttributeChanged
just go straight to a
framechange, instead.nsIFrame::DidSetStyleContext
.PresShell::ReconstructStyleData
calls
FrameManager::ComputeStyleChangeFor
(ReResolve) and then processes the framechange list.O(rules *
rule-nodes)
).StyleSetImpl::ClearStyleData
) by walking
the rule tree and then the style context tree.
(could be handled by simultaneous clearing and
difference calculation of data (somewhat tricky))DidSetStyleContext
)