Open Bug 1622308 Opened 4 years ago Updated 2 years ago

Improve resizing column to fit content

Categories

(DevTools :: Netmonitor, enhancement, P4)

enhancement

Tracking

(Not tracked)

People

(Reporter: farooqbckk, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

Actual results:

The "Resize column to fit content" currently works by calculating the widths of cells' content in a column and resizing that column to the max width as much as possible.

A cell's content width is calculated by accumulating widths of its nodes, in this way:

  1. If it's a text node, get width from boxQuads.
  2. Otherwise, getBoundingClientRect().width

Expected results:

Problem is, this does not take into account the paddings and margins a node might have. We could add some constant to the resulting width to mitigate this problem and it would work well for most cases but ... we could be better.

One solution may be to use getComputedStyles to get paddings/margins, but it's a bit expensive though.

Severity: normal → minor
Component: Untriaged → Netmonitor
Priority: -- → P4
Product: Firefox → DevTools
Keywords: good-first-bug

I am applying for GSoC this year, this is a good first issue
Can I work on this??

I don't know what the right solution should be here but, perhaps you could work together with @Farooq AR? (also GSoC)

Honza

(In reply to ashu from comment #1)

I am applying for GSoC this year, this is a good first issue
Can I work on this??

Sure! Ping me on slack if you need any help :)

Flags: needinfo?(ashusingh15673)
Flags: needinfo?(ashusingh15673)
Assignee: nobody → ashusingh15673
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

I am thinking of .computedStyleMap to get the specific padding using .get() from the list of all the style properties and then add to cell content width.
Possible code
headerRef.computedStyleMap.get("padding")
IS this applicable ?
Farooq AR already said this was expensive so I am also searching for another possible solution

@ashu Were you able to find anything?

Flags: needinfo?(ashusingh15673)

No I was not, please reassign

Flags: needinfo?(ashusingh15673)

(In reply to ashu from comment #6)

No I was not, please reassign

You are still assigned :)

I mean unassign me, I am otherwise occupied and cannot work on this
Thanks

Sure, thanks for giving it a try :)
@Honza could you remove the assignee?

Flags: needinfo?(odvarko)

@Farooq, thanks for the update!
(let me know if I should assign you)

Done

Honza

Assignee: ashusingh15673 → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(odvarko)
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.