Title: [270153] trunk/Source/WebCore
Revision
270153
Author
[email protected]
Date
2020-11-21 12:46:25 -0800 (Sat, 21 Nov 2020)

Log Message

[LFC][IFC] Move current logicalLeft from ContinuousContent to LineStatus
https://bugs.webkit.org/show_bug.cgi?id=219237

Reviewed by Antti Koivisto.

Retain the content logical right in the LineStatus instead (this is used to measure text properly (see xPos) while finding hyphen position).

* layout/inlineformatting/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::processOverflowingTextContent const):
(WebCore::Layout::InlineContentBreaker::ContinuousContent::reset):
* layout/inlineformatting/InlineContentBreaker.h:
(WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalWidth const):
(WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalLeft const): Deleted.
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineCandidate::InlineContent::reset):
(WebCore::Layout::LineCandidate::reset):
(WebCore::Layout::LineBuilder::nextContentForLine):
(WebCore::Layout::LineBuilder::handleFloatsAndInlineContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270152 => 270153)


--- trunk/Source/WebCore/ChangeLog	2020-11-21 20:12:10 UTC (rev 270152)
+++ trunk/Source/WebCore/ChangeLog	2020-11-21 20:46:25 UTC (rev 270153)
@@ -1,3 +1,24 @@
+2020-11-21  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Move current logicalLeft from ContinuousContent to LineStatus
+        https://bugs.webkit.org/show_bug.cgi?id=219237
+
+        Reviewed by Antti Koivisto.
+
+        Retain the content logical right in the LineStatus instead (this is used to measure text properly (see xPos) while finding hyphen position).
+
+        * layout/inlineformatting/InlineContentBreaker.cpp:
+        (WebCore::Layout::InlineContentBreaker::processOverflowingTextContent const):
+        (WebCore::Layout::InlineContentBreaker::ContinuousContent::reset):
+        * layout/inlineformatting/InlineContentBreaker.h:
+        (WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalWidth const):
+        (WebCore::Layout::InlineContentBreaker::ContinuousContent::logicalLeft const): Deleted.
+        * layout/inlineformatting/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineCandidate::InlineContent::reset):
+        (WebCore::Layout::LineCandidate::reset):
+        (WebCore::Layout::LineBuilder::nextContentForLine):
+        (WebCore::Layout::LineBuilder::handleFloatsAndInlineContent):
+
 2020-11-21  Simon Fraser  <[email protected]>
 
         Add an Experimental Features for wheel event gestures becoming non-blocking

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp (270152 => 270153)


--- trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp	2020-11-21 20:12:10 UTC (rev 270152)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp	2020-11-21 20:46:25 UTC (rev 270153)
@@ -274,7 +274,7 @@
             // <span style="word-break: keep-all">textcontentwithnobreak</span><span>textcontentwithyesbreak</span>
             // When the first span computes longer than the available space, by the time we get to the second span, the adjusted available space becomes negative.
             auto adjustedAvailableWidth = std::max<InlineLayoutUnit>(0, lineStatus.availableWidth - accumulatedRunWidth);
