Commit Graph

78 Commits

Author SHA1 Message Date
Nicholas Nethercote
9118e44c2e Bug 1187144 (part 4) - Replace nsBaseHashtable::Enumerate() calls in layout/ with iterators. r=dholbert. 2015-11-22 21:12:49 -08:00
L. David Baron
87f75f0802 Bug 1221436 patch 2 - For style attributes, only store a css::Declaration instead of a css::StyleRule. r=heycam
Now that Declaration implements nsIStyleRule, we don't need the memory
overhead of storing a StyleRule object for style attributes.

We also need to change this prior to patch 5, because the changes in
patch 5 that will allow rules to change (but declarations not) would
otherwise break due to style attribute object merging done by
nsAttrValue::ParseStyleAttribute.
2015-11-09 15:57:16 +08:00
L. David Baron
c7d7287021 Bug 1221436 patch 1 - Have a pointer back from the css::Declaration for style attributes to the nsHTMLCSSStyleSheet. r=heycam
This is needed for patch 2, since we need a replacement for the
mechanism to get from rules to the style attribute sheet
(nsHTMLCSSStyleSheet) that works instead for declarations rather than
rules.

This pointer will be merged with the owning rule pointer in patch 4, but
we can't do that until after patch 2.
2015-11-09 15:57:16 +08:00
L. David Baron
cfabe21e8e Bug 978833 patch 18 - Eliminate StyleRule::RuleMatched and call Declaration::SetImmutable directly for style rules (like for @page and keyframe rules). r=heycam
This is just simplification (plus the addition of an assertion).
2015-11-05 16:44:10 +08:00
L. David Baron
99260b9bb7 Bug 978833 patch 12 - Use the css::Declaration instead of the css::StyleRule as the matching rule. r=heycam
This is the key change in this patch series; it changes the object we
use for style data (currently nsIStyleRule) identity.  It allows
removing some hacks we have to deal with that for StyleRule, and avoids
having to write similar hacks for nsCSSKeyframeRule and nsCSSPageRule
(which are broken without this).

I confirmed locally that it is this patch that fixes both of the todo_is
mochitests, by building and testing with the patch queue through patch
11, and again through patch 12.
2015-11-05 16:44:10 +08:00
Cameron McCormack
9bb0cce6bd Bug 1180118 - Part 5: Add a RestyleHintData outparam to HasAttributeDependentStyle for use with eRestyle_SomeDescendants. r=bzbarsky 2015-08-05 22:42:21 +10:00
Carsten "Tomcat" Book
22c46d8958 Backed out 13 changesets (bug 1180118) for crashes on a CLOSED TREE
Backed out changeset c65d298d7cfa (bug 1180118)
Backed out changeset 7c5ebadc3fc9 (bug 1180118)
Backed out changeset 91a3e2205388 (bug 1180118)
Backed out changeset 15ad6049b940 (bug 1180118)
Backed out changeset 9b41cd9f2bc5 (bug 1180118)
Backed out changeset 37493f6eef20 (bug 1180118)
Backed out changeset b7ec8d4d2d7e (bug 1180118)
Backed out changeset cfeeae42d514 (bug 1180118)
Backed out changeset 9bcc3233f3c8 (bug 1180118)
Backed out changeset b99c358a6fea (bug 1180118)
Backed out changeset 4a7b79980353 (bug 1180118)
Backed out changeset 20984dfa4302 (bug 1180118)
Backed out changeset ef165b896cf4 (bug 1180118)
2015-08-04 12:20:20 +02:00
Cameron McCormack
d24ea39dec Bug 1180118 - Part 5: Add a RestyleHintData outparam to HasAttributeDependentStyle for use with eRestyle_SomeDescendants. r=bzbarsky 2015-08-04 17:27:53 +10:00
Nicholas Nethercote
845b474b3c Bug 1189156 (part 4) - Don't use enumeration style for nsBaseHashtable::SizeOf{In,Ex}cludingThis(). r=erahm,jfkthame.
After this change, we have ShallowSizeOf{In,Ex}cludingThis(), which don't do
anything to measure children. (They can be combined with iteration to measure
children.)
2015-07-30 21:19:57 -07:00
Birunthan Mohanathas
e52329c788 Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Daniel Holbert
8047226fc5 Bug 1167782: Null-check pseudo element in nsHTMLCSSStyleSheet::RulesMatching(). r=dbaron 2015-05-26 16:44:52 -07:00
Sylvestre Ledru
ad8eae30b5 Bug 1155766 - Fix a bad assertion r=dbaron 2015-04-20 11:43:06 -07:00
L. David Baron
cbf5e33e73 Bug 960465 patch 20 - Allow pseudo-elements for style attribute replacement in RuleNodeWithReplacement. r=birtles
I confirmed that we're actually using this codepath by manually testing
<input type=color>:  it works with the patch, but if I comment out the
call to nsHTMLCSSStyleSheet::PseudoElementRulesMatching from
nsStyleSet::RuleNodeWithReplacement, then the color swatch breaks, which
proves that we're depending on the code.

