Bug 1255351 - box model highlighter: all the guidelines now are overlap the node; r=gl

This patch is fixing the issue mostly for 1dppx / 1dpi display.
For higher dpi a follow-up bug will be made once bug 1345917 and bug 1151421
are fixed; and it will be part of bug 1187970.

MozReview-Commit-ID: 7XuED9ydGvB

--HG--
extra : rebase_source : 3d47ee5c7c7a60f712fe23072bb8686eac0b8dc8
This commit is contained in:
Matteo Ferretti 2017-03-10 02:32:09 +01:00
parent 36e975f98c
commit bec7538bbf
4 changed files with 19 additions and 19 deletions

View File

@ -63,12 +63,12 @@ add_task(function* () {
let contentRect = yield testActor.getGuidesRectangle();
for (let point of ["p1", "p2", "p3", "p4"]) {
is((contentRect[point].x),
(expectedContentRect[point].x),
is(Math.round(contentRect[point].x),
(Math.round(expectedContentRect[point].x)),
"x coordinate of point " + point +
" of the content rectangle defined by the outer guides is correct");
is((contentRect[point].y),
(expectedContentRect[point].y),
is(Math.round(contentRect[point].y),
(Math.round(expectedContentRect[point].y)),
"y coordinate of point " + point +
" of the content rectangle defined by the outer guides is correct");
}

View File

@ -118,10 +118,10 @@ const TEST_DATA = [
let {points} = yield testActor.getHighlighterRegionPath("padding");
points = points[0];
is(Math.ceil(topY1), points[0][1], "Top guide's y1 is correct");
is(Math.floor(rightX1), points[1][0], "Right guide's x1 is correct");
is(Math.floor(bottomY1), points[2][1], "Bottom guide's y1 is correct");
is(Math.ceil(leftX1), points[3][0], "Left guide's x1 is correct");
is(topY1, points[0][1], "Top guide's y1 is correct");
is(rightX1, points[1][0] - 1, "Right guide's x1 is correct");
is(bottomY1, points[2][1] - 1, "Bottom guide's y1 is correct");
is(leftX1, points[3][0], "Left guide's x1 is correct");
}
},
{
@ -140,10 +140,10 @@ const TEST_DATA = [
let {points} = yield testActor.getHighlighterRegionPath("margin");
points = points[0];
is(Math.ceil(topY1), points[0][1], "Top guide's y1 is correct");
is(Math.floor(rightX1), points[1][0], "Right guide's x1 is correct");
is(Math.floor(bottomY1), points[2][1], "Bottom guide's y1 is correct");
is(Math.ceil(leftX1), points[3][0], "Left guide's x1 is correct");
is(topY1, points[0][1], "Top guide's y1 is correct");
is(rightX1, points[1][0] - 1, "Right guide's x1 is correct");
is(bottomY1, points[2][1] - 1, "Bottom guide's y1 is correct");
is(leftX1, points[3][0], "Left guide's x1 is correct");
}
},
{

View File

@ -1060,9 +1060,9 @@ var TestActorFront = exports.TestActorFront = protocol.FrontClassWithSpec(testSp
return {
p1: {x: lGuide.x1, y: tGuide.y1},
p2: {x: rGuide.x1, y: tGuide. y1},
p3: {x: rGuide.x1, y: bGuide.y1},
p4: {x: lGuide.x1, y: bGuide.y1}
p2: {x: +rGuide.x1 + 1, y: tGuide.y1},
p3: {x: +rGuide.x1 + 1, y: +bGuide.y1 + 1},
p4: {x: lGuide.x1, y: +bGuide.y1 + 1}
};
}),

View File

@ -601,10 +601,10 @@ BoxModelHighlighter.prototype = extend(AutoRefreshHighlighter.prototype, {
}
// Move guide into place or hide it if no valid co-ordinate was found.
this._updateGuide("top", toShowY[0]);
this._updateGuide("right", toShowX[1]);
this._updateGuide("bottom", toShowY[1]);
this._updateGuide("left", toShowX[0]);
this._updateGuide("top", Math.round(toShowY[0]));
this._updateGuide("right", Math.round(toShowX[1]) - 1);
this._updateGuide("bottom", Math.round(toShowY[1] - 1));
this._updateGuide("left", Math.round(toShowX[0]));
},
_hideGuides: function () {