Commit Graph

113 Commits

Author SHA1 Message Date
Nicholas Nethercote
57c26c9834 Bug 1387956 - Overhaul ComputedValues measurement, and add style structs measurement. r=bholley.
This patch moves measurement of ComputedValues objects from Rust to C++.
Measurement now happens (a) via DOM elements and (b) remaining elements via
the frame tree. Likewise for the style structs hanging off ComputedValues
objects.

Here is an example of the output.

> ├──27,600,448 B (26.49%) -- active/window(https://en.wikipedia.org/wiki/Barack_Obama)
> │  ├──12,772,544 B (12.26%) -- layout
> │  │  ├───4,483,744 B (04.30%) -- frames
> │  │  │   ├──1,653,552 B (01.59%) ── nsInlineFrame
> │  │  │   ├──1,415,760 B (01.36%) ── nsTextFrame
> │  │  │   ├────431,376 B (00.41%) ── nsBlockFrame
> │  │  │   ├────340,560 B (00.33%) ── nsHTMLScrollFrame
> │  │  │   ├────302,544 B (00.29%) ── nsContinuingTextFrame
> │  │  │   ├────156,408 B (00.15%) ── nsBulletFrame
> │  │  │   ├─────73,024 B (00.07%) ── nsPlaceholderFrame
> │  │  │   ├─────27,656 B (00.03%) ── sundries
> │  │  │   ├─────23,520 B (00.02%) ── nsTableCellFrame
> │  │  │   ├─────16,704 B (00.02%) ── nsImageFrame
> │  │  │   ├─────15,488 B (00.01%) ── nsTableRowFrame
> │  │  │   ├─────13,776 B (00.01%) ── nsTableColFrame
> │  │  │   └─────13,376 B (00.01%) ── nsTableFrame
> │  │  ├───3,412,192 B (03.28%) -- servo-style-structs
> │  │  │   ├──1,288,224 B (01.24%) ── Display
> │  │  │   ├────742,400 B (00.71%) ── Position
> │  │  │   ├────308,736 B (00.30%) ── Font
> │  │  │   ├────226,512 B (00.22%) ── Background
> │  │  │   ├────218,304 B (00.21%) ── TextReset
> │  │  │   ├────214,896 B (00.21%) ── Text
> │  │  │   ├────130,560 B (00.13%) ── Border
> │  │  │   ├─────81,408 B (00.08%) ── UIReset
> │  │  │   ├─────61,440 B (00.06%) ── Padding
> │  │  │   ├─────38,176 B (00.04%) ── UserInterface
> │  │  │   ├─────29,232 B (00.03%) ── Margin
> │  │  │   ├─────21,824 B (00.02%) ── sundries
> │  │  │   ├─────20,080 B (00.02%) ── Color
> │  │  │   ├─────20,080 B (00.02%) ── Column
> │  │  │   └─────10,320 B (00.01%) ── Effects
> │  │  ├───2,227,680 B (02.14%) -- computed-values
> │  │  │   ├──1,182,928 B (01.14%) ── non-dom
> │  │  │   └──1,044,752 B (01.00%) ── dom
> │  │  ├───1,500,016 B (01.44%) ── text-runs
> │  │  ├─────492,640 B (00.47%) ── line-boxes
> │  │  ├─────326,688 B (00.31%) ── frame-properties
> │  │  ├─────301,760 B (00.29%) ── pres-shell
> │  │  ├──────27,648 B (00.03%) ── pres-contexts
> │  │  └─────────176 B (00.00%) ── style-sets

The 'servo-style-structs' and 'computed-values' sub-trees are new. (Prior to
this patch, ComputedValues under DOM elements were tallied under the the
'dom/element-nodes' sub-tree, and ComputedValues not under DOM element were
ignored.) 'servo-style-structs/sundries' aggregates all the style structs that
are smaller than 8 KiB.

Other notable things done by the patch are as follows.

- It significantly changes the signatures of the methods measuring nsINode and
  its subclasses, in order to handle the tallying of style structs separately
  from element-nodes. Likewise for nsIFrame.

- It renames the 'layout/style-structs' sub-tree as
  'layout/gecko-style-structs', to clearly distinguish it from the new
  'layout/servo-style-structs' sub-tree.

- It adds some FFI functions to access various Rust-side data structures from
  C++ code.

- There is a nasty hack used twice to measure Arcs, by stepping backwards from
  an interior pointer to a base pointer. It works, but I want to replace it
  with something better eventually. The "XXX WARNING" comments have details.

- It makes DMD print a line to the console if it sees a pointer it doesn't
  recognise. This is useful for detecting when we are measuring an interior
  pointer instead of a base pointer, which is bad but easy to do when Arcs are
  involved.

- It removes the Rust code for measuring CVs, because it's now all done on the
  C++ side.

MozReview-Commit-ID: BKebACLKtCi

--HG--
extra : rebase_source : 4d9a8c6b198a0ff025b811759a6bfa9f33a260ba
2017-08-11 16:37:33 +10:00
Bobby Holley
3e308bd38d Bug 1389385 - Rearrange dirty noting to operate on the element rather than the parent. r=emilio
This will allow us to scope restyle roots more tightly.

MozReview-Commit-ID: 2t2lp5sKBHH
2017-08-11 18:18:22 -07:00
Ehsan Akhgari
50fd0b7a62 Bug 1385533 - Reserve space for one pointer in the mMutationObservers array on node slots; r=smaug
This helps avoid allocations for the first mutation observer (for example, Range)
created by a caller.
2017-07-31 17:12:38 -04:00
Nicholas Nethercote
49eb219ff5 Bug 1383982 (attempt 2) - Introduce a general mechanism for measuring memory usage of graph-like structures. r=erahm.
--HG--
extra : rebase_source : 7075f9570a4262158351ce9ac3ca8360ea4d5394
2017-07-28 20:10:04 +10:00
Sebastian Hengst
9077ac8886 Backed out changeset a57d8f30d1bf (bug 1383982) for build bustage at nsGlobalWindow.cpp:13826: 'class nsWindowSizes' has no member named 'mMallocSizeOf'. r=backout 2017-07-28 09:50:48 +02:00
Nicholas Nethercote
5c3abe8aab Bug 1383982 - Introduce a general mechanism for measuring memory usage of graph-like structures. r=erahm.
All the SizeOf{In,Ex}cludingThis() functions take a MallocSizeOf function
which measures memory blocks. This patch introduces a new type, SizeOfState,
which includes a MallocSizeOf function *and* a table of already-measured
pointers, called SeenPtrs. This gives us a general mechanism to measure
graph-like data structures, by recording which nodes have already been
measured. (This approach is used in a number of existing reporters, but not in
a uniform fashion.)

The patch also converts the window memory reporting to use SizeOfState in a lot
of places, all the way through to the measurement of Elements. This is a
precursor for bug 1383977 which will measure Stylo elements, which involve
Arcs.

The patch also converts the existing mAlreadyMeasuredOrphanTrees table in the
OrphanReporter to use the new mechanism.

--HG--
extra : rebase_source : 2c23285f8b6c3b667560a9d14014efc4633aed51
2017-07-28 15:03:44 +10:00
Ehsan Akhgari
0abf86be7c Bug 1382914 follow-up: Spell GetExistingCommonAncestorRanges() correctly
Landed on a CLOSED TREE to fix build bustage
2017-07-25 13:37:50 -04:00
Ehsan Akhgari
585393f54b Bug 1382914 - Store the hashtable of ancestor ranges in the node slots instead of in a property in order to speed up access to it; r=smaug 2017-07-25 13:01:16 -04:00
Beekill95
463ad1bdff Bug 1362330 - Part 1: Move XPath generation to Node's interface and move all remaining XPathGenerator.jsm functions to FormData. r=mikedeboer, r=smaug
MozReview-Commit-ID: Ej45wPeddtQ
2017-06-15 08:49:17 +07:00
Carsten "Tomcat" Book
2f89ff146f Backed out changeset 9342f0d949f1 (bug 1362330) for failures like nsFocusManager.cpp:1166:31: error: member access into incomplete type 'mozilla::dom::nsIContentParent'
--HG--
extra : rebase_source : f66736599ced81fde3b0f0555bb1f85934ecec54
2017-07-04 09:53:36 +02:00
Beekill95
fd725fa7ce Bug 1362330 - Part 1: Move XPath generation to Node's interface and move all remaining XPathGenerator.jsm functions to FormData. r=mikedeboer, r=smaug
MozReview-Commit-ID: Ej45wPeddtQ
2017-06-15 08:49:17 +07:00
Cameron McCormack
4cfbfe320e Bug 1372061 - Add node flag recording whether we might have anonymous children. r=bholley
MozReview-Commit-ID: CMaxJ1JnuYJ

--HG--
extra : rebase_source : ac5651b0d42125fd2a4ff3f5ce03f7a6c6ab1fbb
2017-06-27 23:56:12 -07:00
Masayuki Nakano
9f1aec970a Bug 1374207 - part4: Element classes should use TextEditor class instead of nIEditor r=smaug
Unfortunately, nsGenericHTMLElement::GetAssociatedEditor() cannot use concrete classes because it may return nsIEditor which is set via nsIDocShell.editor.  The editor set to nsIDocShell may be implemented by JS since nsIEditor isn't marked as builtinclass.

MozReview-Commit-ID: 6GY9LOYp4hM

--HG--
extra : rebase_source : 3e0464067b30daf8254805458c5358d7ea644be8
2017-06-22 15:21:31 +09:00
Boris Zbarsky
633b9f4d31 Bug 1373798 part 3. Rewrite our existing checks for the state of the "dir" attr on top of the new event state flags. r=mystor
MozReview-Commit-ID: LpCYABK5ZRN
2017-06-19 23:24:59 -04:00
Wes Kocher
84816f4647 Backed out 5 changesets (bug 1373798) for browser_parseable_css.js failures a=backout CLOSED TREE
Backed out changeset ef2e6aa3ae88 (bug 1373798)
Backed out changeset 0970ac62b245 (bug 1373798)
Backed out changeset dc19b4db7e51 (bug 1373798)
Backed out changeset a5dd7744170e (bug 1373798)
Backed out changeset 2c8752c4b6fb (bug 1373798)

MozReview-Commit-ID: J1WkPvRqELs
2017-06-19 15:56:47 -07:00
Boris Zbarsky
0abd585823 Bug 1373798 part 3. Rewrite our existing checks for the state of the "dir" attr on top of the new event state flags. r=mystor
MozReview-Commit-ID: LpCYABK5ZRN

--HG--
extra : rebase_source : 2771f8fb377b051b8dc8d93d08a2360817331f21
2017-06-19 14:42:01 -04:00
Dominic Farolino
6590a708e6 Bug 1368097 - Update standards link. r=smaug
--HG--
extra : rebase_source : d96b3043a1f55d8a61042046e0fe1fd47df8c4b5
2017-05-26 14:02:00 -04:00
Bobby Holley
de6dd624ed Bug 1363375 - Pack nsINode better on 64-bit and stop conditionally compiling mServoData. r=smaug 2017-05-11 13:51:28 +02:00
Emilio Cobos Álvarez
1da66ba5c4 Bug 1355343: Move node restyle bits to Element, and add bits for snapshot handling. r=bholley
MozReview-Commit-ID: 6OrUKX5RcBq
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>

--HG--
extra : rebase_source : 83b38b7d67ce739160d3bb0efc89ed6f8f43092d
2017-04-16 08:16:24 +02:00
Kirk Steuber
7fdb378650 Bug 1359556 - Optimize cloneNode by preinitializing attribute and child arrays r=bz
Currently, attribute and child arrays (implemented in dom/base/nsAttrAndChildArray.h) start out empty. When cloning, the array ends up being resized multiple times in order to add the attributes and children that are being cloned from the original node. This would be quicker if the array was initialized to the correct size in the first place so that resizes are not necessary.

However, preallocating space for children is only necessary when performing a deep clone. Therefore, an additional parameter is being added to the Clone, CopyInnerTo, and CloneDocHelper methods to indicate whether preallocation of children should happen. Attributes are copied either way, so that part of the array is preallocated in both cases.

MozReview-Commit-ID: 3iVezeAKXnI

--HG--
extra : rebase_source : 9c3deec6d7aafd6411044d623d4863637b45fd58
2017-04-20 12:57:48 -07:00
Hiroyuki Ikezoe
bec36f074f Bug 1344966 - Add NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO to represent that an element's descendant has animation. r=heycam
MozReview-Commit-ID: GRumykMgGg0

--HG--
extra : rebase_source : 8b9675d1c56a0d2dd81532e28c03d85996f0cc7f
2017-03-27 06:17:07 +09:00
Mantaroh Yoshinaga
2558f6837e Bug 1062106 part 3 - Remove SMIL MappedAttribute mechanism. r=birtles
We can remove unnecesasary SMILMappedAttribute and SMILAttrAnimationRuleProcessor since earlier patches in this serieas mean this code is no longer used.

MozReview-Commit-ID: 5Rl5WFW5zZ1

--HG--
extra : rebase_source : cf2efca8d01c7e6cd5bd3b3b44d994c6cbb760e9
2017-03-21 15:45:58 +09:00
Iris Hsiao
96c6ba3303 Backed out 4 changesets (bug 1062106) for build bustage
Backed out changeset 7ac1fffb6a87 (bug 1062106)
Backed out changeset 7682b2da0437 (bug 1062106)
Backed out changeset e77bfa57be61 (bug 1062106)
Backed out changeset a565aca3013c (bug 1062106)
2017-03-21 16:41:18 +08:00
Mantaroh Yoshinaga
3b7e3f9116 Bug 1062106 part 3 - Remove SMIL MappedAttribute mechanism. r=birtles
We can remove unnecesasary SMILMappedAttribute and SMILAttrAnimationRuleProcessor since earlier patches in this serieas mean this code is no longer used.

MozReview-Commit-ID: 5Rl5WFW5zZ1

--HG--
extra : rebase_source : b051dce1d0f511e2e41be0b183a6f84654000309
2017-03-21 15:45:58 +09:00
Hiroyuki Ikezoe
495625f374 Bug 1341985 - GetAnimationCollection() takes const Element*. r=birtles
MozReview-Commit-ID: BPVROi9Ewzc

--HG--
extra : rebase_source : 599efa0aead37874e4e1c43ab793476d4adfe41d
2017-03-10 11:53:19 +09:00
Xidorn Quan
3ff59c9fc4 Bug 1340061 part 2 - Remove explicit base URI facility. r=bz
MozReview-Commit-ID: JaUzecbdT2F

--HG--
extra : rebase_source : df409ca400fbb2afe9b59e33585cb81fcedc962f
2017-02-16 18:35:52 +11:00
Bobby Holley
3df81392a2 Bug 1331322 - Add a flag to indicate that a node is native anonymous content. r=bholley
--HG--
extra : rebase_source : f32a12b6cca7f4a5d73dd2169414a745ddbf2926
2017-01-20 18:28:46 -08:00
Bobby Holley
b5ec1b1aa2 Bug 1331322 - Move MAY_HAVE_CLASS to mBoolFlags. r=bholley
This fits a bit better with the other stuff, and allows us to add our new NAC
bit with the other NAC related bits, which also happens to be a field that
Servo already has easy access to.

--HG--
extra : rebase_source : 52ef902eb3b23dc44cefec899b02c9180b76160c
2017-01-20 18:24:41 -08:00
Bobby Holley
cb5c414092 Bug 1331322 - Stop using a node bit for HasExplicitBaseURI. r=bholley
This is only called during URI resolution, and the proptable bit should make
this relatively fast.

--HG--
extra : rebase_source : 866dd136e6630db3ff7423e30d59151a01c258a6
2017-01-20 18:17:13 -08:00
Phil Ringnalda
d2fa909610 Backed out 4 changesets (bug 1331322) for Android reftest failures in 1169331-1.html and forced-bg-color-outside-visible-region.html
Backed out changeset 96c6b5a11284 (bug 1331322)
Backed out changeset 15877d32de7d (bug 1331322)
Backed out changeset 841d608704d7 (bug 1331322)
Backed out changeset 02096c5eb029 (bug 1331322)
2017-02-15 21:24:00 -08:00
Bobby Holley
4588a4f2db Bug 1331322 - Add a flag to indicate that a node is native anonymous content. r=bholley
--HG--
extra : rebase_source : f32a12b6cca7f4a5d73dd2169414a745ddbf2926
2017-01-20 18:28:46 -08:00
Bobby Holley
a15ed0dd31 Bug 1331322 - Move MAY_HAVE_CLASS to mBoolFlags. r=bholley
This fits a bit better with the other stuff, and allows us to add our new NAC
bit with the other NAC related bits, which also happens to be a field that
Servo already has easy access to.

--HG--
extra : rebase_source : 52ef902eb3b23dc44cefec899b02c9180b76160c
2017-01-20 18:24:41 -08:00
Bobby Holley
0b3d2c3886 Bug 1331322 - Stop using a node bit for HasExplicitBaseURI. r=bholley
This is only called during URI resolution, and the proptable bit should make
this relatively fast.

--HG--
extra : rebase_source : 866dd136e6630db3ff7423e30d59151a01c258a6
2017-01-20 18:17:13 -08:00
Boris Zbarsky
c9fc3601f5 Bug 1335368 part 22. Get rid of IsCallerChrome in geometry utils. r=dholbert 2017-02-01 15:43:59 -05:00
Boris Zbarsky
7583017cd2 Bug 1335368 part 5. Stop using IsCallerChrome in nsINode. r=bholley 2017-02-01 15:43:36 -05:00
Boris Zbarsky
c23f96a55c Bug 1330536 part 7. Change nsINode::GetTextContent to take an OOMReporter, not an ErrorResult. r=smaug 2017-01-17 23:52:29 -05:00
John Dai
9404a1745d Bug 1269155 - Revise Node.rootNode to Node.getRootNode. r=smaug 2017-01-16 01:46:00 +08:00
Cameron McCormack
a72478f6c9 Bug 1321284 - Part 2: Add nsINode::GetFlattenedTreeParentNodeForStyle. r=bholley
MozReview-Commit-ID: AmDyeE21N8g

--HG--
extra : rebase_source : 7e0d8f40ce513283f7262dca332fddc1e92ff810
2016-12-01 14:55:09 +08:00
Bobby Holley
f8c9d884fc Bug 1317016 - Basic infrastructure for RestyleHint-driven traversal. r=emilio
MozReview-Commit-ID: 7wH5XcILVmX
2016-11-25 10:06:39 -08:00
Boris Zbarsky
23cc88e459 Bug 1319255 part 2. Stop doing casts to HTMLContentElement* simply based on tag. r=wchen 2016-11-22 22:41:51 -05:00
Boris Zbarsky
3e49872974 Bug 1319255 part 1. Stop doing casts to HTMLShadowElement* simply based on tag. r=wchen 2016-11-22 22:41:51 -05:00
Boris Zbarsky
6393f96201 Bug 1318476. Remove various unused nsIDOMNode stuff. r=froydnj 2016-11-18 16:38:29 -05:00
Boris Zbarsky
0187a18084 Bug 1318096 part 1. Remove unused XPCOM querySelector(All) bits. r=froydnj 2016-11-17 13:49:26 -05:00
Xidorn Quan
76b59d891f Bug 1313262 - Devirtualize nsINode::{Get,Set,Delete,Unset}Property. r=peterv
MozReview-Commit-ID: B16VcIZKBs1

--HG--
extra : rebase_source : f4076901e376194d7db9fe03f27f1930b0931788
2016-10-27 12:40:34 +11:00
Manish Goregaokar
180ff22bac Bug 1308234 - Fix signatures of Servo_ functions to match servo glue; r=emilio
MozReview-Commit-ID: K0k93JoFVKb

--HG--
extra : rebase_source : 2b801262ca0cb2daef589c8e1cde31e5f22260b7
2016-10-06 20:58:01 +05:30
Bobby Holley
6351b3ffb8 Bug 1304913 - Have Servo manage node data directly without FFI calls. r=Manishearth
MozReview-Commit-ID: H8f8VP18TbM
2016-09-23 15:58:48 -07:00
Andrea Marchesini
3d45a22bac Bug 1301254 - nsINode::GetBaseURI() should be fallible, r=smaug 2016-09-20 14:02:33 +02:00
Nicholas Nethercote
e4eb76b618 Bug 1297300 - Add missing checks to GetSpec() calls in dom/base/. r=bz.
--HG--
extra : rebase_source : 55e83aad222825b2dd1399fa42eee6b6c894d0ee
2016-09-08 14:17:58 +10:00
Bobby Holley
0453dfa721 Bug 1292662 - Use accessors to unset stylo dirty bits. r=heycam
I often find myself wanting to hook them for logging etc, and this makes the
API symmetric with the setters.
2016-08-25 21:36:57 -07:00
Bobby Holley
92996399e8 Bug 1292279 - Explicitly handle dirtiness in BindToTree. r=heycam
Doing this in SetInDoc is kind of gross, and it leads to nice symmetry with
UnbindFromTree.
2016-08-25 21:34:27 -07:00