I think I included this in the queue because it is needed for patch 22,
although I've forgotten the full reasoning.
2015-02-17 11:15:05 +13:00
L. David Baron
dbad586939 Bug 960465 patch 19 - Remove users of eRestyle_ChangeAnimationPhase. r=birtles 2015-02-17 11:15:05 +13:00
L. David Baron
d5bb664bcf Bug 960465 patch 17 - Remove separate animation and non-animation phases of restyling. r=birtles
Note that this means that when we start transitions, we post restyles
that are processed during the current restyling operation, rather than
in a later phase.  This depends on patch 11, which makes the transition
manager skip style changes that it posts while starting transitions, to
ensure that this doesn't lead to an infinite loop.  This also depends on
patch 16, which only consumes restyle data for the primary frame, to
ensure that the animation restyles posted are processed properly.  It
also depends on patch 14, which makes us retain data on finished
transitions, to avoid triggering extra transitions on descendants when
both an ancestor and a descendant transition an inherited property, and
the descendant does so faster.

This fixes a known failure in layout/style/test/test_animations.html and
test_animations_omta.html (as visible in the patch).  I believe this is
because this patch changes us to compute keyframe values for animations
on top of a style context *with* animation data rather than one without,
which means what we're computing them on top of changes each time.  (The
purpose of patch 3 was to avoid this in the case where avoiding it
matters, i.e., implicit 0% and 100% keyframes.)
2015-02-17 11:15:05 +13:00
L. David Baron
14a1bf93dc Bug 1075137 patch 4 - Convert callers from IsProcessingRestyles/IsProcessingAnimationStyleChange to SkipAnimationRules/PostAnimationRestyles. r=birtles 2014-10-02 21:53:24 -07:00
L. David Baron
9e53a17632 Bug 977991 patch 6 - Use the faster eRestyle_StyleAttribute path for style attribute changes. r=birtles 2014-09-13 06:17:37 -07:00
L. David Baron
133a7fac65 Bug 977991 patch 1 - Expose variant of RulesMatching on nsHTMLCSSStyleSheet that is less work to call. r=birtles
This allows nsStyleSet::RuleNodeWithReplacement to call it without
constructing an entire (and unnecessary) ElementRuleProcessorData, which
will happen in patch 3.
2014-09-13 06:17:36 -07:00
Jonathan Watt
13b42229b5 Bug 1016345 - Add memory reporting for nsHTMLCSSStyleSheet's nsDataHashtable's buffer and the buffers of its nsString keys. r=dbaron 2014-06-22 23:02:05 +01:00
Birunthan Mohanathas
ff8ce9bd42 Bug 900908 - Part 3: Change uses of numbered macros in nsIClassInfoImpl.h/nsISupportsImpl.h to the variadic variants. r=froydnj 2014-04-27 03:06:00 -04:00
Cameron McCormack
f7eb053231 Bug 922669 - Part 7: Add nsStyleSet::HasStateDependentStyle and nsCSSRuleProcessor:HasStateDependentStyle overrides that work on pseudo-elements. r=bz 2013-11-28 17:46:39 +11:00
Ehsan Akhgari
4ff4da4197 Bug 938123 - Build layout/style in unified mode; r=roc 2013-11-14 21:42:57 -05:00
Arnaud Bienner
28e6e2c644 Bug 875275 part 1: Implement layout support for <input type="color">. r=dbaron,dholbert 2013-07-10 00:25:27 +02:00
Ehsan Akhgari
86a457baf2 Bug 916610 - Minimize the #includes in layout/style; r=roc 2013-09-15 21:06:52 -04:00
Robert O'Callahan
33cdb42706 Bug 910989. Remove nsTHashtable::Init, fallible allocation, and MT hashtables. r=ehsan,bsmedberg
--HG--
extra : rebase_source : 0787130b1814c74bfb38dc178de94022f0b2e64e
2013-09-02 20:41:57 +12:00
Catalin Iacob
4f03e5bb1a Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn.
--HG--
extra : rebase_source : fc472490dd978d165f02f77ed37f07aed6e5bb61
2013-06-23 14:03:39 +02:00
L. David Baron
533609848e Bug 882573 patch 4: Make nsHTMLStyleSheet and nsHTMLCSSStyleSheet stop implementing nsIStyleSheet. r=heycam
Note that this removes the Reset method and the mURL and mDocument
members (and arguments to set them) from nsHTMLCSSStyleSheet.

