mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 1113761 - Allow decimal values in the layout view. r=jaws r=mratcliffe
This commit is contained in:
parent
87532d4e6e
commit
ef55f363e7
@ -9,8 +9,8 @@
|
||||
|
||||
// Expected values:
|
||||
let res1 = [
|
||||
{selector: "#element-size", value: "160" + "\u00D7" + "160"},
|
||||
{selector: ".size > span", value: "100" + "\u00D7" + "100"},
|
||||
{selector: "#element-size", value: "160" + "\u00D7" + "160.117"},
|
||||
{selector: ".size > span", value: "100" + "\u00D7" + "100.117"},
|
||||
{selector: ".margin.top > span", value: 30},
|
||||
{selector: ".margin.left > span", value: "auto"},
|
||||
{selector: ".margin.bottom > span", value: 30},
|
||||
@ -43,7 +43,7 @@ let res2 = [
|
||||
];
|
||||
|
||||
add_task(function*() {
|
||||
let style = "div { position: absolute; top: 42px; left: 42px; height: 100px; width: 100px; border: 10px solid black; padding: 20px; margin: 30px auto;}";
|
||||
let style = "div { position: absolute; top: 42px; left: 42px; height: 100.111px; width: 100px; border: 10px solid black; padding: 20px; margin: 30px auto;}";
|
||||
let html = "<style>" + style + "</style><div></div>"
|
||||
|
||||
yield addTab("data:text/html," + encodeURIComponent(html));
|
||||
|
@ -422,7 +422,7 @@ LayoutView.prototype = {
|
||||
// might be missing.
|
||||
continue;
|
||||
}
|
||||
let parsedValue = parseInt(layout[property]);
|
||||
let parsedValue = parseFloat(layout[property]);
|
||||
if (Number.isNaN(parsedValue)) {
|
||||
// Not a number. We use the raw string.
|
||||
// Useful for "position" for example.
|
||||
@ -451,9 +451,10 @@ LayoutView.prototype = {
|
||||
|
||||
width -= this.map.borderLeft.value + this.map.borderRight.value +
|
||||
this.map.paddingLeft.value + this.map.paddingRight.value;
|
||||
|
||||
width = parseFloat(width.toPrecision(6));
|
||||
height -= this.map.borderTop.value + this.map.borderBottom.value +
|
||||
this.map.paddingTop.value + this.map.paddingBottom.value;
|
||||
height = parseFloat(height.toPrecision(6));
|
||||
|
||||
let newValue = width + "\u00D7" + height;
|
||||
if (this.sizeLabel.textContent != newValue) {
|
||||
|
@ -1319,7 +1319,7 @@ BoxModelHighlighter.prototype = Heritage.extend(AutoRefreshHighlighter.prototype
|
||||
}
|
||||
|
||||
let rect = this.currentQuads.border.bounds;
|
||||
let dim = Math.ceil(rect.width) + " \u00D7 " + Math.ceil(rect.height);
|
||||
let dim = parseFloat(rect.width.toPrecision(6)) + " \u00D7 " + parseFloat(rect.height.toPrecision(6));
|
||||
|
||||
let elementId = this.ID_CLASS_PREFIX + "nodeinfobar-";
|
||||
this.markup.setTextContentForElement(elementId + "tagname", tagName);
|
||||
|
@ -747,8 +747,8 @@ var PageStyleActor = protocol.ActorClass({
|
||||
// the size of the element.
|
||||
|
||||
let clientRect = node.rawNode.getBoundingClientRect();
|
||||
layout.width = Math.ceil(clientRect.width);
|
||||
layout.height = Math.ceil(clientRect.height);
|
||||
layout.width = parseFloat(clientRect.width.toPrecision(6));
|
||||
layout.height = parseFloat(clientRect.height.toPrecision(6));
|
||||
|
||||
// We compute and update the values of margins & co.
|
||||
let style = CssLogic.getComputedStyle(node.rawNode);
|
||||
@ -776,7 +776,7 @@ var PageStyleActor = protocol.ActorClass({
|
||||
|
||||
for (let i in this.map) {
|
||||
let property = this.map[i].property;
|
||||
this.map[i].value = parseInt(style.getPropertyValue(property));
|
||||
this.map[i].value = parseFloat(style.getPropertyValue(property));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user