Closed Bug 747225 Opened 12 years ago Closed 12 years ago

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

Categories

(DevTools :: Inspector, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 15

People

(Reporter: paul, Assigned: dcamp)

References

Details

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

Attachments

(1 file, 1 obsolete file)

      No description provided.
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?
I think I just need to get the "bestmatch" value from the property view.
Attached patch patch v1 (obsolete) — Splinter Review
Attachment #622691 - Flags: review?(dcamp)
Attachment #622691 - Flags: feedback?(mratcliffe)
I am not confident about this approach. There might be a shorter path.
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: nobody → dcamp
Attached patch patch v2Splinter Review
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)
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+
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
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 15
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: