RESOLVED FIXED Bug 218093
[css-logical] Implement logical border-radius
https://bugs.webkit.org/show_bug.cgi?id=218093
Summary [css-logical] Implement logical border-radius
Simon Fraser (smfr)
Reported 2020-10-22 10:46:34 PDT
Attachments
Patch (33.28 KB, patch)
2020-12-15 04:04 PST, zsun
no flags
Patch (56.89 KB, patch)
2020-12-16 03:45 PST, zsun
no flags
Patch (57.11 KB, patch)
2020-12-16 04:15 PST, zsun
no flags
Patch (116.00 KB, patch)
2020-12-16 05:31 PST, zsun
no flags
Patch (116.00 KB, patch)
2020-12-16 06:33 PST, zsun
no flags
Patch (113.41 KB, patch)
2020-12-17 02:21 PST, zsun
no flags
Patch (113.24 KB, patch)
2020-12-17 03:17 PST, zsun
no flags
Patch (113.19 KB, patch)
2020-12-17 09:50 PST, zsun
no flags
Patch (117.33 KB, patch)
2020-12-18 07:03 PST, zsun
no flags
Patch (117.49 KB, patch)
2020-12-18 07:15 PST, zsun
no flags
Patch (411.93 KB, patch)
2020-12-22 09:11 PST, zsun
no flags
Patch (116.73 KB, patch)
2021-01-05 07:07 PST, zsun
ews-feeder: commit-queue-
Patch (116.83 KB, patch)
2021-01-05 08:23 PST, zsun
no flags
Patch (116.23 KB, patch)
2021-01-08 06:18 PST, zsun
no flags
Patch (116.73 KB, patch)
2021-01-13 07:55 PST, zsun
no flags
Radar WebKit Bug Importer
Comment 1 2020-10-22 10:46:54 PDT
zsun
Comment 2 2020-12-15 04:04:28 PST
Javier Fernandez
Comment 3 2020-12-15 04:40:58 PST
Comment on attachment 416234 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416234&action=review > Source/WebCore/platform/text/WritingMode.h:193 > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) Isn't this equivalent to !isFlippedBlockWritingMode() (aka: vertical-rl) ? > Source/WebCore/platform/text/WritingMode.h:210 > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) Ditto > Source/WebCore/platform/text/WritingMode.h:221 > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) Ditto > Source/WebCore/platform/text/WritingMode.h:226 > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) Ditto
Manuel Rego Casasnovas
Comment 4 2020-12-15 07:20:06 PST
Comment on attachment 416234 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416234&action=review You need to update some test expectations to include the new propoerties. > Source/WebCore/ChangeLog:7 > + Please add a longer description here, explaining which properties are being added as part of this patch.
Oriol Brufau
Comment 5 2020-12-15 07:47:18 PST
Comment on attachment 416234 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416234&action=review > Source/WebCore/platform/text/WritingMode.h:132 > +enum class LogicalRadiusCorner : uint8_t { In the future there might be more properties referencing corners, other than border radius. So it may be better to name the enums like LogicalBoxCorner and BoxCorner. Seems I missed this in the Chromium review...
Simon Fraser (smfr)
Comment 6 2020-12-15 09:49:39 PST
Comment on attachment 416234 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416234&action=review > Source/WebCore/css/CSSProperty.cpp:175 > + case CSSPropertyBorderStartStartRadius: { > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::StartStart, borderRadiusShorthand()); > + } > + case CSSPropertyBorderStartEndRadius: { > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::StartEnd, borderRadiusShorthand()); > + } > + case CSSPropertyBorderEndStartRadius: { > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::EndStart, borderRadiusShorthand()); > + } > + case CSSPropertyBorderEndEndRadius: { > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::EndEnd, borderRadiusShorthand()); > + } No need for braces on these. >> Source/WebCore/platform/text/WritingMode.h:132 >> +enum class LogicalRadiusCorner : uint8_t { > > In the future there might be more properties referencing corners, other than border radius. > So it may be better to name the enums like LogicalBoxCorner and BoxCorner. > Seems I missed this in the Chromium review... I concur. See BoxSide and LogicalBoxSide. > Source/WebCore/platform/text/WritingMode.h:187 > +inline RadiusCorner mapLogicalRadiusCornerToPhysicalRadiusCorner(TextFlow textflow, WritingMode writingMode, LogicalRadiusCorner logicalRadiusCorner) This can be called mapLogicalCornerToPhysicalCorner()
zsun
Comment 7 2020-12-16 03:45:01 PST
zsun
Comment 8 2020-12-16 04:08:51 PST
(In reply to Javier Fernandez from comment #3) > Comment on attachment 416234 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416234&action=review > > > Source/WebCore/platform/text/WritingMode.h:193 > > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) > > Isn't this equivalent to !isFlippedBlockWritingMode() (aka: vertical-rl) ? > > > Source/WebCore/platform/text/WritingMode.h:210 > > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) > > Ditto > > > Source/WebCore/platform/text/WritingMode.h:221 > > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) > > Ditto > > > Source/WebCore/platform/text/WritingMode.h:226 > > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) > > Ditto Yes, it might be worthy introducing isFlippedBlockWritingMode() in WritingMode.h. As we discussed, I probably will leave this to a separate patch.
zsun
Comment 9 2020-12-16 04:09:28 PST
(In reply to Manuel Rego Casasnovas from comment #4) > Comment on attachment 416234 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416234&action=review > > You need to update some test expectations to include the new propoerties. > > > Source/WebCore/ChangeLog:7 > > + > > Please add a longer description here, explaining which properties are being > added as part of this patch. Done
zsun
Comment 10 2020-12-16 04:10:08 PST
(In reply to Simon Fraser (smfr) from comment #6) > Comment on attachment 416234 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416234&action=review > > > Source/WebCore/css/CSSProperty.cpp:175 > > + case CSSPropertyBorderStartStartRadius: { > > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::StartStart, borderRadiusShorthand()); > > + } > > + case CSSPropertyBorderStartEndRadius: { > > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::StartEnd, borderRadiusShorthand()); > > + } > > + case CSSPropertyBorderEndStartRadius: { > > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::EndStart, borderRadiusShorthand()); > > + } > > + case CSSPropertyBorderEndEndRadius: { > > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::EndEnd, borderRadiusShorthand()); > > + } > > No need for braces on these. > > >> Source/WebCore/platform/text/WritingMode.h:132 > >> +enum class LogicalRadiusCorner : uint8_t { > > > > In the future there might be more properties referencing corners, other than border radius. > > So it may be better to name the enums like LogicalBoxCorner and BoxCorner. > > Seems I missed this in the Chromium review... > > I concur. See BoxSide and LogicalBoxSide. > > > Source/WebCore/platform/text/WritingMode.h:187 > > +inline RadiusCorner mapLogicalRadiusCornerToPhysicalRadiusCorner(TextFlow textflow, WritingMode writingMode, LogicalRadiusCorner logicalRadiusCorner) > > This can be called mapLogicalCornerToPhysicalCorner() Code updated. Thank you!
zsun
Comment 11 2020-12-16 04:10:32 PST
(In reply to Oriol Brufau from comment #5) > Comment on attachment 416234 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416234&action=review > > > Source/WebCore/platform/text/WritingMode.h:132 > > +enum class LogicalRadiusCorner : uint8_t { > > In the future there might be more properties referencing corners, other than > border radius. > So it may be better to name the enums like LogicalBoxCorner and BoxCorner. > Seems I missed this in the Chromium review... Updated. Thank you!
zsun
Comment 12 2020-12-16 04:15:05 PST
zsun
Comment 13 2020-12-16 04:50:33 PST
(In reply to zsun from comment #10) > (In reply to Simon Fraser (smfr) from comment #6) > > Comment on attachment 416234 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=416234&action=review > > > > > Source/WebCore/css/CSSProperty.cpp:175 > > > + case CSSPropertyBorderStartStartRadius: { > > > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::StartStart, borderRadiusShorthand()); > > > + } > > > + case CSSPropertyBorderStartEndRadius: { > > > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::StartEnd, borderRadiusShorthand()); > > > + } > > > + case CSSPropertyBorderEndStartRadius: { > > > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::EndStart, borderRadiusShorthand()); > > > + } > > > + case CSSPropertyBorderEndEndRadius: { > > > + return resolveToPhysicalProperty(direction, writingMode, LogicalRadiusCorner::EndEnd, borderRadiusShorthand()); > > > + } > > > > No need for braces on these. > > > > >> Source/WebCore/platform/text/WritingMode.h:132 > > >> +enum class LogicalRadiusCorner : uint8_t { > > > > > > In the future there might be more properties referencing corners, other than border radius. > > > So it may be better to name the enums like LogicalBoxCorner and BoxCorner. > > > Seems I missed this in the Chromium review... I will try to update the Chromium changes. > > > > I concur. See BoxSide and LogicalBoxSide. > > > > > Source/WebCore/platform/text/WritingMode.h:187 > > > +inline RadiusCorner mapLogicalRadiusCornerToPhysicalRadiusCorner(TextFlow textflow, WritingMode writingMode, LogicalRadiusCorner logicalRadiusCorner) > > > > This can be called mapLogicalCornerToPhysicalCorner() > > Code updated. Thank you!
zsun
Comment 14 2020-12-16 05:31:39 PST
zsun
Comment 15 2020-12-16 06:33:57 PST
Simon Fraser (smfr)
Comment 16 2020-12-16 09:16:26 PST
Comment on attachment 416335 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416335&action=review > Source/WebCore/css/CSSProperties.json:1516 > + "border-corner-radius": { I don't see this property in https://www.w3.org/TR/css-logical/#border-radius-shorthands anywhere.
zsun
Comment 17 2020-12-16 11:27:42 PST
(In reply to Simon Fraser (smfr) from comment #16) > Comment on attachment 416335 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416335&action=review > > > Source/WebCore/css/CSSProperties.json:1516 > > + "border-corner-radius": { > > I don't see this property in > https://www.w3.org/TR/css-logical/#border-radius-shorthands anywhere. You are right. It should be "border-radius" but "border-radius" is already used in this file to refer to physical radius corners. Any suggestion on naming this would be appreciated.
Oriol Brufau
Comment 18 2020-12-16 13:34:37 PST
Comment on attachment 416335 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416335&action=review >>> Source/WebCore/css/CSSProperties.json:1516 >>> + "border-corner-radius": { >> >> I don't see this property in https://www.w3.org/TR/css-logical/#border-radius-shorthands anywhere. > > You are right. It should be "border-radius" but "border-radius" is already used in this file to refer to physical radius corners. > > Any suggestion on naming this would be appreciated. Ziran, you seem to think that you need a shorthand for the logical border radius properties. Why? Isn't it possible to just remove this "border-corner-radius"? Your patch for Chromium didn't have it.
zsun
Comment 19 2020-12-17 02:21:49 PST
zsun
Comment 20 2020-12-17 02:24:23 PST
(In reply to Oriol Brufau from comment #18) > Comment on attachment 416335 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416335&action=review > > >>> Source/WebCore/css/CSSProperties.json:1516 > >>> + "border-corner-radius": { > >> > >> I don't see this property in https://www.w3.org/TR/css-logical/#border-radius-shorthands anywhere. > > > > You are right. It should be "border-radius" but "border-radius" is already used in this file to refer to physical radius corners. > > > > Any suggestion on naming this would be appreciated. > > Ziran, you seem to think that you need a shorthand for the logical border > radius properties. Why? > Isn't it possible to just remove this "border-corner-radius"? > Your patch for Chromium didn't have it. Probably shouldn't be. Patch updated with it removed. Thank you!
zsun
Comment 21 2020-12-17 03:17:51 PST
zsun
Comment 22 2020-12-17 03:21:22 PST
(In reply to zsun from comment #8) > (In reply to Javier Fernandez from comment #3) > > Comment on attachment 416234 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=416234&action=review > > > > > Source/WebCore/platform/text/WritingMode.h:193 > > > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) > > > > Isn't this equivalent to !isFlippedBlockWritingMode() (aka: vertical-rl) ? > > > > > Source/WebCore/platform/text/WritingMode.h:210 > > > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) > > > > Ditto > > > > > Source/WebCore/platform/text/WritingMode.h:221 > > > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) > > > > Ditto > > > > > Source/WebCore/platform/text/WritingMode.h:226 > > > + if (isHorizontalWritingMode(writingMode) || isFlippedLinesWritingMode(writingMode)) > > > > Ditto > > Yes, it might be worthy introducing isFlippedBlockWritingMode() in > WritingMode.h. As we discussed, I probably will leave this to a separate > patch. isFlippedWritingMode(WritingMode writingMode) has been define in WritingMode.h. I guess probably it's enough without introducing isFlippedBlockWritingMode(). Patch has been updated. Thank you!
Oriol Brufau
Comment 23 2020-12-17 09:10:24 PST
Comment on attachment 416409 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416409&action=review > Source/WebCore/platform/text/WritingMode.h:194 > + return BoxCorner::BottomLeft; There are some trailing spaces here > Source/WebCore/platform/text/WritingMode.h:206 > + return BoxCorner::TopRight; Ditto > Source/WebCore/platform/text/WritingMode.h:216 > + return BoxCorner::BottomRight; Ditto > Source/WebCore/platform/text/WritingMode.h:227 > + return BoxCorner::TopRight; Ditto
zsun
Comment 24 2020-12-17 09:50:11 PST
zsun
Comment 25 2020-12-17 09:53:42 PST
(In reply to Oriol Brufau from comment #23) > Comment on attachment 416409 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416409&action=review > > > Source/WebCore/platform/text/WritingMode.h:194 > > + return BoxCorner::BottomLeft; > > There are some trailing spaces here > > > Source/WebCore/platform/text/WritingMode.h:206 > > + return BoxCorner::TopRight; > > Ditto > > > Source/WebCore/platform/text/WritingMode.h:216 > > + return BoxCorner::BottomRight; > > Ditto > > > Source/WebCore/platform/text/WritingMode.h:227 > > + return BoxCorner::TopRight; > > Ditto Updated. Thank you!
Oriol Brufau
Comment 26 2020-12-17 09:58:07 PST
Comment on attachment 416432 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416432&action=review > Source/WebCore/platform/text/WritingMode.h:181 > +inline BoxCorner mapLogicalCornerToPhysicalCorner(TextFlow textflow, WritingMode writingMode, LogicalBoxCorner logicalBoxCorner) Webkit has the non-standard '-webkit-writing-mode: horizontal-bt'. The mapping doesn't seem correct for that value. For example, with horizontal-bt ltr, the block-start side is the bottom, and the inline-start side is the left. But the start-start corner resolves to top-right instead of bottom-left.
Simon Fraser (smfr)
Comment 27 2020-12-17 10:58:00 PST
Comment on attachment 416432 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416432&action=review > Source/WebCore/platform/text/WritingMode.h:126 > +enum class LogicalBoxCorner : uint8_t { Maybe a comment here to describe the order (block/inline or inline/block?)
Simon Fraser (smfr)
Comment 28 2020-12-17 11:01:19 PST
Comment on attachment 416432 [details] Patch r- based on Oriol's comment. Please be sure to add a test for -webkit-writing-mode: horizontal-bt
zsun
Comment 29 2020-12-18 07:03:44 PST
EWS Watchlist
Comment 30 2020-12-18 07:05:15 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
zsun
Comment 31 2020-12-18 07:15:40 PST
zsun
Comment 32 2020-12-18 07:17:49 PST
(In reply to Simon Fraser (smfr) from comment #27) > Comment on attachment 416432 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416432&action=review > > > Source/WebCore/platform/text/WritingMode.h:126 > > +enum class LogicalBoxCorner : uint8_t { > > Maybe a comment here to describe the order (block/inline or inline/block?) Updated.
zsun
Comment 33 2020-12-18 07:21:28 PST
(In reply to Oriol Brufau from comment #26) > Comment on attachment 416432 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416432&action=review > > > Source/WebCore/platform/text/WritingMode.h:181 > > +inline BoxCorner mapLogicalCornerToPhysicalCorner(TextFlow textflow, WritingMode writingMode, LogicalBoxCorner logicalBoxCorner) > > Webkit has the non-standard '-webkit-writing-mode: horizontal-bt'. The > mapping doesn't seem correct for that value. > For example, with horizontal-bt ltr, the block-start side is the bottom, and > the inline-start side is the left. > But the start-start corner resolves to top-right instead of bottom-left. Updated. It has modifies the imported WPT tests. I'm not sure if I should port it back.
zsun
Comment 34 2020-12-18 10:25:30 PST
The changes on tests related to horizontal-bt will be moved to a different patch. The following bug has been raised to address it: https://bugs.webkit.org/show_bug.cgi?id=220015
Oriol Brufau
Comment 35 2020-12-20 07:14:23 PST
Comment on attachment 416519 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416519&action=review > Source/WebCore/platform/text/WritingMode.h:183 > +inline BoxCorner mapLogicalCornerToPhysicalCorner(TextFlow textflow, WritingMode writingMode, LogicalBoxCorner logicalBoxCorner) I guess this function should be marked constexpr, like the others. And it seems strange to pass both TextFlow and WritingMode as arguments. I would pass the TextFlow only, though you may need a new isFlippedLinesTextFlow function. > Source/WebCore/platform/text/WritingMode.h:185 > + BoxCorner physicalCorner = static_cast<BoxCorner>(logicalBoxCorner); physicalCorner doesn't seem necessary. > Source/WebCore/platform/text/WritingMode.h:186 > + switch (logicalBoxCorner) { This switch seems very long. I think you can simplify the cases as such: switch (logicalBoxCorner) { case LogicalBoxCorner::StartStart: if (isFlippedTextFlow(textflow)) { if (isReversedTextFlow(textflow)) return BoxCorner::BottomRight; } else if (!isReversedTextFlow(textflow)) { return BoxCorner::TopLeft; } if (isFlippedLinesTextFlow(textflow)) return BoxCorner::BottomLeft; return BoxCorner::TopRight; case LogicalBoxCorner::StartEnd: if (isFlippedTextFlow(textflow)) { if (!isReversedTextFlow(textflow)) return BoxCorner::BottomRight; } else if (isReversedTextFlow(textflow)) { return BoxCorner::TopLeft; } if (isFlippedLinesTextFlow(textflow)) return BoxCorner::BottomLeft; return BoxCorner::TopRight; case LogicalBoxCorner::EndStart: if (isFlippedTextFlow(textflow)) { if (!isReversedTextFlow(textflow)) return BoxCorner::TopLeft; } else if (isReversedTextFlow(textflow)) { return BoxCorner::BottomRight; } if (isFlippedLinesTextFlow(textflow)) return BoxCorner::TopRight; return BoxCorner::BottomLeft; case LogicalBoxCorner::EndEnd: if (isFlippedTextFlow(textflow)) { if (isReversedTextFlow(textflow)) return BoxCorner::TopLeft; } else if (!isReversedTextFlow(textflow)) { return BoxCorner::BottomRight; } if (isFlippedLinesTextFlow(textflow)) return BoxCorner::TopRight; return BoxCorner::BottomLeft; } Or even remove the switch and use bool isBlockStart = logicalBoxCorner == LogicalBoxCorner::StartStart || logicalBoxCorner == LogicalBoxCorner::StartEnd; bool isInlineStart = logicalBoxCorner == LogicalBoxCorner::StartStart || logicalBoxCorner == LogicalBoxCorner::EndStart; if (isBlockStart == isFlippedTextFlow(textflow)) { if (isInlineStart == isReversedTextFlow(textflow)) return BoxCorner::BottomRight; } else if (isInlineStart != isReversedTextFlow(textflow)) { return BoxCorner::TopLeft; } if (isBlockStart == isFlippedLinesTextFlow(textflow)) return BoxCorner::BottomLeft; return BoxCorner::TopRight;
zsun
Comment 36 2020-12-22 09:11:46 PST
zsun
Comment 37 2020-12-22 09:12:25 PST
(In reply to Oriol Brufau from comment #35) > Comment on attachment 416519 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416519&action=review > > > Source/WebCore/platform/text/WritingMode.h:183 > > +inline BoxCorner mapLogicalCornerToPhysicalCorner(TextFlow textflow, WritingMode writingMode, LogicalBoxCorner logicalBoxCorner) > > I guess this function should be marked constexpr, like the others. > > And it seems strange to pass both TextFlow and WritingMode as arguments. > I would pass the TextFlow only, though you may need a new > isFlippedLinesTextFlow function. > > > Source/WebCore/platform/text/WritingMode.h:185 > > + BoxCorner physicalCorner = static_cast<BoxCorner>(logicalBoxCorner); > > physicalCorner doesn't seem necessary. > > > Source/WebCore/platform/text/WritingMode.h:186 > > + switch (logicalBoxCorner) { > > This switch seems very long. I think you can simplify the cases as such: > > switch (logicalBoxCorner) { > case LogicalBoxCorner::StartStart: > if (isFlippedTextFlow(textflow)) { > if (isReversedTextFlow(textflow)) > return BoxCorner::BottomRight; > } else if (!isReversedTextFlow(textflow)) { > return BoxCorner::TopLeft; > } > if (isFlippedLinesTextFlow(textflow)) > return BoxCorner::BottomLeft; > return BoxCorner::TopRight; > case LogicalBoxCorner::StartEnd: > if (isFlippedTextFlow(textflow)) { > if (!isReversedTextFlow(textflow)) > return BoxCorner::BottomRight; > } else if (isReversedTextFlow(textflow)) { > return BoxCorner::TopLeft; > } > if (isFlippedLinesTextFlow(textflow)) > return BoxCorner::BottomLeft; > return BoxCorner::TopRight; > case LogicalBoxCorner::EndStart: > if (isFlippedTextFlow(textflow)) { > if (!isReversedTextFlow(textflow)) > return BoxCorner::TopLeft; > } else if (isReversedTextFlow(textflow)) { > return BoxCorner::BottomRight; > } > if (isFlippedLinesTextFlow(textflow)) > return BoxCorner::TopRight; > return BoxCorner::BottomLeft; > case LogicalBoxCorner::EndEnd: > if (isFlippedTextFlow(textflow)) { > if (isReversedTextFlow(textflow)) > return BoxCorner::TopLeft; > } else if (!isReversedTextFlow(textflow)) { > return BoxCorner::BottomRight; > } > if (isFlippedLinesTextFlow(textflow)) > return BoxCorner::TopRight; > return BoxCorner::BottomLeft; > } > > > Or even remove the switch and use > > bool isBlockStart = logicalBoxCorner == LogicalBoxCorner::StartStart || > logicalBoxCorner == LogicalBoxCorner::StartEnd; > bool isInlineStart = logicalBoxCorner == LogicalBoxCorner::StartStart || > logicalBoxCorner == LogicalBoxCorner::EndStart; > if (isBlockStart == isFlippedTextFlow(textflow)) { > if (isInlineStart == isReversedTextFlow(textflow)) > return BoxCorner::BottomRight; > } else if (isInlineStart != isReversedTextFlow(textflow)) { > return BoxCorner::TopLeft; > } > if (isBlockStart == isFlippedLinesTextFlow(textflow)) > return BoxCorner::BottomLeft; > return BoxCorner::TopRight; Code updated. Thank you!
Sam Weinig
Comment 38 2020-12-25 18:51:23 PST
Comment on attachment 416669 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416669&action=review Thanks for working on this! > Source/WebCore/ChangeLog:37 > + (WebCore::mapLogicalCornerToPhysicalCorner): > 2020-12-22 Simon Fraser <simon.fraser@apple.com> Please leave a newline at the end here. > Source/WebCore/ChangeLog:70 > - (This saves a loop on the inline level boxes while constructing the lines at InlineContentBuilder::createDisplayLines) > + (This saves a loop on the inline level boxes while constructing the lines at InlineContentBuilder::createDisplayLines) Hey, this was probably just your editor going wild, but please leave the whitespace in the rest of the ChangeLog (or really anything you're not actively changing) alone. It isn't necessary to change.
zsun
Comment 39 2021-01-05 07:07:52 PST
zsun
Comment 40 2021-01-05 07:09:48 PST
(In reply to Sam Weinig from comment #38) > Comment on attachment 416669 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416669&action=review > > Thanks for working on this! > > > Source/WebCore/ChangeLog:37 > > + (WebCore::mapLogicalCornerToPhysicalCorner): > > 2020-12-22 Simon Fraser <simon.fraser@apple.com> > > Please leave a newline at the end here. > > > Source/WebCore/ChangeLog:70 > > - (This saves a loop on the inline level boxes while constructing the lines at InlineContentBuilder::createDisplayLines) > > + (This saves a loop on the inline level boxes while constructing the lines at InlineContentBuilder::createDisplayLines) > > Hey, this was probably just your editor going wild, but please leave the > whitespace in the rest of the ChangeLog (or really anything you're not > actively changing) alone. It isn't necessary to change. Thanks very much for the comments! The files have been updated.
zsun
Comment 41 2021-01-05 08:23:33 PST
Oriol Brufau
Comment 42 2021-01-07 13:39:09 PST
Comment on attachment 417005 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417005&action=review > Source/WebCore/platform/text/WritingMode.h:90 > + return isFlippedTextFlow(textflow) != isVerticalTextFlow(textflow); You could make isFlippedLinesWritingMode call this function to avoid duplicating the logic: constexpr inline bool isFlippedLinesWritingMode(WritingMode writingMode) { return isFlippedLinesTextFlow(makeTextFlow(writingMode, TextDirection::LTR)); } > Source/WebCore/platform/text/WritingMode.h:190 > + BoxCorner physicalCorner = static_cast<BoxCorner>(logicalBoxCorner); physicalCorner doesn't seem needed. > Source/WebCore/platform/text/WritingMode.h:229 > + return physicalCorner; So I guess you are returning physicalCorner because some compiler was failing to notice that all cases are covered? Then I would add an ASSERT_NOT_REACHED() and just return some random corner like BoxCorner::TopLeft. I don't think static_cast<BoxCorner>(logicalBoxCorner) makes much sense. Or just replace the entire switch with bool isBlockStart = logicalBoxCorner == LogicalBoxCorner::StartStart || logicalBoxCorner == LogicalBoxCorner::StartEnd; bool isInlineStart = logicalBoxCorner == LogicalBoxCorner::StartStart || logicalBoxCorner == LogicalBoxCorner::EndStart; if (isBlockStart == isFlippedTextFlow(textflow)) { if (isInlineStart == isReversedTextFlow(textflow)) return BoxCorner::BottomRight; } else if (isInlineStart != isReversedTextFlow(textflow)) { return BoxCorner::TopLeft; } if (isBlockStart == isFlippedLinesTextFlow(textflow)) return BoxCorner::BottomLeft; return BoxCorner::TopRight;
zsun
Comment 43 2021-01-08 06:18:31 PST
zsun
Comment 44 2021-01-08 06:20:24 PST
(In reply to Oriol Brufau from comment #42) > Comment on attachment 417005 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=417005&action=review > > > Source/WebCore/platform/text/WritingMode.h:90 > > + return isFlippedTextFlow(textflow) != isVerticalTextFlow(textflow); > > You could make isFlippedLinesWritingMode call this function to avoid > duplicating the logic: > > constexpr inline bool isFlippedLinesWritingMode(WritingMode writingMode) > { > return isFlippedLinesTextFlow(makeTextFlow(writingMode, > TextDirection::LTR)); > } > > > Source/WebCore/platform/text/WritingMode.h:190 > > + BoxCorner physicalCorner = static_cast<BoxCorner>(logicalBoxCorner); > > physicalCorner doesn't seem needed. > > > Source/WebCore/platform/text/WritingMode.h:229 > > + return physicalCorner; > > So I guess you are returning physicalCorner because some compiler was > failing to notice that all cases are covered? > Then I would add an ASSERT_NOT_REACHED() and just return some random corner > like BoxCorner::TopLeft. > I don't think static_cast<BoxCorner>(logicalBoxCorner) makes much sense. > > Or just replace the entire switch with > > bool isBlockStart = logicalBoxCorner == LogicalBoxCorner::StartStart || > logicalBoxCorner == LogicalBoxCorner::StartEnd; > bool isInlineStart = logicalBoxCorner == LogicalBoxCorner::StartStart || > logicalBoxCorner == LogicalBoxCorner::EndStart; > if (isBlockStart == isFlippedTextFlow(textflow)) { > if (isInlineStart == isReversedTextFlow(textflow)) > return BoxCorner::BottomRight; > } else if (isInlineStart != isReversedTextFlow(textflow)) { > return BoxCorner::TopLeft; > } > if (isBlockStart == isFlippedLinesTextFlow(textflow)) > return BoxCorner::BottomLeft; > return BoxCorner::TopRight; Updated. Thank you!
Oriol Brufau
Comment 45 2021-01-11 10:15:15 PST
Informal r+, but I'm not a reviewer.
Simon Fraser (smfr)
Comment 46 2021-01-11 10:28:42 PST
Comment on attachment 417266 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417266&action=review > Source/WebCore/css/CSSProperty.cpp:63 > +static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingMode writingMode, LogicalBoxCorner logicalBoxCorner, const StylePropertyShorthand& shorthand) > +{ > + return shorthand.properties()[static_cast<size_t>(mapLogicalCornerToPhysicalCorner(makeTextFlow(writingMode, direction), logicalBoxCorner))]; > +} This code is unsafe. If it's called with some random StylePropertyShorthand (not border-radius) then it can run off the end of the properties() array. Since you only call this for borderRadiusShorthand(), make it explicitly about border-radius.
Oriol Brufau
Comment 47 2021-01-11 11:14:02 PST
Comment on attachment 417266 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417266&action=review >> Source/WebCore/css/CSSProperty.cpp:63 >> +} > > This code is unsafe. If it's called with some random StylePropertyShorthand (not border-radius) then it can run off the end of the properties() array. > > Since you only call this for borderRadiusShorthand(), make it explicitly about border-radius. Good point, though the existing resolveToPhysicalProperty are also affected, aren't they? Maybe check the length() of the shorthand in a release assert for the functions that take a shorthand, and for the third function replace the `const CSSPropertyID* properties` parameter with `const CSSPropertyID (&properties)[2]`? That's basically what Chromium does.
zsun
Comment 48 2021-01-13 07:55:47 PST
EWS
Comment 49 2021-01-13 11:25:42 PST
Committed r271447: <https://trac.webkit.org/changeset/271447> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417531 [details].
Note You need to log in before you can comment on or make changes to this bug.