On the other hand, from nsHTMLStyleSheet it only removes mURL (and
equivalent arguments), and nsHTMLStyleSheet keeps the SetOwningDocument
method that was previously part of nsIStyleSheet (but no longer virtual).
2013-06-13 22:34:37 -07:00
Ms2ger
89a7551507 Bug 868729 - Remove nsHTMLCSSStyleSheet::Init; r=bz 2013-05-05 09:03:20 +02:00
David Zbarsky
2c3499b66c [Bug 847110] Fix up includes in layout/style r=dbaron 2013-03-02 19:31:48 -05:00
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
Randell Jesup
eedf93a21d Bug 773151: Convert nsCAutoString->nsAutoCString CLOSED TREE r=bsmedberg 2012-09-01 22:35:17 -04:00
Ehsan Akhgari
0fd9123eac 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
David Zbarsky
d50e4a7565 [Bug 780428] Don't include nsIFrame.h in places where it's not necessary r=roc 2012-08-05 23:00:56 -04:00
Aryeh Gregor
e806eeab4f Bug 777292 part 2 - Change all nsnull to nullptr 2012-07-30 17:20:58 +03:00
Gervase Markham
ca171eec44 Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Nicholas Nethercote
a7ad4ef70e Bug 715453 - Remove computedSize from nsMallocSizeOfFun. r=jlebar,bhackett.
--HG--
extra : rebase_source : a65039a407daab45360a5b375b53cbf1bc05b7f6
2012-01-25 00:52:51 -08:00
Nicholas Nethercote
587382cea2 Bug 705987 - Use mallocSizeOf in the layout memory reporters. r=khuey,bzbarsky 2011-12-08 21:01:52 -08:00
Matheus Kerschbaum
fb722a61dd Bug 698630 - Remove --disable-smil build option; r=dholbert 2011-11-05 10:32:52 +00: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
Michael Wu
d8e503c38b Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
--HG--
rename : tools/trace-malloc/bloatblame.c => tools/trace-malloc/bloatblame.cpp
2011-09-28 23:19:26 -07:00
Craig Topper
72d7c1f754 Bug 576831 part 4. Remove nsICSSStyleRule and use mozilla::css::StyleRule instead. r=bzbarsky
--HG--
rename : layout/style/nsCSSStyleRule.cpp => layout/style/StyleRule.cpp
rename : layout/style/nsICSSStyleRule.h => layout/style/StyleRule.h
2011-03-10 21:48:57 -05:00
Craig Topper
f720fbc615 Bug 575901 - DeCOMtaminate nsIStyleRuleProcessor method signatures. r=bz 2010-07-18 23:20:40 +02:00
Boris Zbarsky
b8fb52d415 Bug 555627. Make transitions actually work correctly on :before and :after. r=dbaron 2010-06-30 18:54:29 -07:00
Craig Topper
58622d8961 Change some nsIStyleSheet methods from returning AddRef-ed to un-AddRef-ed pointers, and some other cleanup. (Bug 239008) r=dbaron 2010-05-17 21:00:39 -07:00
Craig Topper
9528e9a5c6 Rename nsIStyleSheet::GetApplicable to IsApplicable and GetComplete to IsComplete. (Bug 239008) r=dbaron 2010-05-14 12:05:14 -07:00
Boris Zbarsky
7ef058e29f Bug 565809. Move checking for style attribute changes into the cascade level. r=dbaron 2010-05-14 13:04:51 -04:00
Craig Topper
d02574b6b4 DeCOMtaminate nsIStyleSheet method signatures. (Bug 239008) r=dbaron 2010-05-12 13:18:47 -07:00
Boris Zbarsky
f7d7c95ec6 Bug 562971. Include Element.h as mozilla/dom/Element.h and don't use 'using namespace' quite as much. r=jst 2010-05-05 14:18:05 -04:00
Boris Zbarsky
b3de40cc58 Bug 562688 part 14. Eliminate eELEMENT usage in the rule processor; switch to Element as we can. r=dbaron 2010-04-30 09:12:06 -04:00
Zack Weinberg
ee4e0f1e56 Bug 494117 preliminary refactor: Search-and-replace 'ReStyle' with 'Restyle' throughout layout. r=roc 2010-03-31 17:43:32 -07:00