Title: [287036] trunk/Source/WebCore
- Revision
- 287036
- Author
- [email protected]
- Date
- 2021-12-14 11:45:20 -0800 (Tue, 14 Dec 2021)
Log Message
[LFC][IFC] Take inline axis direction into account when computing horizontal alignment offset
https://bugs.webkit.org/show_bug.cgi?id=234286
Reviewed by Antti Koivisto.
This is in preparation for computing the content visual start when text-align is non-initial.
* layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::horizontalAlignmentOffset):
(WebCore::Layout::LineBoxBuilder::build):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (287035 => 287036)
--- trunk/Source/WebCore/ChangeLog 2021-12-14 19:33:02 UTC (rev 287035)
+++ trunk/Source/WebCore/ChangeLog 2021-12-14 19:45:20 UTC (rev 287036)
@@ -1,3 +1,16 @@
+2021-12-14 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] Take inline axis direction into account when computing horizontal alignment offset
+ https://bugs.webkit.org/show_bug.cgi?id=234286
+
+ Reviewed by Antti Koivisto.
+
+ This is in preparation for computing the content visual start when text-align is non-initial.
+
+ * layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
+ (WebCore::Layout::horizontalAlignmentOffset):
+ (WebCore::Layout::LineBoxBuilder::build):
+
2021-12-11 Dean Jackson <[email protected]>
Allow override of system's preferred color scheme
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp (287035 => 287036)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp 2021-12-14 19:33:02 UTC (rev 287035)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp 2021-12-14 19:45:20 UTC (rev 287036)
@@ -36,7 +36,7 @@
namespace WebCore {
namespace Layout {
-static std::optional<InlineLayoutUnit> horizontalAlignmentOffset(TextAlignMode textAlign, const LineBuilder::LineContent& lineContent)
+static std::optional<InlineLayoutUnit> horizontalAlignmentOffset(TextAlignMode textAlign, const LineBuilder::LineContent& lineContent, bool isLeftToRightDirection)
{
// Depending on the line’s alignment/justification, the hanging glyph can be placed outside the line box.
auto& runs = lineContent.runs;
@@ -72,10 +72,16 @@
switch (computedHorizontalAlignment()) {
case TextAlignMode::Left:
case TextAlignMode::WebKitLeft:
+ if (!isLeftToRightDirection)
+ return extraHorizontalSpace;
+ FALLTHROUGH;
case TextAlignMode::Start:
return { };
case TextAlignMode::Right:
case TextAlignMode::WebKitRight:
+ if (!isLeftToRightDirection)
+ return { };
+ FALLTHROUGH;
case TextAlignMode::End:
return extraHorizontalSpace;
case TextAlignMode::Center:
@@ -99,8 +105,8 @@
LineBoxBuilder::LineAndLineBox LineBoxBuilder::build(const LineBuilder::LineContent& lineContent, size_t lineIndex)
{
- auto textAlign = !lineIndex ? rootBox().firstLineStyle().textAlign() : rootBox().style().textAlign();
- auto rootInlineBoxAlignmentOffset = Layout::horizontalAlignmentOffset(textAlign, lineContent).value_or(InlineLayoutUnit { });
+ auto& rootStyle = lineIndex ? rootBox().firstLineStyle() : rootBox().style();
+ auto rootInlineBoxAlignmentOffset = Layout::horizontalAlignmentOffset(rootStyle.textAlign(), lineContent, rootStyle.isLeftToRightDirection()).value_or(InlineLayoutUnit { });
auto lineBox = LineBox { rootBox(), rootInlineBoxAlignmentOffset, lineContent.contentLogicalWidth, lineIndex, lineContent.nonSpanningInlineLevelBoxCount };
auto lineBoxLogicalHeight = constructAndAlignInlineLevelBoxes(lineBox, lineContent.runs, lineIndex);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes