/* 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 { AutoRefreshHighlighter, } = require("resource://devtools/server/actors/highlighters/auto-refresh.js"); const { CanvasFrameAnonymousContentHelper, getBindingElementAndPseudo, hasPseudoClassLock, isNodeValid, moveInfobar, } = require("resource://devtools/server/actors/highlighters/utils/markup.js"); const { PSEUDO_CLASSES, } = require("resource://devtools/shared/css/constants.js"); const { getCurrentZoom, setIgnoreLayoutChanges, } = require("resource://devtools/shared/layout/utils.js"); const { getNodeDisplayName, getNodeGridFlexType, } = require("resource://devtools/server/actors/inspector/utils.js"); const nodeConstants = require("resource://devtools/shared/dom-node-constants.js"); loader.lazyGetter(this, "HighlightersBundle", () => { return new Localization(["devtools/shared/highlighters.ftl"], true); }); // Note that the order of items in this array is important because it is used // for drawing the BoxModelHighlighter's path elements correctly. const BOX_MODEL_REGIONS = ["margin", "border", "padding", "content"]; const BOX_MODEL_SIDES = ["top", "right", "bottom", "left"]; // Width of boxmodelhighlighter guides const GUIDE_STROKE_WIDTH = 1; /** * The BoxModelHighlighter draws the box model regions on top of a node. * If the node is a block box, then each region will be displayed as 1 polygon. * If the node is an inline box though, each region may be represented by 1 or * more polygons, depending on how many line boxes the inline element has. * * Usage example: * * let h = new BoxModelHighlighter(env); * h.show(node, options); * h.hide(); * h.destroy(); * * @param {String} options.region * Specifies the region that the guides should outline: * "content" (default), "padding", "border" or "margin". * @param {Boolean} options.hideGuides * Defaults to false * @param {Boolean} options.hideInfoBar * Defaults to false * @param {String} options.showOnly * If set, only this region will be highlighted. Use with onlyRegionArea * to only highlight the area of the region: * "content", "padding", "border" or "margin" * @param {Boolean} options.onlyRegionArea * This can be set to true to make each region's box only highlight the * area of the corresponding region rather than the area of nested * regions too. This is useful when used with showOnly. * * Structure: *