Bug 218197 - Clean up BoxSide and BorderEdge code
Summary: Clean up BoxSide and BorderEdge code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-26 10:43 PDT by Simon Fraser (smfr)
Modified: 2020-10-31 12:07 PDT (History)
11 users (show)

See Also:


Attachments
Patch (83.63 KB, patch)
2020-10-26 10:48 PDT, Simon Fraser (smfr)
sam: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (86.26 KB, patch)
2020-10-26 21:04 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (86.26 KB, patch)
2020-10-30 22:14 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (86.37 KB, patch)
2020-10-30 22:43 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (86.37 KB, patch)
2020-10-31 10:27 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>