getComputedStyle is a Browser API.  It returns a live CSSStyleDeclaration.

I think we want to abstract the fetching of the four border and/or padding
and/or margin properties in a way that minimizes the number of calls to
getComputedStyle.

CSSContainerUtils (which I will probably rename to CSSLayoutUtils since it
isn't just for containers) has APIs like getBorderMetrics and
getBorderAndPaddingMetrics.  I think we want to push that down to
ValuesManager.  I'll probably create an interface like
IBorderPaddingMarginValuesImpl with APIs like the ones in CSSLayoutUtils.
That allows various implementations for SWF to opt into how many styles to
check.  AIUI, the a check for the thickness of the left border has to
check border-left-width, border-left, border-width and border properties.
If you know that your app doesn't ever set border-left specifically, you
can save some checking at runtime.

Then on the JS side, calls like getBorderAndPaddingMetrics can only call
getComputedStyle once and then copy out the fields they needed.

Of course, plans may change as I get into this.

-Alex

On 2/26/18, 12:28 AM, "Piotr Zarzycki" <[email protected]> wrote:

>Hi Alex,
>
>How actually it will looks like. The getComputedStyle will return object
>which contains all border, padding etc. ?
>
>Thanks, Piotr
>
>2018-02-26 6:39 GMT+01:00 Alex Harui <[email protected]>:
>
>> Hi,
>>
>> Time for another refactoring of layout.  My goal for this round is to
>>move
>> the border/padding/margin calculations into the ValuesManager, and get
>>the
>> JS version to use getComputedStyle.  I think it will be cleaner to
>> abstract the differences between SWF and JS in the ValuesManager and
>>allow
>> for different IValuesImpls to have different levels of sophistication
>>for
>> SWF.
>>
>> Right now, our "FlexibleChild" layouts are not factoring in margins
>> correctly.
>>
>> Thoughts?
>> -Alex
>>
>>
>
>
>-- 
>
>Piotr Zarzycki
>
>Patreon: 
>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr
>eon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7C970b19db2b064a
>f41b0d08d57cf2ed89%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6365523051
>74703675&sdata=1WGHh96AHg0EyKlEcXVtKV%2F9vsZ8bWuFQXmM3S7xwBU%3D&reserved=0
><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr
>eon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7C970b19db2b064a
>f41b0d08d57cf2ed89%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6365523051
>74703675&sdata=1WGHh96AHg0EyKlEcXVtKV%2F9vsZ8bWuFQXmM3S7xwBU%3D&reserved=0
>>*

Reply via email to