Bug 218197

Summary: Clean up BoxSide and BorderEdge code
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, changseok, esprehn+autocc, ews-watchlist, glenn, kondapallykalyan, pdr, sam, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
sam: review+, ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch none

Description Simon Fraser (smfr) 2020-10-26 10:43:17 PDT
Clean up BoxSide and BorderEdge code
Comment 1 Simon Fraser (smfr) 2020-10-26 10:48:36 PDT
Created attachment 412334 [details]
Patch
Comment 2 Sam Weinig 2020-10-26 11:07:34 PDT
Comment on attachment 412334 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412334&action=review

> Source/WebCore/platform/RectEdges.h:52
> +    T& at(BoxSide side) { return m_sides[static_cast<size_t>(side)]; }

The more traditional thing would be to use operation[] here.

> Source/WebCore/platform/RectEdges.h:89
> +    std::array<T, 4> m_sides { };

I don't think you need the braces at all here. It should default initialize the members by default.

> Source/WebCore/platform/text/WritingMode.h:131
> +constexpr std::initializer_list<BoxSide> allBoxSides = { BoxSide::Top, BoxSide::Right, BoxSide::Bottom, BoxSide::Left };

I think this would make more sense as std::array<BoxSide, 4>. Keeping initializer_list is mostly best used as a parameter to a function.

I also think we should try to replace this, perhaps as a follow up, with specific iterators on RectEdges.

> Source/WebCore/rendering/RenderBoxModelObject.cpp:1799
> +    static constexpr std::initializer_list<BoxSide> paintOrderSides = { BoxSide::Top, BoxSide::Bottom, BoxSide::Left, BoxSide::Right };

like with the other use, I think this would be better as a std::array.
Comment 3 Simon Fraser (smfr) 2020-10-26 21:04:30 PDT
Created attachment 412385 [details]
Patch
Comment 4 Simon Fraser (smfr) 2020-10-30 22:14:19 PDT
Created attachment 412830 [details]
Patch
Comment 5 Simon Fraser (smfr) 2020-10-30 22:43:39 PDT
Created attachment 412831 [details]
Patch
Comment 6 Simon Fraser (smfr) 2020-10-31 10:27:05 PDT
Created attachment 412844 [details]
Patch
Comment 7 EWS 2020-10-31 12:06:29 PDT
Committed r269228: <https://trac.webkit.org/changeset/269228>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 412844 [details].
Comment 8 Radar WebKit Bug Importer 2020-10-31 12:07:19 PDT
<rdar://problem/70918166>