-            if (auto partialRun = tryBreakingTextRun(run, continuousContent.logicalLeft() + accumulatedRunWidth, adjustedAvailableWidth)) {
+            if (auto partialRun = tryBreakingTextRun(run, lineStatus.contentLogicalRight + accumulatedRunWidth, adjustedAvailableWidth)) {
                 if (partialRun->length)
                     return TrailingTextContent { index, false, partialRun };
                 // When the content is wrapped at the run boundary, the trailing run is the previous run.
@@ -296,7 +296,7 @@
         accumulatedRunWidth -= run.logicalWidth;
         if (isBreakableRun(run)) {
             ASSERT(run.inlineItem.isText());
-            if (auto partialRun = tryBreakingTextRun(run, continuousContent.logicalLeft() + accumulatedRunWidth, maxInlineLayoutUnit())) {
+            if (auto partialRun = tryBreakingTextRun(run, lineStatus.contentLogicalRight + accumulatedRunWidth, maxInlineLayoutUnit())) {
                 // We know this run fits, so if wrapping is allowed on the run, it should return a non-empty left-side.
                 ASSERT(partialRun->length);
                 return TrailingTextContent { index, false, partialRun };
@@ -412,9 +412,8 @@
     ASSERT(m_collapsibleLogicalWidth <= m_logicalWidth);
 }
 
-void InlineContentBreaker::ContinuousContent::reset(InlineLayoutUnit contentLogicalLeft)
+void InlineContentBreaker::ContinuousContent::reset()
 {
-    m_logicalLeft = contentLogicalLeft;
     m_logicalWidth = { };
     m_collapsibleLogicalWidth = { };
     m_runs.clear();

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h (270152 => 270153)


--- trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h	2020-11-21 20:12:10 UTC (rev 270152)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.h	2020-11-21 20:46:25 UTC (rev 270153)
@@ -79,7 +79,6 @@
     // see https://drafts.csswg.org/css-text-3/#line-break-details
     struct ContinuousContent {
         InlineLayoutUnit logicalWidth() const { return m_logicalWidth; }
-        InlineLayoutUnit logicalLeft() const { return m_logicalLeft; }
         InlineLayoutUnit collapsibleLogicalWidth() const { return m_collapsibleLogicalWidth; }
         InlineLayoutUnit nonCollapsibleLogicalWidth() const { return logicalWidth() - collapsibleLogicalWidth(); }
         bool hasTrailingCollapsibleContent() const { return !!collapsibleLogicalWidth(); }
@@ -86,7 +85,7 @@
         bool isFullyCollapsible() const { return logicalWidth() == collapsibleLogicalWidth(); }
 
         void append(const InlineItem&, InlineLayoutUnit logicalWidth, Optional<InlineLayoutUnit> collapsibleWidth);
-        void reset(InlineLayoutUnit contentLogicalLeft);
+        void reset();
 
         struct Run {
             Run(const InlineItem&, InlineLayoutUnit logicalWidth);
@@ -101,12 +100,12 @@
 
     private:
         RunList m_runs;
-        InlineLayoutUnit m_logicalLeft { 0 };
         InlineLayoutUnit m_logicalWidth { 0 };
         InlineLayoutUnit m_collapsibleLogicalWidth { 0 };
     };
 
     struct LineStatus {
+        InlineLayoutUnit contentLogicalRight { 0 };
         InlineLayoutUnit availableWidth { 0 };
         InlineLayoutUnit collapsibleWidth { 0 };
         Optional<InlineLayoutUnit> trailingSoftHyphenWidth;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (270152 => 270153)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-11-21 20:12:10 UTC (rev 270152)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-11-21 20:46:25 UTC (rev 270153)
@@ -124,7 +124,7 @@
 struct LineCandidate {
     LineCandidate(bool ignoreTrailingLetterSpacing);
 
-    void reset(InlineLayoutUnit contentLogicalLeft);
+    void reset();
 
     struct InlineContent {
         InlineContent(bool ignoreTrailingLetterSpacing);
@@ -136,7 +136,7 @@
         void appendInlineItem(const InlineItem&, InlineLayoutUnit logicalWidth);
         void appendTrailingLineBreak(const InlineItem& lineBreakItem) { m_trailingLineBreak = &lineBreakItem; }
         void appendtrailingWordBreakOpportunity(const InlineItem& wordBreakItem) { m_trailingWordBreakOpportunity = &wordBreakItem; }
-        void reset(InlineLayoutUnit contentLogicalLeft);
+        void reset();
 
     private:
         bool m_ignoreTrailingLetterSpacing { false };
@@ -202,9 +202,9 @@
     m_continuousContent.append(inlineItem, logicalWidth, collapsibleWidth());
 }
 
-inline void LineCandidate::InlineContent::reset(InlineLayoutUnit contentLogicalLeft)
+inline void LineCandidate::InlineContent::reset()
 {
-    m_continuousContent.reset(contentLogicalLeft);
+    m_continuousContent.reset();
     m_trailingLineBreak = { };
     m_trailingWordBreakOpportunity = { };
 }
@@ -222,10 +222,10 @@
     m_intrusiveWidth = { };
 }
 
-inline void LineCandidate::reset(InlineLayoutUnit contentLogicalLeft)
+inline void LineCandidate::reset()
 {
     floatContent.reset();
-    inlineContent.reset(contentLogicalLeft);
+    inlineContent.reset();
 }
 
 InlineLayoutUnit LineBuilder::inlineItemWidth(const InlineItem& inlineItem, InlineLayoutUnit contentLogicalLeft) const
@@ -454,7 +454,7 @@
 void LineBuilder::nextContentForLine(LineCandidate& lineCandidate, size_t currentInlineItemIndex, const InlineItemRange& layoutRange, size_t partialLeadingContentLength, InlineLayoutUnit availableLineWidth, InlineLayoutUnit currentLogicalRight)
 {
     ASSERT(currentInlineItemIndex < layoutRange.end);
-    lineCandidate.reset(currentLogicalRight);
+    lineCandidate.reset();
     // 1. Simply add any overflow content from the previous line to the candidate content. It's always a text content.
     // 2. Find the next soft wrap position or explicit line break.
     // 3. Collect floats between the inline content.
@@ -607,7 +607,7 @@
     // Check if this new content fits.
     auto availableWidth = this->availableWidth() - floatContent.intrusiveWidth();
     auto isLineConsideredEmpty = m_line.isConsideredEmpty() && !m_contentIsConstrainedByFloat;
-    auto lineStatus = InlineContentBreaker::LineStatus { availableWidth, m_line.trimmableTrailingWidth(), m_line.trailingSoftHyphenWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty };
+    auto lineStatus = InlineContentBreaker::LineStatus { m_line.contentLogicalWidth(), availableWidth, m_line.trimmableTrailingWidth(), m_line.trailingSoftHyphenWidth(), m_line.isTrailingRunFullyTrimmable(), isLineConsideredEmpty };
     auto result = inlineContentBreaker.processInlineContent(continuousInlineContent, lineStatus);
     if (result.lastWrapOpportunityItem)
         m_wrapOpportunityList.append(result.lastWrapOpportunityItem);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to