Gecko:Overview: Difference between revisions

Jump to navigation Jump to search
MXR -> DXR
(added a link to a talk)
(MXR -> DXR)
Line 185: Line 185:


The loading of CSS style sheets from the network is managed by the  
The loading of CSS style sheets from the network is managed by the  
[https://mxr.mozilla.org/mozilla-central/source/layout/style/Loader.h CSS loader];  
[https://dxr.mozilla.org/mozilla-central/source/layout/style/Loader.h CSS loader];  
they are then tokenized by the  
they are then tokenized by the  
[https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSScanner.h CSS scanner]  
[https://dxr.mozilla.org/mozilla-central/source/layout/style/nsCSSScanner.h CSS scanner]  
and parsed by the  
and parsed by the  
[https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSParser.h CSS parser].   
[https://dxr.mozilla.org/mozilla-central/source/layout/style/nsCSSParser.h CSS parser].   
Those that are attached to the document also expose APIs to
Those that are attached to the document also expose APIs to
script that are known as the CSS Object Model, or CSSOM.
script that are known as the CSS Object Model, or CSSOM.


The style sheets that apply to a document are managed by a class called
The style sheets that apply to a document are managed by a class called
the [https://mxr.mozilla.org/mozilla-central/source/layout/style/nsStyleSet.h style set].
the [https://dxr.mozilla.org/mozilla-central/source/layout/style/nsStyleSet.h style set].
The style set interacts with the different types of
The style set interacts with the different types of
style sheets (representing CSS style sheets, presentational
style sheets (representing CSS style sheets, presentational
attributes, and 'style' attributes) through two interfaces:
attributes, and 'style' attributes) through two interfaces:
[http://mxr.mozilla.org/mozilla-central/source/layout/style/nsIStyleSheet.h nsIStyleSheet] for basic management of style sheets and
[http://dxr.mozilla.org/mozilla-central/source/layout/style/nsIStyleSheet.h nsIStyleSheet] for basic management of style sheets and
[http://mxr.mozilla.org/mozilla-central/source/layout/style/nsIStyleRuleProcessor.h nsIStyleRuleProcessor] for getting the style data out of them.  Usually
[http://dxr.mozilla.org/mozilla-central/source/layout/style/nsIStyleRuleProcessor.h nsIStyleRuleProcessor] for getting the style data out of them.  Usually
the same object implements both interfaces, except in the most important
the same object implements both interfaces, except in the most important
case, CSS style sheets, where there is a single rule processor for all
case, CSS style sheets, where there is a single rule processor for all
Line 236: Line 236:
The process of turning the style sheets into computed style data goes
The process of turning the style sheets into computed style data goes
through three main steps, the first two of which closely relate to the
through three main steps, the first two of which closely relate to the
[http://mxr.mozilla.org/mozilla-central/source/layout/style/nsIStyleRule.h nsIStyleRule] interface, which represents an immutable source of style
[http://dxr.mozilla.org/mozilla-central/source/layout/style/nsIStyleRule.h nsIStyleRule] interface, which represents an immutable source of style
data, conceptually representing (and for CSS style rules, directly
data, conceptually representing (and for CSS style rules, directly
storing) a set of property:value pairs.  (It is similar to the idea of a
storing) a set of property:value pairs.  (It is similar to the idea of a
Line 305: Line 305:
with a simple mark and sweep collector (which often never needs to run).
with a simple mark and sweep collector (which often never needs to run).


* code: [http://mxr.mozilla.org/mozilla-central/source/layout/style/ layout/style/], where most files have useful one line descriptions at the top that show up in MXR
* code: [http://dxr.mozilla.org/mozilla-central/source/layout/style/ layout/style/], where most files have useful one line descriptions at the top that show up in DXR
* Bugzilla: Style System (CSS)
* Bugzilla: Style System (CSS)
* specifications
* specifications
Line 421: Line 421:
TODO: link to documentation of XUL frame classes
TODO: link to documentation of XUL frame classes


Code (note that most files in base and generic have useful one line descriptions at the top that show up in MXR):
Code (note that most files in base and generic have useful one line descriptions at the top that show up in DXR):
* [http://mxr.mozilla.org/mozilla-central/source/layout/base/ layout/base/] contains objects that coordinate everything and a bunch of other miscellaneous things
* [http://dxr.mozilla.org/mozilla-central/source/layout/base/ layout/base/] contains objects that coordinate everything and a bunch of other miscellaneous things
* [http://mxr.mozilla.org/mozilla-central/source/layout/generic/ layout/generic/] contains the basic frame classes as well as support code for their reflow methods (nsHTMLReflowState, nsHTMLReflowMetrics)
* [http://dxr.mozilla.org/mozilla-central/source/layout/generic/ layout/generic/] contains the basic frame classes as well as support code for their reflow methods (nsHTMLReflowState, nsHTMLReflowMetrics)
* [http://mxr.mozilla.org/mozilla-central/source/layout/forms/ layout/forms/] contains frame classes for HTML form controls
* [http://dxr.mozilla.org/mozilla-central/source/layout/forms/ layout/forms/] contains frame classes for HTML form controls
* [http://mxr.mozilla.org/mozilla-central/source/layout/tables/ layout/tables/] contains frame classes for CSS/HTML tables
* [http://dxr.mozilla.org/mozilla-central/source/layout/tables/ layout/tables/] contains frame classes for CSS/HTML tables
* [http://mxr.mozilla.org/mozilla-central/source/layout/mathml/ layout/mathml/] contains frame classes for MathML
* [http://dxr.mozilla.org/mozilla-central/source/layout/mathml/ layout/mathml/] contains frame classes for MathML
* [http://mxr.mozilla.org/mozilla-central/source/layout/svg/ layout/svg/] contains frame classes for SVG
* [http://dxr.mozilla.org/mozilla-central/source/layout/svg/ layout/svg/] contains frame classes for SVG
* [http://mxr.mozilla.org/mozilla-central/source/layout/xul/ layout/xul/] contains frame classes for the XUL box model and for various XUL widgets
* [http://dxr.mozilla.org/mozilla-central/source/layout/xul/ layout/xul/] contains frame classes for the XUL box model and for various XUL widgets


Bugzilla:
Bugzilla:
Line 448: Line 448:
* Code to create frames from frame construction items.
* Code to create frames from frame construction items.


Code: [http://mxr.mozilla.org/mozilla-central/source/layout/base/nsCSSFrameConstructor.h layout/base/nsCSSFrameConstructor.h] and [http://mxr.mozilla.org/mozilla-central/source/layout/base/nsCSSFrameConstructor.cpp layout/base/nsCSSFrameConstructor.cpp]
Code: [http://dxr.mozilla.org/mozilla-central/source/layout/base/nsCSSFrameConstructor.h layout/base/nsCSSFrameConstructor.h] and [http://dxr.mozilla.org/mozilla-central/source/layout/base/nsCSSFrameConstructor.cpp layout/base/nsCSSFrameConstructor.cpp]


==== Reflow ====
==== Reflow ====
Line 617: Line 617:


It is worth reading the inline code documentation in the following files:
It is worth reading the inline code documentation in the following files:
* [http://mxr.mozilla.org/mozilla-central/source/gfx/layers/Compositor.h gfx/layers/Compositor.h]
* [http://dxr.mozilla.org/mozilla-central/source/gfx/layers/Compositor.h gfx/layers/Compositor.h]
* [http://mxr.mozilla.org/mozilla-central/source/gfx/layers/ShadowLayers.h gfx/layers/ShadowLayers.h]
* [http://dxr.mozilla.org/mozilla-central/source/gfx/layers/ShadowLayers.h gfx/layers/ShadowLayers.h]
* [http://mxr.mozilla.org/mozilla-central/source/gfx/layers/Layers.h gfx/layers/Layers.h]
* [http://dxr.mozilla.org/mozilla-central/source/gfx/layers/Layers.h gfx/layers/Layers.h]
* [http://mxr.mozilla.org/mozilla-central/source/gfx/layers/host/TextureHost.h gfx/layers/host/TextureHost.h]
* [http://dxr.mozilla.org/mozilla-central/source/gfx/layers/host/TextureHost.h gfx/layers/host/TextureHost.h]
* [http://mxr.mozilla.org/mozilla-central/source/gfx/layers/client/CompositableClient.h gfx/layers/client/CompositableClient.h]
* [http://dxr.mozilla.org/mozilla-central/source/gfx/layers/client/CompositableClient.h gfx/layers/client/CompositableClient.h]


To visualize how a web page is layered, turn on the pref "layers.draw-borders" in about:config. When this pref is on, the borders of layers and tiles are displayed on top of the content. This only works when using the new Compositor API, that is when off-main-thread compositing is activated. OMTC is activated by default on all mobile platforms, and will progressively get activated on desktop platforms (not yet, though). On platforms where OMTC is not used, this pref has no effect.  
To visualize how a web page is layered, turn on the pref "layers.draw-borders" in about:config. When this pref is on, the borders of layers and tiles are displayed on top of the content. This only works when using the new Compositor API, that is when off-main-thread compositing is activated. OMTC is activated by default on all mobile platforms, and will progressively get activated on desktop platforms (not yet, though). On platforms where OMTC is not used, this pref has no effect.  
Confirmed users, Bureaucrats and Sysops emeriti
969

edits

Navigation menu