Title: [288343] trunk/Source/WebCore
- Revision
- 288343
- Author
- za...@apple.com
- Date
- 2022-01-20 18:58:13 -0800 (Thu, 20 Jan 2022)
Log Message
[LFC][IFC] Implement TextUtil::directionForTextContent
https://bugs.webkit.org/show_bug.cgi?id=235392
Reviewed by Antti Koivisto.
Let's check with ubidi_getBaseDirection what the content direction is. We use this
direction value to drive the line based "content alignment".
* layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::directionForTextContent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (288342 => 288343)
--- trunk/Source/WebCore/ChangeLog 2022-01-21 02:43:34 UTC (rev 288342)
+++ trunk/Source/WebCore/ChangeLog 2022-01-21 02:58:13 UTC (rev 288343)
@@ -1,3 +1,16 @@
+2022-01-20 Alan Bujtas <za...@apple.com>
+
+ [LFC][IFC] Implement TextUtil::directionForTextContent
+ https://bugs.webkit.org/show_bug.cgi?id=235392
+
+ Reviewed by Antti Koivisto.
+
+ Let's check with ubidi_getBaseDirection what the content direction is. We use this
+ direction value to drive the line based "content alignment".
+
+ * layout/formattingContexts/inline/text/TextUtil.cpp:
+ (WebCore::Layout::TextUtil::directionForTextContent):
+
2022-01-20 Simon Fraser <simon.fra...@apple.com>
REGRESSION (r284136): A slight horizontal rubberband kills scroll momentum
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp (288342 => 288343)
--- trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp 2022-01-21 02:43:34 UTC (rev 288342)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp 2022-01-21 02:58:13 UTC (rev 288343)
@@ -36,6 +36,7 @@
#include "RenderBox.h"
#include "RenderStyle.h"
#include "SurrogatePairAwareTextIterator.h"
+#include <unicode/ubidi.h>
#include <wtf/text/TextBreakIterator.h>
namespace WebCore {
@@ -336,10 +337,11 @@
return nextPosition - inlineTextItem.start();
}
-TextDirection TextUtil::directionForTextContent(StringView)
+TextDirection TextUtil::directionForTextContent(StringView content)
{
- ASSERT_NOT_IMPLEMENTED_YET();
- return TextDirection::LTR;
+ if (content.is8Bit())
+ return TextDirection::LTR;
+ return ubidi_getBaseDirection(content.characters16(), content.length()) == UBIDI_RTL ? TextDirection::RTL : TextDirection::LTR;
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes