gecko/layout
Kyle Huey e5eb83ac5a Bug 760331: Coalesce data for inline style across nodes. r=bz
This patch enables sharing of an nsAttrValue's MiscContainer between nodes for style rules.  MiscContainers of type eCSSStyleRule are now refcounted (with some clever struct packing to ensure that the amount of memory allocated for MiscContainer remains unchanged on 32 and 64 bit).  This infrastructure can be used to share most MiscContainer types in the future if we find advantages to sharing other types than just eCSSStyleRuley.  A cache mapping strings to MiscContainers has been added to nsHTMLCSSStyleSheet.  MiscContainers can be shared between nsAttrValues when one nsAttrValue is SetTo another nsAttrValue or when there is a cache hit in this cache.  This patch also adds the ability to tell a style rule that it belongs to an nsHTMLCSSStyleSheet, with appropriate accessor functions to separate that from the existing case of belonging to an nsCSSStyleSheet.

The primary use case is to reduce memory use for pages that have lots of inline style attributes with the same value.  This can happen easily with large pages that are automatically generated.  An (admittedly pathological) testcase in Bug 686975 sees over 250 MB of memory savings with this change.  Reusing the same MiscContainer for multiple nodes saves the overhead of maintaining separate copies of the string containing the serialized value of the style attribute and of creating separate style rules for each node.  Eliminating duplicate style rules enables further savings in layout through style context sharing.  The testcase sees the amount of memory used by style contexts go from over 250 MB to 10 KB.

Because the cache is based on the text value of the style attribute, it will not handle attributes that have different text values but are parsed into identical style rules.  We also do not attempt to share MiscContainers when the node's base URI differs from the document URI.  The effect of these limitations is expected to be low.
2012-09-30 09:40:24 -07:00
..
analysis
base Bug 795646 - Add crashtest for merged nsDisplayFixedPosition items. r=cjones 2012-09-30 19:20:24 +13:00
build Backout bec7e68cad9a & a6228bc28958 (bug 786299) for Windows compilation errors on a CLOSED TREE 2012-09-29 01:44:30 +01:00
doc Bug 579517 - Part 4: Manually rewrite some parts of the code base not covered by the automated conversion; r=bsmedberg 2012-08-22 11:59:54 -04:00
forms Bug 760331: Coalesce data for inline style across nodes. r=bz 2012-09-30 09:40:24 -07:00
generic Bug 760331: Coalesce data for inline style across nodes. r=bz 2012-09-30 09:40:24 -07:00
inspector Bug 539356 - Part 9c - Remove old invalidation code. r=bz 2012-08-29 17:39:31 +12:00
ipc Bug 746502: Add support for <meta name=viewport> on B2G/async panning and zooming r=cjones,smaug 2012-09-28 22:18:18 -04:00
mathml Bug 539356 - Part 9a - Add new display list invalidation API to nsDisplayItem and implement it. r=roc 2012-08-29 17:39:01 +12:00
media Bug 782457: Add max offset and cues preloading support to nestegg; r=kinetik 2012-09-17 16:45:38 -04:00
printing Bug 793844. DocHasPrintCallbackCanvas should skip documents that don't have a root element. r=smaug 2012-09-26 21:26:49 +12:00
reftests Bug 666041: Reftests for css3-flexbox. (tests-only) 2012-09-29 23:42:29 -07:00
style Bug 760331: Coalesce data for inline style across nodes. r=bz 2012-09-30 09:40:24 -07:00
svg Bug 791906: Replace NSPR integer limit constants with stdint ones; r=ehsan 2012-09-28 01:57:33 -05:00
tables Bug 760331: Coalesce data for inline style across nodes. r=bz 2012-09-30 09:40:24 -07:00
tools Backout 92530b29ac24, 42e659956dc6 & 38277196c099 (bug 486918), d3b69fe15ac3 & b2dba2108722 (bug 786444), e7381ac9e30a (bug 786449) on suspicion of causing Android reftest failures on a CLOSED TREE 2012-09-28 23:00:28 +01:00
xul bug 674373 pt 6 - support HiDPI display in Cocoa widget code. r=roc,smichaud 2012-09-29 12:36:09 +01:00
Makefile.in Bug 596753: Flatten layout/svg/base/src into layout/svg. r=dholbert 2012-09-24 23:01:21 +02:00