Title: [251844] trunk/Source/WebCore
- Revision
- 251844
- Author
- [email protected]
- Date
- 2019-10-31 07:52:05 -0700 (Thu, 31 Oct 2019)
Log Message
[LFC][IFC] Add justify expansion information to Display::Runs
https://bugs.webkit.org/show_bug.cgi?id=203535
<rdar://problem/56689268>
Reviewed by Antti Koivisto.
This is in preparation for supporting text-align: justify.
* layout/displaytree/DisplayPainter.cpp:
(WebCore::Display::paintInlineContent):
* layout/displaytree/DisplayRun.h:
(WebCore::Display::Run::TextContext::TextContext):
(WebCore::Display::Run::TextContext::expansionBehavior const):
(WebCore::Display::Run::TextContext::expansion const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (251843 => 251844)
--- trunk/Source/WebCore/ChangeLog 2019-10-31 14:51:34 UTC (rev 251843)
+++ trunk/Source/WebCore/ChangeLog 2019-10-31 14:52:05 UTC (rev 251844)
@@ -1,5 +1,22 @@
2019-10-31 Zalan Bujtas <[email protected]>
+ [LFC][IFC] Add justify expansion information to Display::Runs
+ https://bugs.webkit.org/show_bug.cgi?id=203535
+ <rdar://problem/56689268>
+
+ Reviewed by Antti Koivisto.
+
+ This is in preparation for supporting text-align: justify.
+
+ * layout/displaytree/DisplayPainter.cpp:
+ (WebCore::Display::paintInlineContent):
+ * layout/displaytree/DisplayRun.h:
+ (WebCore::Display::Run::TextContext::TextContext):
+ (WebCore::Display::Run::TextContext::expansionBehavior const):
+ (WebCore::Display::Run::TextContext::expansion const):
+
+2019-10-31 Zalan Bujtas <[email protected]>
+
[LFC][IFC] Preserved segment breaks should produce ForcedLineBreak type of InlineItems
https://bugs.webkit.org/show_bug.cgi?id=203645
<rdar://problem/56763606>
Modified: trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp (251843 => 251844)
--- trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp 2019-10-31 14:51:34 UTC (rev 251843)
+++ trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp 2019-10-31 14:52:05 UTC (rev 251844)
@@ -117,7 +117,7 @@
return;
for (auto& run : inlineRuns) {
- if (run->textContext()) {
+ if (auto textContext = run->textContext()) {
auto& style = run->style();
context.setStrokeColor(style.color());
context.setFillColor(style.color());
@@ -125,8 +125,10 @@
auto logicalLeft = rootAbsoluteDisplayBox.left() + run->logicalLeft();
// FIXME: Add non-baseline align painting
auto& lineBox = formattingState.lineBoxForRun(*run);
- auto baselineOffset = rootAbsoluteDisplayBox.top() + lineBox.logicalTop() + lineBox.baselineOffset();
- context.drawText(style.fontCascade(), TextRun { run->textContext()->content() }, { logicalLeft, baselineOffset });
+ auto baselineOffset = rootAbsoluteDisplayBox.top() + lineBox.logicalTop() + lineBox.baselineOffset();
+ context.drawText(style.fontCascade(),
+ TextRun { textContext->content(), logicalLeft, textContext->expansion().valueOr(0), textContext->expansionBehavior().valueOr(ForbidLeadingExpansion | ForbidTrailingExpansion)},
+ { logicalLeft, baselineOffset });
} else if (auto* cachedImage = run->image()) {
auto runAbsoluteRect = FloatRect { rootAbsoluteDisplayBox.left() + run->logicalLeft(), rootAbsoluteDisplayBox.top() + run->logicalTop(), run->logicalWidth(), run->logicalHeight() };
context.drawImage(*cachedImage->image(), runAbsoluteRect);
Modified: trunk/Source/WebCore/layout/displaytree/DisplayRun.h (251843 => 251844)
--- trunk/Source/WebCore/layout/displaytree/DisplayRun.h 2019-10-31 14:51:34 UTC (rev 251843)
+++ trunk/Source/WebCore/layout/displaytree/DisplayRun.h 2019-10-31 14:52:05 UTC (rev 251844)
@@ -30,6 +30,7 @@
#include "DisplayRect.h"
#include "LayoutUnit.h"
#include "RenderStyle.h"
+#include "TextFlags.h"
namespace WebCore {
@@ -42,7 +43,7 @@
struct TextContext {
WTF_MAKE_STRUCT_FAST_ALLOCATED;
public:
- TextContext(unsigned position, unsigned length, String content);
+ TextContext(unsigned position, unsigned length, String content, Optional<ExpansionBehavior> = { }, Optional<LayoutUnit> expansion = { });
unsigned start() const { return m_start; }
unsigned end() const { return start() + length(); }
@@ -49,11 +50,16 @@
unsigned length() const { return m_length; }
String content() const { return m_content; }
+ Optional<ExpansionBehavior> expansionBehavior() const { return m_expansionBehavior; }
+ Optional<LayoutUnit> expansion() const { return m_expansion; }
+
void expand(const TextContext& other);
private:
- unsigned m_start;
- unsigned m_length;
+ unsigned m_start { 0 };
+ unsigned m_length { 0 };
+ Optional<ExpansionBehavior> m_expansionBehavior;
+ Optional<LayoutUnit> m_expansion;
// FIXME: This is temporary. We should have some mapping setup to identify associated text content instead.
String m_content;
};
@@ -104,9 +110,11 @@
{
}
-inline Run::TextContext::TextContext(unsigned start, unsigned length, String content)
+inline Run::TextContext::TextContext(unsigned start, unsigned length, String content, Optional<ExpansionBehavior> expansionBehavior, Optional<LayoutUnit> expansion)
: m_start(start)
, m_length(length)
+ , m_expansionBehavior(expansionBehavior)
+ , m_expansion(expansion)
, m_content(content)
{
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes