Opened 8 years ago

Closed 7 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:

  1. dojo.marginBox(CP.domNode, ...) -- set margin box on ContentPane
  2. cb = dojo.contentBox(CP.domNode) -- get content box of ContentPane
  3. 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 8 years ago by bill

Type: defectenhancement

comment:2 Changed 8 years ago by bill

Summary: make padding / border / margin functions public?make padding / border / margin extent functions public?

comment:3 Changed 8 years ago by Eugene Lazutkin

Milestone: tbd1.7
Resolution: fixed
Status: newclosed

Public interfaces added to dom/geometry functions in [25704] of #9641.

comment:4 Changed 8 years ago by Eugene Lazutkin

Resolution: fixed
Status: closedreopened

No, Bill, you request has to wait. It was reverted in [25745].

comment:5 Changed 8 years ago by bill

Milestone: 1.71.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 7 years ago by Eugene Lazutkin

It looks like all requested changes are in Dojo Base already. Are we good to close these tickets?

comment:7 Changed 7 years ago by bill

Milestone: 1.81.7
Resolution: fixed
Status: reopenedclosed

Agreed, the changes are in [25901].

Note: See TracTickets for help on using tickets.