Opened 10 years ago
Closed 9 years ago
#13104 closed enhancement (fixed)
make padding / border / margin extent functions public?
Reported by: | bill | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | HTML | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
As per the mail about #9641...
Dijit is currently calling dojo._getMargin/Border/PaddingExtents() directly. Also _toPixelValue(). Perhaps these should be public API's?
Dijit's layout widgets call these methods to do top-down sizing. The simplest case to understand is for a ContentPane CP that contains a single layout widget LW. When the ContentPane's parent calls CP.resize({h: 350}), to set the ContentPane's margin-box size, the ContentPane calls something like LW.resize({h: 340}). The 10px is the ContentPane's border, padding, and maybe margin.
Seemingly an alternative using public API's would be:
- dojo.marginBox(CP.domNode, ...) -- set margin box on ContentPane
- cb = dojo.contentBox(CP.domNode) -- get content box of ContentPane
- dojo.marginBox(LW.domNode, cb) -- set content box of contained widget
However, this doesn't work very well. On some browsers querying computed style immediately after setting the style returns a wrong result. It's also inefficient in that it forces the browser to render.
Alternately to making these functions public, could have a method that returns a content-box given the margin-box:
dojo.marginBoxToContentBox(node, {h: 400, w: 300})
which would return something like:
{ h: 390, w: 290, l: 5, t: 5, r: 5, b: 5 }
Change History (7)
comment:1 Changed 10 years ago by
Type: | defect → enhancement |
---|
comment:2 Changed 10 years ago by
Summary: | make padding / border / margin functions public? → make padding / border / margin extent functions public? |
---|
comment:3 Changed 10 years ago by
Milestone: | tbd → 1.7 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:4 Changed 10 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
No, Bill, you request has to wait. It was reverted in [25745].
comment:5 Changed 10 years ago by
Milestone: | 1.7 → 1.8 |
---|
IIRC correctly we said to do these in 1.8? In any case, milestone shouldn't be marked as 1.7.
comment:6 Changed 9 years ago by
It looks like all requested changes are in Dojo Base already. Are we good to close these tickets?
comment:7 Changed 9 years ago by
Milestone: | 1.8 → 1.7 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Agreed, the changes are in [25901].
Public interfaces added to
dom/geometry
functions in [25704] of #9641.