You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fetch margins, padding, and borders for layout inspector #3598
A-devtoolsC-assignedThere is someone working on resolving the issueE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the iss
See the "getLayout" message in components/devtools/actors/inspector.rs. Currently we only fetch the width and height; instead we want to adjust the code in handle_get_layout to query the layout properties using LayoutRPC, rather than just calling getBoundingClientRect.
It will probably be easier to fix this once we have #1722 implemented, since what we want to return to the devtools here is the computed style for elements. I don't have a good idea of how to obtain that information right now, otherwise.
Determining autoMargins is gonna be tricky. I hope to take a look at that over the next couple of days.
Perhaps someone can look at my progress in the meantime. I have one question in particular: Should I stick with rustc_serialize or is it alright to use serde_json?
From a readability point of view I'm very much in favor of serde. It allows for JSON property names such as "margin-top" without having to manually construct HashMaps. However, I'll gladly rewrite that part if other factors outweigh the readibility argument.
I've added the missing implementation for autoMargins. However, I can't say that I like it. It is based on a new ReflowQueryType just for the autoMargins; essentially devtools UI specific code in the layout and script components.
Firefox's devtools base autoMargins on DOMUtils.getCSSStyleRules, on which most of the style inspector is based anyways. I'm wondering if it would not be better to defer implementation of autoMargins until similar functionality is available in servo.
I don't think it's worth deferring. These things happen, and we can refactor it if there's a need for similar functionality at some other point in the future.
A-devtoolsC-assignedThere is someone working on resolving the issueE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the iss
Activity
gilles-leblanc commentedon Oct 17, 2014
I'd like to have a look at this one.
jdm commentedon Oct 17, 2014
It will probably be easier to fix this once we have #1722 implemented, since what we want to return to the devtools here is the computed style for elements. I don't have a good idea of how to obtain that information right now, otherwise.
gilles-leblanc commentedon Oct 17, 2014
Ok, I'll wait for #1722 and turn my attention to another issue in the mean time.
Thanks for the heads up.
jdm commentedon Aug 3, 2015
getComputedStyle exists now!
benschulz commentedon Aug 15, 2015
Determining
autoMarginsis gonna be tricky. I hope to take a look at that over the next couple of days.Perhaps someone can look at my progress in the meantime. I have one question in particular: Should I stick with rustc_serialize or is it alright to use serde_json?
From a readability point of view I'm very much in favor of serde. It allows for JSON property names such as
"margin-top"without having to manually constructHashMaps. However, I'll gladly rewrite that part if other factors outweigh the readibility argument.jdm commentedon Aug 15, 2015
If serde makes it easier, go right ahead. You can also file an issue to convert the existing code that uses rustc_serialize, or do the work yourself.
jdm commentedon Aug 15, 2015
Current progress looks great to me!
benschulz commentedon Aug 16, 2015
I've added the missing implementation for
autoMargins. However, I can't say that I like it. It is based on a newReflowQueryTypejust for theautoMargins; essentially devtools UI specific code in the layout and script components.Firefox's devtools base
autoMarginsonDOMUtils.getCSSStyleRules, on which most of the style inspector is based anyways. I'm wondering if it would not be better to defer implementation ofautoMarginsuntil similar functionality is available in servo.For reference:
autoMarginsimplementationjdm commentedon Aug 16, 2015
I don't think it's worth deferring. These things happen, and we can refactor it if there's a need for similar functionality at some other point in the future.
jdm commentedon Aug 16, 2015
That being said, if we're only checking the computed style values, we might be able to directly access them from script/ using http://mxr.mozilla.org/servo/source/components/script/dom/node.rs#214 (from http://mxr.mozilla.org/servo/source/components/script/dom/node.rs#120).
KiChjang commentedon Dec 1, 2015
@benschulz what's the status of this?
benschulz commentedon Dec 1, 2015
Sorry, I didn't properly link this issue with PR #7267.
Auto merge of #9661 - jdm:devtools-inspector-get-layout, r=pcwalton