/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is the Mozilla Inspector Module. * * The Initial Developer of the Original Code is * The Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Campbell (original author) * Mihai Șucan * Julian Viereck * Paul Rouget * Kyle Simpson * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ const Cu = Components.utils; const Ci = Components.interfaces; const Cr = Components.results; var EXPORTED_SYMBOLS = ["InspectorUI"]; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); const INSPECTOR_INVISIBLE_ELEMENTS = { "head": true, "base": true, "basefont": true, "isindex": true, "link": true, "meta": true, "script": true, "style": true, "title": true, }; // Inspector notifications dispatched through the nsIObserverService. const INSPECTOR_NOTIFICATIONS = { // Fires once the Inspector highlights an element in the page. HIGHLIGHTING: "inspector-highlighting", // Fires once the Inspector stops highlighting any element. UNHIGHLIGHTING: "inspector-unhighlighting", // Fires once the Inspector completes the initialization and opens up on // screen. OPENED: "inspector-opened", // Fires once the Inspector is closed. CLOSED: "inspector-closed", // Fires when the Tree Panel is opened and initialized. TREEPANELREADY: "inspector-treepanel-ready", // Event notifications for the attribute-value editor EDITOR_OPENED: "inspector-editor-opened", EDITOR_CLOSED: "inspector-editor-closed", EDITOR_SAVED: "inspector-editor-saved", }; /////////////////////////////////////////////////////////////////////////// //// Highlighter /** * A highlighter mechanism. * * The highlighter is built dynamically once the Inspector is invoked: * * ... * * * * * * * * * * * @param nsIDOMElement aParent * The container of the veil boxes. */ buildVeil: function Highlighter_buildVeil(aParent) { // We will need to resize these boxes to surround a node. // See highlightRectangle(). this.veilTopBox = this.chromeDoc.createElement("box"); this.veilTopBox.id = "highlighter-veil-topbox"; this.veilTopBox.className = "highlighter-veil"; this.veilMiddleBox = this.chromeDoc.createElement("hbox"); this.veilMiddleBox.id = "highlighter-veil-middlebox"; this.veilLeftBox = this.chromeDoc.createElement("box"); this.veilLeftBox.id = "highlighter-veil-leftbox"; this.veilLeftBox.className = "highlighter-veil"; this.veilTransparentBox = this.chromeDoc.createElement("box"); this.veilTransparentBox.id = "highlighter-veil-transparentbox"; // We don't need any references to veilRightBox and veilBottomBox. // These boxes are automatically resized (flex=1) let veilRightBox = this.chromeDoc.createElement("box"); veilRightBox.id = "highlighter-veil-rightbox"; veilRightBox.className = "highlighter-veil"; let veilBottomBox = this.chromeDoc.createElement("box"); veilBottomBox.id = "highlighter-veil-bottombox"; veilBottomBox.className = "highlighter-veil"; this.veilMiddleBox.appendChild(this.veilLeftBox); this.veilMiddleBox.appendChild(this.veilTransparentBox); this.veilMiddleBox.appendChild(veilRightBox); aParent.appendChild(this.veilTopBox); aParent.appendChild(this.veilMiddleBox); aParent.appendChild(veilBottomBox); }, /** * Build the controls: * * * * @param nsIDOMElement aParent * The container of the controls elements. */ buildControls: function Highlighter_buildControls(aParent) { this.buildCloseButton(aParent); this.buildInfobar(aParent); }, /** * Build the node Infobar. * * * * *