VOOZH about

URL: https://bugzilla.mozilla.org/1717176

⇱ 1717176 - Can't change content in box model in inspector for box-sizing:border-box elements


Closed Bug 1717176 Opened 4 years ago Closed 1 month ago

Can't change content in box model in inspector for box-sizing:border-box elements

Can't change content in box model in inspector for box-sizing:border-box elements
DevTools
Inspector
Trunk
Unspecified
Unspecified
defect
Points:
---
RESOLVED FIXED
RESOLVED
FIXED
152 Branch
Iteration:
---
a11y-review
Accessibility Severity
Performance Impact
Webcompat Priority
Webcompat Score
Tracking Status
firefox152 --- fixed
Tracking Status
relnote-firefox
firefox-esr115
firefox-esr140
firefox-esr153
firefox152
firefox153
firefox154
---
QA Whiteboard:
[qa-triage-done-c153/b152]
Has STR:
---
Change Request:
---
Bug Flags:
Signature:
None
This bug is publicly visible.

 
Reporter

Description

β€’
4 years ago
Attached image pbfirefox.PNG β€” Details

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

Steps to reproduce:

Open the inspector, go to box model and try to change the content box.

Actual results:

When I open inspector, for some page I can edit everything I want but on some website, when I tried to edit the "content" part of the "model box", I can't change the values. I can chage everything else : pading, border ...

I'm talking about the blue part of the model box on my screenshot.

Expected results:

Should be able to edit

Reporter

Comment 1

β€’
4 years ago

I forgot one thing : I can make the changes using others web browsers like Chrome but I don't want to use it besause the firefox inspector is way better.

The Bugbug bot thinks this bug should belong to the 'DevTools::Inspector' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged β†’ Inspector
Product: Firefox β†’ DevTools

Thanks for filing.

Ni to myself, we don't seem to allow to update the content size for border-box elements.
Check behavior on Chrome, and check where this is handled in FF DevTools.

Severity: -- β†’ S3
Flags: needinfo?(jdescottes)
Priority: -- β†’ P3

We only allow to edit the width/height of elements with box-sizing: content-box: https://searchfox.org/mozilla-central/rev/b355f4e36eb45ef84ce9d3dd6af7f1a417ca8bfe/devtools/client/inspector/boxmodel/components/BoxModelMain.js#441

This was briefly mentioned in the initial implementation: https://bugzilla.mozilla.org/show_bug.cgi?id=1061823#c20
I think the reason is pretty straightforward: when you start applying this to border-box elements, the actual width and height of the content don't match directly the width & height properties you would set in the element style.

And for instance in Chrome, if you update the dimension of an element which has some padding & border, Chrome will actually add the relevant padding and border to your input.

This still sounds like something we should implement. The first thing to change will be to remove the box-sizing check mentioned above. And then modify the logic applied when a value is modified so that box-model elements include border+padding in the content value: https://searchfox.org/mozilla-central/rev/b355f4e36eb45ef84ce9d3dd6af7f1a417ca8bfe/devtools/client/inspector/boxmodel/box-model.js#341-361

I don't think it's a good first bug, but it is scoped well enough, happy to mentor.

Mentor: jdescottes
Status: UNCONFIRMED β†’ NEW
Ever confirmed: true
Flags: needinfo?(jdescottes)
Summary: Can't change content in box model in inspector β†’ Can't change content in box model in inspector for box-sizing:border-box elements
Version: 78 Branch β†’ Trunk

Hi Julian, I'd like to work on this bug if assigned. Thanks!

Flags: needinfo?(jdescottes)

Sure Sai! Thanks for offering to help, let me know if you need pointers on top of what is in the previous comment.

Assignee: nobody β†’ saihemanth9019
Status: NEW β†’ ASSIGNED
Flags: needinfo?(jdescottes)

Thanks Julian. I've submitted an initial revision, that only works for pixels. Please check if the approach looks right.

A couple of questions,

  1. Is there a utility function/class that can convert between the different CSS units?
  2. Are there any edge cases that I'm missing in the revision?
Flags: needinfo?(jdescottes)
Attachment #9266672 - Attachment description: Bug 1717176 - Add height/width box-model edit support for border-box elements. r=jdescottes` β†’ Bug 1717176 - Add height/width box-model edit support for border-box elements. r=jdescottes
Attachment #9266672 - Attachment is obsolete: true
Comment hidden (off-topic)
Assignee: saihemanth9019 β†’ nobody
Status: ASSIGNED β†’ NEW

Sorry, there was a problem with the detection of inactive users. I'm reverting the change.

Assignee: nobody β†’ saihemanth9019
Status: NEW β†’ ASSIGNED

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: saihemanth9019 β†’ nobody
Status: ASSIGNED β†’ NEW

provided feedback in phabricator

Flags: needinfo?(jdescottes)
Assignee: nobody β†’ mahmutovicrahman5
Status: NEW β†’ ASSIGNED

Submitted patch: https://phabricator.services.mozilla.com/D298689

The fix removes the content-box-only restriction in BoxModelMain.js and adds border+padding compensation math in box-model.js so that the CSS width/height is correctly computed for border-box elements, matching Chrome's behavior.

Comment 16

β€’
1 month ago
Pushed by jdescottes@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/d1096758cce0 https://hg.mozilla.org/integration/autoland/rev/087f1c8171e0 Allow box model width/height editing for border-box elements r=jdescottes,devtools-reviewers

Comment 17

β€’
1 month ago
Pushed by sstanca@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/42ea3ba1c077 https://hg.mozilla.org/integration/autoland/rev/30a2d7fc82c2 Revert "Bug 1717176 - Allow box model width/height editing for border-box elements r=jdescottes,devtools-reviewers" for causing devtools failures in browser_boxmodel_update-after-navigation.js.

Reverted this because it was causing devtools failures in browser_boxmodel_update-after-navigation.js.

  • Revert link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | devtools/client/inspector/boxmodel/test/browser_boxmodel_update-after-navigation.js | undefined - Got "Γ—", expected "100Γ—100"
Flags: needinfo?(mahmutovicrahman5)

Nothing complicated here, we just need to update https://searchfox.org/firefox-main/rev/1372522d3de2c9aeedc8020ec8d81326f1a9516e/devtools/client/inspector/boxmodel/test/browser_boxmodel_update-after-navigation.js#61

const sizeElt = boxmodel.document.querySelector(".boxmodel-size > span");

This should become

const sizeElt = boxmodel.document.querySelector(".boxmodel-size");

The rest of the test should pass just fine (the span now only contains the Γ— symbol).

Updated the selector in browser_boxmodel_update-after-navigation.js from ".boxmodel-size > span" to ".boxmodel-size" to fix the test failure.

New patch: https://phabricator.services.mozilla.com/D299824

Flags: needinfo?(mahmutovicrahman5)
Attachment #9585279 - Attachment is obsolete: true

Comment 22

β€’
1 month ago
Pushed by jdescottes@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/905f035605df https://hg.mozilla.org/integration/autoland/rev/caf6f9385833 Allow box model width/height editing for border-box elements r=jdescottes,devtools-reviewers

Comment 23

β€’
1 month ago
bugherder
Status: ASSIGNED β†’ RESOLVED
Closed: 1 month ago
Resolution: --- β†’ FIXED
Target Milestone: --- β†’ 152 Branch
QA Whiteboard: [qa-triage-done-c153/b152]
You need to log in before you can comment on or make changes to this bug.