mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
Here we make updates on reflow slower (with a throttle) cause we don't really need to update live. We also filter all reflows that do not cause either the list of grids or the current outline to change. Finally, we also attach NodeActors to GridActor forms (when they are know) in order to avoid one more round-trip to the server. Globally, this makes performance of the grid panel far better on pages that cause many reflows. Note that this commit also fixes a debounce vs. throttle confusion that existed in an inspector utils file. The throttle function there was actually a debounce function, so it was renamed, and an actual throttle function was added. MozReview-Commit-ID: GeqgZR0o0E6
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
const { FrontClassWithSpec } = require("devtools/shared/protocol");
|
|
const { gridSpec, layoutSpec } = require("devtools/shared/specs/layout");
|
|
|
|
const GridFront = FrontClassWithSpec(gridSpec, {
|
|
form: function (form, detail) {
|
|
if (detail === "actorid") {
|
|
this.actorID = form;
|
|
return;
|
|
}
|
|
this._form = form;
|
|
},
|
|
|
|
/**
|
|
* In some cases, the GridActor already knows the NodeActor ID of the node where the
|
|
* grid is located. In such cases, this getter returns the NodeFront for it.
|
|
*/
|
|
get containerNodeFront() {
|
|
if (!this._form.containerNodeActorID) {
|
|
return null;
|
|
}
|
|
|
|
return this.conn.getActor(this._form.containerNodeActorID);
|
|
},
|
|
|
|
/**
|
|
* Getter for the grid fragments data.
|
|
*/
|
|
get gridFragments() {
|
|
return this._form.gridFragments;
|
|
}
|
|
});
|
|
|
|
const LayoutFront = FrontClassWithSpec(layoutSpec, {});
|
|
|
|
exports.GridFront = GridFront;
|
|
exports.LayoutFront = LayoutFront;
|