Bug 209913

Summary: Computed style for "outline-offset" is wrong when "outline-style" is "none"
Product: WebKit Reporter: Manuel Rego Casasnovas <rego>
Component: CSSAssignee: Manuel Rego Casasnovas <rego>
Status: RESOLVED FIXED    
Severity: Normal CC: esprehn+autocc, ews-watchlist, glenn, kondapallykalyan, pdr, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.chromium.org/p/chromium/issues/detail?id=1005372
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Manuel Rego Casasnovas 2020-04-02 09:45:10 PDT
This is easy to reproduce with the following example:
  <style>#foo { outline-offset: 10px; }</style>
  <div id="foo"></div>
  <script>console.log(getComputedStyle(foo).outlineOffset);</script>

It should log 10px but it actually logs 0px.

This is probably a mistake as "outline-width" is special on the spec (https://drafts.csswg.org/css-ui/#outline-props).
For "outline-width" the computed value says: "absolute length; 0 if the outline style is none."
But for "outline-offset" it says: "absolute length"

There's a check causing this behavior at RenderStyle::outlineOffset().
Comment 1 Manuel Rego Casasnovas 2020-04-02 22:05:41 PDT
Created attachment 395346 [details]
Patch
Comment 2 Manuel Rego Casasnovas 2020-04-03 02:27:54 PDT
Created attachment 395359 [details]
Patch
Comment 3 Manuel Rego Casasnovas 2020-04-03 02:55:59 PDT
Created attachment 395363 [details]
Patch
Comment 4 Daniel Bates 2020-04-04 12:20:12 PDT
Comment on attachment 395363 [details]
Patch

Looks reasonable.
Comment 5 EWS 2020-04-05 21:14:24 PDT
Committed r259562: <https://trac.webkit.org/changeset/259562>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395363 [details].
Comment 6 Radar WebKit Bug Importer 2020-04-05 21:15:17 PDT
<rdar://problem/61328192>