Commit 2a111dbf authored by Nicolas Chevobbe's avatar Nicolas Chevobbe
Browse files

Bug 1732334 - [devtools] Fix CSS Shape Editor on iframe with dedicated target. r=jdescottes.

parent 0aef0dd1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ add_task(async function() {
    "Shapes highlighter toggle is active."
  );
  ok(
    highlighters.highlighters[HIGHLIGHTER_TYPE],
    inspector.inspectorFront.getKnownHighlighter(HIGHLIGHTER_TYPE).actorID,
    "CSS shapes highlighter created in the rule-view."
  );
  ok(highlighters.shapesHighlighterShown, "CSS shapes highlighter is shown.");
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ add_task(async function() {
    "shapes highlighter toggle is active."
  );
  ok(
    highlighters.highlighters[HIGHLIGHTER_TYPE],
    inspector.inspectorFront.getKnownHighlighter(HIGHLIGHTER_TYPE).actorID,
    "CSS shapes highlighter created in the rule-view."
  );
  ok(highlighters.shapesHighlighterShown, "CSS shapes highlighter is shown.");
+3 −3
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ add_task(async function() {
    "Checking the CSS shapes highlighter is created and transform mode is on"
  );
  ok(
    highlighters.highlighters[HIGHLIGHTER_TYPE],
    inspector.inspectorFront.getKnownHighlighter(HIGHLIGHTER_TYPE).actorID,
    "CSS shapes highlighter created in the rule-view."
  );
  ok(highlighters.shapesHighlighterShown, "CSS shapes highlighter is shown.");
@@ -67,7 +67,7 @@ add_task(async function() {
    "Checking the CSS shapes highlighter is created and transform mode is off"
  );
  ok(
    highlighters.highlighters[HIGHLIGHTER_TYPE],
    inspector.inspectorFront.getKnownHighlighter(HIGHLIGHTER_TYPE).actorID,
    "CSS shapes highlighter created in the rule-view."
  );
  ok(highlighters.shapesHighlighterShown, "CSS shapes highlighter is shown.");
@@ -91,7 +91,7 @@ add_task(async function() {
    "Checking the CSS shapes highlighter is created and transform mode is on"
  );
  ok(
    highlighters.highlighters[HIGHLIGHTER_TYPE],
    inspector.inspectorFront.getKnownHighlighter(HIGHLIGHTER_TYPE).actorID,
    "CSS shapes highlighter created in the rule-view."
  );
  ok(highlighters.shapesHighlighterShown, "CSS shapes highlighter is shown.");
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ add_task(async function() {
      `Shapes highlighter toggle active for ${selector}`
    );
    ok(
      highlighters.highlighters[HIGHLIGHTER_TYPE],
      inspector.inspectorFront.getKnownHighlighter(HIGHLIGHTER_TYPE).actorID,
      `Shapes highlighter instance created for ${selector}`
    );
    ok(
+12 −6
Original line number Diff line number Diff line
@@ -726,7 +726,7 @@ class HighlightersOverlay {
   *        TextProperty where to write changes.
   */
  async toggleShapesHighlighter(node, options, textProperty) {
    const shapesEditor = await this.getInContextEditor("shapesEditor");
    const shapesEditor = await this.getInContextEditor(node, "shapesEditor");
    if (!shapesEditor) {
      return;
    }
@@ -743,7 +743,7 @@ class HighlightersOverlay {
   *         Object used for passing options to the shapes highlighter.
   */
  async showShapesHighlighter(node, options) {
    const shapesEditor = await this.getInContextEditor("shapesEditor");
    const shapesEditor = await this.getInContextEditor(node, "shapesEditor");
    if (!shapesEditor) {
      return;
    }
@@ -770,9 +770,11 @@ class HighlightersOverlay {
   * Hide the shapes highlighter if visible.
   * This method delegates the to the in-context shapes editor which wraps
   * the shapes highlighter with additional functionality.
   *
   * @param  {NodeFront} node.
   */
  async hideShapesHighlighter() {
    const shapesEditor = await this.getInContextEditor("shapesEditor");
  async hideShapesHighlighter(node) {
    const shapesEditor = await this.getInContextEditor(node, "shapesEditor");
    if (!shapesEditor) {
      return;
    }
@@ -1388,12 +1390,13 @@ class HighlightersOverlay {
   * need to write value changes back to something, like to properties in the Rule view.
   * They typically exist in the context of the page, like the ShapesInContextEditor.
   *
   * @param  {NodeFront} node.
   * @param  {String} type
   *         Type of in-context editor. Currently supported: "shapesEditor"
   * @return {Object|null}
   *         Reference to instance for given type of in-context editor or null.
   */
  async getInContextEditor(type) {
  async getInContextEditor(node, type) {
    if (this.editors[type]) {
      return this.editors[type];
    }
@@ -1402,7 +1405,10 @@ class HighlightersOverlay {

    switch (type) {
      case "shapesEditor":
        const highlighter = await this._getHighlighter("ShapesHighlighter");
        const highlighter = await this._getHighlighterTypeForNode(
          "ShapesHighlighter",
          node
        );
        if (!highlighter) {
          return null;
        }
Loading