Backed out changeset 3f196fc740be (bug 1383870) for browser_inspector_highlighter-cssshape_05.js timeouts

MozReview-Commit-ID: 8w7bSd23fIt
This commit is contained in:
Phil Ringnalda 2017-10-10 22:09:03 -07:00
Родитель 613b021bcb
Коммит 79008a0604
4 изменённых файлов: 5 добавлений и 36 удалений

Просмотреть файл

@ -974,9 +974,6 @@ TextPropertyEditor.prototype = {
let selector = `.ruleview-shape-point.active`; let selector = `.ruleview-shape-point.active`;
for (let pointNode of ruleViewEl.querySelectorAll(selector)) { for (let pointNode of ruleViewEl.querySelectorAll(selector)) {
this._toggleShapePointActive(pointNode, false); this._toggleShapePointActive(pointNode, false);
// Emit event for unit tests when point is hovered on highlighter
// and same point is highlighted in rule view
this.ruleView.emit("ruleview-shape-point-highlight");
} }
if (typeof point === "string") { if (typeof point === "string") {
@ -992,9 +989,6 @@ TextPropertyEditor.prototype = {
let nodeInfo = view.getNodeInfo(pointNode); let nodeInfo = view.getNodeInfo(pointNode);
if (highlighters.isRuleViewShapePoint(nodeInfo)) { if (highlighters.isRuleViewShapePoint(nodeInfo)) {
this._toggleShapePointActive(pointNode, true); this._toggleShapePointActive(pointNode, true);
// Emit event for unit tests when point is hovered on highlighter
// and same point is highlighted in rule view
this.ruleView.emit("ruleview-shape-point-highlight");
} }
} }
} }

Просмотреть файл

@ -72,7 +72,7 @@ function* highlightFromHighlighter(view, highlighters, testActor, helper) {
let container = getRuleViewProperty(view, "#polygon", "clip-path").valueSpan; let container = getRuleViewProperty(view, "#polygon", "clip-path").valueSpan;
info("Hover over first point in highlighter"); info("Hover over first point in highlighter");
let onEventHandled = view.once("ruleview-shape-point-highlight"); let onEventHandled = highlighters.once("highlighter-event-handled");
yield mouse.move(0, 0); yield mouse.move(0, 0);
yield onEventHandled; yield onEventHandled;
let markerHidden = yield testActor.getHighlighterNodeAttribute( let markerHidden = yield testActor.getHighlighterNodeAttribute(
@ -99,7 +99,7 @@ function* highlightFromHighlighter(view, highlighters, testActor, helper) {
"Hovered point is saved to state after moving point"); "Hovered point is saved to state after moving point");
info("Move mouse off point"); info("Move mouse off point");
onEventHandled = view.once("ruleview-shape-point-highlight"); onEventHandled = highlighters.once("highlighter-event-handled");
yield mouse.move(100, 100); yield mouse.move(100, 100);
yield onEventHandled; yield onEventHandled;
markerHidden = yield testActor.getHighlighterNodeAttribute( markerHidden = yield testActor.getHighlighterNodeAttribute(

Просмотреть файл

@ -515,7 +515,7 @@ exports.CustomHighlighterActor = protocol.ActorClassWithSpec(customHighlighterSp
/** /**
* Upon receiving an event from the highlighter, forward it to the client. * Upon receiving an event from the highlighter, forward it to the client.
*/ */
_onHighlighterEvent: function (data) { _onHighlighterEvent: function (type, data) {
this.emit("highlighter-event", data); this.emit("highlighter-event", data);
}, },

Просмотреть файл

@ -6,8 +6,7 @@
const { CanvasFrameAnonymousContentHelper, getCSSStyleRules, const { CanvasFrameAnonymousContentHelper, getCSSStyleRules,
createSVGNode, createNode, getComputedStyle } = require("./utils/markup"); createSVGNode, createNode, getComputedStyle } = require("./utils/markup");
const { setIgnoreLayoutChanges, getCurrentZoom, const { setIgnoreLayoutChanges, getCurrentZoom } = require("devtools/shared/layout/utils");
getAdjustedQuads } = require("devtools/shared/layout/utils");
const { AutoRefreshHighlighter } = require("./auto-refresh"); const { AutoRefreshHighlighter } = require("./auto-refresh");
const { const {
getDistance, getDistance,
@ -177,27 +176,6 @@ class ShapesHighlighter extends AutoRefreshHighlighter {
}; };
} }
get frameDimensions() {
// In an iframe, we get the node's quads relative to the frame,
// instead of the parent document.
let dims = getAdjustedQuads(this.currentNode.ownerGlobal,
this.currentNode, this.referenceBox)[0].bounds;
let zoom = getCurrentZoom(this.win);
if (this.currentNode.getBBox &&
getComputedStyle(this.currentNode).stroke !== "none" && !this.useStrokeBox) {
dims = getObjectBoundingBox(dims.top, dims.left,
dims.width, dims.height, this.currentNode);
}
return {
top: dims.top / zoom,
left: dims.left / zoom,
width: dims.width / zoom,
height: dims.height / zoom
};
}
handleEvent(event, id) { handleEvent(event, id) {
// No event handling if the highlighter is hidden // No event handling if the highlighter is hidden
if (this.areShapesHidden()) { if (this.areShapesHidden()) {
@ -724,10 +702,7 @@ class ShapesHighlighter extends AutoRefreshHighlighter {
* in percentages relative to the element. * in percentages relative to the element.
*/ */
convertPageCoordsToPercent(pageX, pageY) { convertPageCoordsToPercent(pageX, pageY) {
// If the current node is in an iframe, we get dimensions relative to the frame. let { top, left, width, height } = this.zoomAdjustedDimensions;
let dims = (this.highlighterEnv.window.document === this.currentNode.ownerDocument) ?
this.zoomAdjustedDimensions : this.frameDimensions;
let { top, left, width, height } = dims;
pageX -= left; pageX -= left;
pageY -= top; pageY -= top;
let percentX = pageX * 100 / width; let percentX = pageX * 100 / width;