The default bug view has changed. See this FAQ.

[layout view] Show when the margin have the "auto" value

RESOLVED FIXED in Firefox 15

Status

()

Firefox
Developer Tools: Inspector
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: paul, Assigned: dcamp)

Tracking

Trunk
Firefox 15
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixed-in-fx-team])

Attachments

(1 attachment, 1 obsolete attachment)

Comment hidden (empty)
(Reporter)

Comment 1

5 years ago
So what is the right approach here?

I use the computed style for the border/padding/margins.

To figure out when the margin is auto, I need to start using the node rules and find which
one applies. Should I do that for all the values?
(Reporter)

Comment 2

5 years ago
I think I just need to get the "bestmatch" value from the property view.
(Reporter)

Comment 3

5 years ago
Created attachment 622691 [details] [diff] [review]
patch v1
(Reporter)

Updated

5 years ago
Attachment #622691 - Flags: review?(dcamp)
(Reporter)

Updated

5 years ago
Attachment #622691 - Flags: feedback?(mratcliffe)
(Reporter)

Comment 4

5 years ago
I am not confident about this approach. There might be a shorter path.
(Assignee)

Comment 5

5 years ago
Comment on attachment 622691 [details] [diff] [review]
patch v1

Review of attachment 622691 [details] [diff] [review]:
-----------------------------------------------------------------

If parsing the css styles is the best way to find this, maybe you could reuse ElementStyle from CssRuleView?

You can create an ElementStyle with your node, it'll do all the parsing you need.

ElementStyle.rules holds a list of Rule objects,
Rule.textProps has a list of TextProperty
TextProperty.computed has a list of the expanded shorthand properties.

Would that help you at all?
Comment on attachment 622691 [details] [diff] [review]
patch v1

Looks good but Dave does have a point ... using ElementStyle would simplify things slightly.
Attachment #622691 - Flags: feedback?(mratcliffe)
(Assignee)

Updated

5 years ago
Assignee: nobody → dcamp
(Assignee)

Comment 7

5 years ago
Created attachment 626891 [details] [diff] [review]
patch v2

ElementStyle would have simplified things a bit, but CssLogic simplifies them a lot.
Attachment #622691 - Attachment is obsolete: true
Attachment #622691 - Flags: review?(dcamp)
Attachment #626891 - Flags: review?(paul)
(Reporter)

Comment 8

5 years ago
Comment on attachment 626891 [details] [diff] [review]
patch v2

Much better :) Thanks.

># HG changeset patch
># User Paul Rouget <paul@mozilla.com>

You might want to change that.

>+const Cc = Components.classes;
>+const Ci = Components.interfaces;
> const Cu = Components.utils;
> Cu.import("resource://gre/modules/Services.jsm");
> Cu.import("resource:///modules/inspector.jsm");
> Cu.import("resource:///modules/devtools/LayoutHelpers.jsm");
>+Cu.import("resource:///modules/devtools/CssLogic.jsm");
> 
> var EXPORTED_SYMBOLS = ["LayoutView"];
> 
>+// Used to split on css line separators
>+const CSS_LINE_RE = /(?:[^;\(]*(?:\([^\)]*?\))?[^;\(]*)*;?/g;
>+
>+// Used to parse a single property line.
>+const CSS_PROP_RE = /\s*([^:\s]*)\s*:\s*(.*?)\s*(?:! (important))?;?$/;
>+

I don't think you need these changes anymore.
Attachment #626891 - Flags: review?(paul) → review+
(Assignee)

Comment 9

5 years ago
https://hg.mozilla.org/integration/fx-team/rev/4798809c94d6

(I made the changes from Comment 8)
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/4798809c94d6
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 15
You need to log in before you can comment on or make changes to this bug.