Commit Graph

248 Commits

Author SHA1 Message Date
Peter Van der Beken
a69ce442c1 Fix for bug 773780 (Add API for new DOM bindings for Node). r=bz.
--HG--
extra : rebase_source : 5dd51c4ad5274da9235c8c341b0531f234e95a91
2012-10-09 14:31:24 +02:00
Kyle Huey
1ccfbe810b 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
Simon Montagu
2b02131b60 Add vendor prefix to :dir selector. Bug 562169, r=dbaron 2012-09-29 13:41:10 -07:00
Ehsan Akhgari
8c296bbcd4 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00
Aryeh Gregor
982100775b Bug 780618 - Move all error codes to nsError.h; r=ehsan 2012-07-27 17:03:27 +03:00
Simon Montagu
c9f26ff62c Bug 562169. Add support for :dir(ltr/rtl) CSS selector, layout/style part, r=bz 2012-08-09 20:37:58 -07:00
Matt Brubeck
9636508719 Back out bug 562169 because of Dromaeo DOM regressions
Backed out changeset 841cd6e1e585 (bug 562169)
Backed out changeset e226e413dd27 (bug 562169)
Backed out changeset 9c24b7287c5b (bug 562169)
2012-08-08 08:14:48 -07:00
Simon Montagu
1c6ba0a43d Add support for :dir(ltr/rtl) CSS selector, layout/style part. Bug 562159, r=bz 2012-08-07 21:44:24 -07:00
Cameron McCormack
78727e2c15 Bug 649740 - Implement @supports. r=dbaron,bz 2012-08-02 10:32:12 +10:00
Aryeh Gregor
57c0ad57fb Bug 777292 part 2 - Change all nsnull to nullptr 2012-07-30 17:20:58 +03:00
Aryeh Gregor
0c8f5adf50 Bug 626472 part 1 - Define nsnull as nullptr where available; r=ehsan 2012-07-20 14:16:17 +03:00
Boris Zbarsky
e7ff5ec8dd Bug 758885. Don't apply the dynamic :hover reresolution skipping optimization to selectors which can match on mutable state other than :hover. r=dbaron 2012-05-29 00:17:45 -04:00
Gervase Markham
87620f5676 Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Josh Matthews
6d40eda1b5 Bug 722853 - Derive private browsing status from docshell when assigning element states. r=dbaron 2012-03-30 02:16:22 -04:00
Ms2ger
b09173c3e1 Backout bug 722853 - changeset f40a17213344; r=orange 2012-03-26 18:41:19 +02:00
Josh Matthews
2b74572c3c Bug 722853 - Derive private browsing status from docshell when assigning element states. r=dbaron
--HG--
extra : rebase_source : d59985b415ccafc4a9c8e8dbea9b69fa61602b8b
2012-02-21 09:57:09 -05:00
Boris Zbarsky
8639633f44 Bug 735481. Skip ancestor filtering on IDs and classes in quirks mode, because that matching needs to be case-insensitive. r=dbaron 2012-03-14 00:44:13 -05:00
Boris Zbarsky
09fd9002b2 Bug 732667. Only do checks for :hover selectors when hover state changes on nodes which have relevant hover rules. r=dbaron 2012-03-12 22:54:15 -05:00
Boris Zbarsky
ea00c15230 Bug 705877 part 4. Use the TreeMatchContext's ancestor filter, if any, in EnumerateAllRules. r=dbaron 2012-03-12 22:54:15 -05:00
Boris Zbarsky
0b53563082 Bug 705877 part 3. Hang an optional Bloom filter and some methods for managing it off the TreeMatchContext. r=dbaron 2012-03-12 22:54:15 -05:00
Boris Zbarsky
0ebd88f49f Bug 705877 part 2. Store the hashes of the atoms occurring as IDs, classes, and tag names in selectors that would need to match one of our ancestors. r=dbaron
We store a maximum of 4 hashes to save space.  Interesting questions are whether 4 is the right number
and whether we should, prioritize ids and classes over tags.  In practice, this seems to be good enough
at least performance-wise, though it's possible we could use less memory and still do OK on the performance.
2012-03-12 22:54:14 -05:00
Phil Ringnalda
47dd3c842e Back out 83a33626d965:6e9330f5a9bd (bug 732667 and bug 705877) for Windows build bustage 2012-03-12 22:12:41 -07:00
Boris Zbarsky
82ab90bd3f Bug 732667. Only do checks for :hover selectors when hover state changes on nodes which have relevant hover rules. r=dbaron 2012-03-12 22:54:15 -05:00
Boris Zbarsky
a45e55e1a6 Bug 705877 part 4. Use the TreeMatchContext's ancestor filter, if any, in EnumerateAllRules. r=dbaron 2012-03-12 22:54:15 -05:00
Boris Zbarsky
2b015eb44c Bug 705877 part 3. Hang an optional Bloom filter and some methods for managing it off the TreeMatchContext. r=dbaron 2012-03-12 22:54:15 -05:00
Boris Zbarsky
23845b8aec Bug 705877 part 2. Store the hashes of the atoms occurring as IDs, classes, and tag names in selectors that would need to match one of our ancestors. r=dbaron
We store a maximum of 4 hashes to save space.  Interesting questions are whether 4 is the right number
and whether we should, prioritize ids and classes over tags.  In practice, this seems to be good enough
at least performance-wise, though it's possible we could use less memory and still do OK on the performance.
2012-03-12 22:54:14 -05:00
Nathan Froyd
7adb7a65ea Bug 731615 - Eliminate duplicate headers in layout. rs=smontagu 2012-02-29 10:57:47 -05:00
Zack Weinberg
dc30af584b Bug 729142 - Convert layout/style to MOZ_STATIC_ASSERT. r=dbaron 2012-02-23 08:19:00 -08:00
Heather Arthur
aee4173802 Bug 708874 - API for locking pseudo-class state of an element. r=bz 2012-02-08 10:42:38 -08:00
Nicholas Nethercote
dd32d38d63 Bug 715453 - Remove computedSize from nsMallocSizeOfFun. r=jlebar,bhackett.
--HG--
extra : rebase_source : a65039a407daab45360a5b375b53cbf1bc05b7f6
2012-01-25 00:52:51 -08:00
Nicholas Nethercote
2fa63e0548 Bug 707865 - Convert nsTArray::SizeOf() to nsTArray::SizeOfExcludingThis(). r=jlebar.
--HG--
extra : rebase_source : d802d58bc7dedda2490878793923adc0ab55f779
2011-12-15 14:59:53 -08:00
Boris Zbarsky
882520d6d7 Bug 700914. Initialize the rulehash's hashtables lazily. r=dbaron 2011-12-09 05:29:01 -05:00
Nicholas Nethercote
2a7afd1ec3 Bug 705987 - Use mallocSizeOf in the layout memory reporters. r=khuey,bzbarsky 2011-12-08 21:01:52 -08:00
Boris Zbarsky
aeef1e4c75 Bug 689443. Switch PerWeightData back to using linked lists instead of arrays for the actual per-weight rule data, so as to reduce fragmentation. r=dbaron
This incidentally fixes a bug where we were copying the per-weight data very inefficiently.
2011-12-08 01:32:11 -05:00
Boris Zbarsky
82248f05f1 Bug 704911. Don't restyle based on state selectors that match our node but don't depend on the state that's changing. r=dbaron 2011-12-05 23:58:15 -05:00
Ed Morley
7a94e94707 Backout 15cf68a3c027, 2f403e4c42c8, 61534874aed7, 1cb3705557d9 & 03970d1fc919 (bug 661746) for Win PGO build failures; a=bz 2011-11-14 18:10:22 +00:00
David Zbarsky
78277b1442 Bug 661746 - Part 5: Avoid creating atoms during selector matching. r=bzbarsky 2011-11-14 16:30:28 +13:00
David Zbarsky
0cdb162895 Bug 661746 - Part 4: use const nsIDocument in selector matching. r=bzbarsky 2011-11-14 16:30:22 +13:00
David Zbarsky
d7103aec40 Bug 661746 - Part 3: Use const selectors during selector matching. r=bzbarsky 2011-11-14 16:30:16 +13:00
David Zbarsky
b9bd3dd4bb Bug 661746 - Part 2: Make selector matching work with const elements. r=bzbarsky 2011-11-14 16:30:08 +13:00
David Zbarsky
1afed10a08 Bug 661746 - Part 1: Delay setting slow selector flags during selector matching to avoid mutating Elements. r=bzbarsky 2011-11-14 16:29:56 +13:00
David Zbarsky
71021df43b Bug 660959 - Update link state less lazily r=bz 2011-11-14 16:24:41 +13:00
Daniel Holbert
507a8a5820 Bug 641731: Ignore :visited status in SVG image documents. r=dbaron 2011-10-29 02:43:43 -07:00
Olli Pettay
a86b1a4d43 Bug 682420 - Rename nsINode::GetOwnerDoc to nsINode::OwnerDoc, part 1, r=jst
--HG--
extra : rebase_source : baf1a25cdea68d499a7673fdf96e27b5a12dc83c
2011-10-18 13:53:36 +03:00
Ehsan Akhgari
2a602a5685 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Landing on a CLOSED TREE
2011-10-17 10:59:28 -04:00
Jeff Walden
b7753477cf Bug 693469 - Implement mozilla::ArrayLength and mozilla::ArrayEnd, and replace uses of NS_ARRAY_LENGTH whenever possible. (Exceptions: assigning to static initializers, use in static assertions, as template parameters, etc. These will go away when the relevant compilers have C++11 constexpr support.) r=cjones
--HG--
extra : rebase_source : b4bae9a0f85abf2feb828609b50e756916b99a6f
2011-10-10 22:50:08 -07:00
Jeff Walden
eb2cb918a4 Back out everything since 5435ee09cf7b. Tinderbox compilers hate me. r=epic-fail 2011-10-12 12:21:53 -07:00
Jeff Walden
77ebbde4ab Bug 639469 - Implement mozilla::ArrayLength and mozilla::ArrayEnd, and replace uses of NS_ARRAY_LENGTH whenever possible. r=cjones
--HG--
extra : rebase_source : 860a8271bf7e51cde358f2a4185c410de1fc2960
2011-10-10 22:50:08 -07:00
Boris Zbarsky
9bbf579b35 Bug 681755. Switch some of the style system's arrays in hashtables to be auto arrays. r=dbaron 2011-10-05 22:06:37 -04:00
Justin Lebar
d6675374cb Back out 81ca82f27831 (bug 681755) due to incorrect leak reporting.
(I accidentally pushed the wrong version of this patch.)
2011-10-05 22:02:44 -04:00