Diff
Modified: trunk/Source/WebCore/ChangeLog (283366 => 283367)
--- trunk/Source/WebCore/ChangeLog 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/ChangeLog 2021-10-01 15:12:38 UTC (rev 283367)
@@ -1,5 +1,87 @@
2021-10-01 Antti Koivisto <[email protected]>
+ Rename InlineIterator to LegacyInlineIterator
+ https://bugs.webkit.org/show_bug.cgi?id=231077
+
+ Reviewed by Alan Bujtas.
+
+ It is only used by the legacy line layout.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/Position.cpp:
+ * layout/integration/LayoutIntegrationCoverage.cpp:
+ * rendering/LegacyInlineIterator.cpp: Renamed from Source/WebCore/rendering/InlineIterator.cpp.
+ (WebCore::LegacyInlineIterator::surrogateTextDirection const):
+ * rendering/LegacyInlineIterator.h: Renamed from Source/WebCore/rendering/InlineIterator.h.
+ (WebCore::LegacyInlineIterator::LegacyInlineIterator):
+ (WebCore::operator==):
+ (WebCore::operator!=):
+ (WebCore::nextInlineRendererSkippingEmpty):
+ (WebCore::firstInlineRendererSkippingEmpty):
+
+ Rename this to not say "bidi".
+
+ (WebCore::LegacyInlineIterator::fastIncrementInTextNode):
+ (WebCore::LegacyInlineIterator::incrementByCodePointInTextNode):
+ (WebCore::LegacyInlineIterator::setOffset):
+ (WebCore::LegacyInlineIterator::setRefersToEndOfPreviousNode):
+ (WebCore::LegacyInlineIterator::increment):
+ (WebCore::LegacyInlineIterator::fastDecrement):
+ (WebCore::LegacyInlineIterator::atEnd const):
+ (WebCore::LegacyInlineIterator::characterAt const):
+ (WebCore::LegacyInlineIterator::current const):
+ (WebCore::LegacyInlineIterator::previousInSameNode const):
+ (WebCore::LegacyInlineIterator::direction const):
+ (WebCore::numberOfIsolateAncestors):
+ (WebCore::InlineBidiResolver::appendRunInternal):
+ * rendering/LegacyLineLayout.cpp:
+ (WebCore::determineDirectionality):
+ (WebCore::LegacyLineLayout::appendRunsForObject):
+ (WebCore::constructBidiRunsForSegment):
+ (WebCore::LegacyLineLayout::createLineBoxesFromBidiRuns):
+ (WebCore::LegacyLineLayout::layoutRunsAndFloats):
+ (WebCore::LegacyLineLayout::restartLayoutRunsAndFloatsInRange):
+ (WebCore::LegacyLineLayout::layoutRunsAndFloatsInRange):
+ (WebCore::LegacyLineLayout::determineStartPosition):
+ (WebCore::LegacyLineLayout::determineEndPosition):
+ (WebCore::LegacyLineLayout::matchedEndLine):
+ * rendering/LegacyLineLayout.h:
+ * rendering/LegacyRootInlineBox.h:
+ * rendering/RenderBlock.cpp:
+ * rendering/RenderBlockFlow.cpp:
+ * rendering/RenderInline.cpp:
+ (WebCore::isEmptyInline):
+ * rendering/RenderInline.h:
+ * rendering/RenderTreeAsText.cpp:
+ * rendering/line/BreakingContext.h:
+ (WebCore::BreakingContext::lineBreak):
+ (WebCore::BreakingContext::initializeForCurrentObject):
+ (WebCore::BreakingContext::handleBR):
+ (WebCore::shouldSkipWhitespaceAfterStartObject):
+ (WebCore::BreakingContext::handleReplaced):
+ (WebCore::iteratorIsBeyondEndOfRenderCombineText):
+ (WebCore::ensureCharacterGetsLineBox):
+ (WebCore::tryHyphenating):
+ (WebCore::BreakingContext::handleText):
+ (WebCore::BreakingContext::trailingSpacesHang):
+ (WebCore::checkWhitespaceCollapsingTransitions):
+ (WebCore::BreakingContext::handleEndOfLine):
+ * rendering/line/LineBreaker.cpp:
+ (WebCore::LineBreaker::skipTrailingWhitespace):
+ (WebCore::LineBreaker::nextLineBreak):
+ * rendering/line/LineBreaker.h:
+ * rendering/line/LineInlineHeaders.h:
+ (WebCore::skipNonBreakingSpace):
+ (WebCore::requiresLineBox):
+ * rendering/line/TrailingObjects.cpp:
+ (WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes):
+ * rendering/line/TrailingObjects.h:
+ * rendering/updating/RenderTreeBuilderList.cpp:
+ (WebCore::generatesLineBoxesForInlineChild):
+
+2021-10-01 Antti Koivisto <[email protected]>
+
Move InlineWalker to a file of its own and make it use RenderIterator
https://bugs.webkit.org/show_bug.cgi?id=231069
Modified: trunk/Source/WebCore/Sources.txt (283366 => 283367)
--- trunk/Source/WebCore/Sources.txt 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/Sources.txt 2021-10-01 15:12:38 UTC (rev 283367)
@@ -2214,7 +2214,6 @@
rendering/HitTestingTransformState.cpp
rendering/ImageQualityController.cpp
rendering/InlineBoxPainter.cpp
-rendering/InlineIterator.cpp
rendering/LayerAncestorClippingStack.cpp
rendering/LayerOverlapMap.cpp
rendering/LayoutDisallowedScope.cpp
@@ -2223,6 +2222,7 @@
rendering/LegacyInlineBox.cpp
rendering/LegacyInlineElementBox.cpp
rendering/LegacyInlineFlowBox.cpp
+rendering/LegacyInlineIterator.cpp
rendering/LegacyLineLayout.cpp
rendering/LegacyRootInlineBox.cpp
rendering/LegacyInlineTextBox.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283366 => 283367)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-10-01 15:12:38 UTC (rev 283367)
@@ -4222,7 +4222,7 @@
BCE659E60EA92FB2007E4533 /* ThemeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE659E50EA92FB2007E4533 /* ThemeMac.h */; };
BCE65BEB0EACDF16007E4533 /* Length.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE65BE90EACDF16007E4533 /* Length.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCE691E5264637FC00EBDC3A /* PixelBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4839BA2646181A00A28B62 /* PixelBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
- BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE789151120D6080060ECE5 /* InlineIterator.h */; };
+ BCE789161120D6080060ECE5 /* LegacyInlineIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE789151120D6080060ECE5 /* LegacyInlineIterator.h */; };
BCE789861120E7A60060ECE5 /* BidiRun.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE789851120E7A60060ECE5 /* BidiRun.h */; };
BCE93F451517C567008CCF74 /* RenderFragmentContainerSet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE93F441517C567008CCF74 /* RenderFragmentContainerSet.h */; };
BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11678,7 +11678,7 @@
930AAC9D250ED4090013DA9F /* JSCSSConditionRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSConditionRule.h; sourceTree = "<group>"; };
930AACA0250ED4110013DA9F /* JSCSSGroupingRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSGroupingRule.h; sourceTree = "<group>"; };
930AACA1250ED4110013DA9F /* JSCSSGroupingRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSGroupingRule.cpp; sourceTree = "<group>"; };
- 930C90DC19CF965300D6C21A /* InlineIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineIterator.cpp; sourceTree = "<group>"; };
+ 930C90DC19CF965300D6C21A /* LegacyInlineIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyInlineIterator.cpp; sourceTree = "<group>"; };
93153BD914181F7A00FCF5BE /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
93153BDB141959BB00FCF5BE /* textAreaResizeCorner.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = textAreaResizeCorner.png; sourceTree = "<group>"; };
93153BE114195A5700FCF5BE /* missingImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = missingImage.png; sourceTree = "<group>"; };
@@ -14672,7 +14672,7 @@
BCE65BE80EACDF16007E4533 /* Length.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Length.cpp; sourceTree = "<group>"; };
BCE65BE90EACDF16007E4533 /* Length.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Length.h; sourceTree = "<group>"; };
BCE65D310EAD1211007E4533 /* Theme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Theme.cpp; sourceTree = "<group>"; };
- BCE789151120D6080060ECE5 /* InlineIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineIterator.h; sourceTree = "<group>"; };
+ BCE789151120D6080060ECE5 /* LegacyInlineIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyInlineIterator.h; sourceTree = "<group>"; };
BCE789851120E7A60060ECE5 /* BidiRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BidiRun.h; sourceTree = "<group>"; };
BCE7898A1120E8020060ECE5 /* BidiRun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BidiRun.cpp; sourceTree = "<group>"; };
BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHistoryCustom.cpp; sourceTree = "<group>"; };
@@ -29965,8 +29965,6 @@
B51A2F3E17D7D3A40072517A /* ImageQualityController.h */,
E4F819C226FB4EAF0094E162 /* InlineBoxPainter.cpp */,
E4F819C526FB4EBF0094E162 /* InlineBoxPainter.h */,
- 930C90DC19CF965300D6C21A /* InlineIterator.cpp */,
- BCE789151120D6080060ECE5 /* InlineIterator.h */,
E47CEBC72706EF5100B8D8F5 /* InlineWalker.h */,
0FEC120B22BF2CC7004E9D35 /* LayerAncestorClippingStack.cpp */,
0FEC120922BF2CC7004E9D35 /* LayerAncestorClippingStack.h */,
@@ -29985,6 +29983,8 @@
B57CB52B182A37F60079A647 /* LegacyInlineElementBox.h */,
A8CFF5DD0A155A05000A4234 /* LegacyInlineFlowBox.cpp */,
A8CFF5DC0A155A05000A4234 /* LegacyInlineFlowBox.h */,
+ 930C90DC19CF965300D6C21A /* LegacyInlineIterator.cpp */,
+ BCE789151120D6080060ECE5 /* LegacyInlineIterator.h */,
BCEA481A097D93020094C9E4 /* LegacyInlineTextBox.cpp */,
BCEA481B097D93020094C9E4 /* LegacyInlineTextBox.h */,
BCEA4813097D93020094C9E4 /* LegacyLineLayout.cpp */,
@@ -32979,7 +32979,6 @@
115CFA7E208B8E10001E6991 /* InlineFormattingState.h in Headers */,
111FA1C726F0F30F003B8F16 /* InlineInvalidation.h in Headers */,
6FE7CFA22177EEF2005B1573 /* InlineItem.h in Headers */,
- BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */,
6FAAE71326A2814B00E07502 /* InlineLevelBox.h in Headers */,
6F0CD695229ED32700C5994E /* InlineLine.h in Headers */,
6FB2400523DFF12800796458 /* InlineLineBox.h in Headers */,
@@ -34010,6 +34009,7 @@
A8CFF5E50A155A05000A4234 /* LegacyInlineBox.h in Headers */,
B57CB52E182A3EFC0079A647 /* LegacyInlineElementBox.h in Headers */,
A8CFF5E30A155A05000A4234 /* LegacyInlineFlowBox.h in Headers */,
+ BCE789161120D6080060ECE5 /* LegacyInlineIterator.h in Headers */,
BCEA485A097D93020094C9E4 /* LegacyInlineTextBox.h in Headers */,
E4E94D6122FF158A00DD191F /* LegacyLineLayout.h in Headers */,
F44A5F591FED38F2007F5944 /* LegacyNSPasteboardTypes.h in Headers */,
Modified: trunk/Source/WebCore/dom/Position.cpp (283366 => 283367)
--- trunk/Source/WebCore/dom/Position.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/dom/Position.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -35,7 +35,6 @@
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
#include "HTMLTableElement.h"
-#include "InlineIterator.h"
#include "InlineRunAndOffset.h"
#include "LayoutIntegrationLineIterator.h"
#include "LayoutIntegrationRunIterator.h"
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (283366 => 283367)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -27,7 +27,7 @@
#include "LayoutIntegrationCoverage.h"
#include "HTMLTextFormControlElement.h"
-#include "InlineIterator.h"
+#include "InlineWalker.h"
#include "Logging.h"
#include "RenderBlockFlow.h"
#include "RenderChildIterator.h"
Deleted: trunk/Source/WebCore/rendering/InlineIterator.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/InlineIterator.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/InlineIterator.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -1,52 +0,0 @@
-/*
-
-Copyright (C) 2014 Apple Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#include "config.h"
-#include "InlineIterator.h"
-
-namespace WebCore {
-
-UCharDirection InlineIterator::surrogateTextDirection(UChar currentCodeUnit) const
-{
- RenderText& text = downcast<RenderText>(*m_renderer);
- UChar lead;
- UChar trail;
- if (U16_IS_LEAD(currentCodeUnit)) {
- lead = currentCodeUnit;
- trail = text.characterAt(m_pos + 1);
- if (!U16_IS_TRAIL(trail))
- return U_OTHER_NEUTRAL;
- } else {
- ASSERT(U16_IS_TRAIL(currentCodeUnit));
- lead = text.characterAt(m_pos - 1);
- if (!U16_IS_LEAD(lead))
- return U_OTHER_NEUTRAL;
- trail = currentCodeUnit;
- }
- return u_charDirection(U16_GET_SUPPLEMENTARY(lead, trail));
-}
-
-}
Deleted: trunk/Source/WebCore/rendering/InlineIterator.h (283366 => 283367)
--- trunk/Source/WebCore/rendering/InlineIterator.h 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/InlineIterator.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -1,526 +0,0 @@
-/*
- * Copyright (C) 2000 Lars Knoll ([email protected])
- * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right reserved.
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#pragma once
-
-#include "BidiRun.h"
-#include "RenderBlockFlow.h"
-#include "RenderChildIterator.h"
-#include "RenderInline.h"
-#include "RenderText.h"
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-struct BidiIsolatedRun {
- BidiIsolatedRun(RenderObject& object, unsigned position, RenderElement& root, BidiRun& runToReplace)
- : object(object)
- , root(root)
- , runToReplace(runToReplace)
- , position(position)
- {
- }
-
- RenderObject& object;
- RenderElement& root;
- BidiRun& runToReplace;
- unsigned position;
-};
-
-// This class is used to RenderInline subtrees, stepping by character within the
-// text children. InlineIterator will use bidiNext to find the next RenderText
-// optionally notifying a BidiResolver every time it steps into/out of a RenderInline.
-class InlineIterator {
-public:
- InlineIterator()
- {
- }
-
- InlineIterator(RenderElement* root, RenderObject* o, unsigned p)
- : m_root(root)
- , m_renderer(o)
- , m_pos(p)
- , m_refersToEndOfPreviousNode(false)
- {
- }
-
- void clear()
- {
- setRenderer(nullptr);
- setOffset(0);
- setNextBreakablePosition(std::numeric_limits<unsigned>::max());
- }
- void moveToStartOf(RenderObject& object)
- {
- moveTo(object, 0);
- }
-
- void moveTo(RenderObject& object, unsigned offset, std::optional<unsigned> nextBreak = std::optional<unsigned>())
- {
- setRenderer(&object);
- setOffset(offset);
- setNextBreakablePosition(nextBreak);
- }
-
- RenderObject* renderer() const { return m_renderer; }
- void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
- unsigned offset() const { return m_pos; }
- void setOffset(unsigned position);
- RenderElement* root() const { return m_root; }
- std::optional<unsigned> nextBreakablePosition() const { return m_nextBreakablePosition; }
- void setNextBreakablePosition(std::optional<unsigned> position) { m_nextBreakablePosition = position; }
- bool refersToEndOfPreviousNode() const { return m_refersToEndOfPreviousNode; }
- void setRefersToEndOfPreviousNode();
-
- void fastIncrementInTextNode();
- void incrementByCodePointInTextNode();
- void increment(InlineBidiResolver* = nullptr);
- void fastDecrement();
- bool atEnd() const;
-
- bool atTextParagraphSeparator() const
- {
- return is<RenderText>(m_renderer) && m_renderer->preservesNewline() && downcast<RenderText>(*m_renderer).characterAt(m_pos) == '\n';
- }
-
- bool atParagraphSeparator() const
- {
- return (m_renderer && m_renderer->isBR()) || atTextParagraphSeparator();
- }
-
- UChar current() const;
- UChar previousInSameNode() const;
- ALWAYS_INLINE UCharDirection direction() const;
-
-private:
- UChar characterAt(unsigned) const;
-
- UCharDirection surrogateTextDirection(UChar currentCodeUnit) const;
-
- RenderElement* m_root { nullptr };
- RenderObject* m_renderer { nullptr };
-
- std::optional<unsigned> m_nextBreakablePosition;
- unsigned m_pos { 0 };
-
- // There are a couple places where we want to decrement an InlineIterator.
- // Usually this take the form of decrementing m_pos; however, m_pos might be 0.
- // However, we shouldn't ever need to decrement an InlineIterator more than
- // once, so rather than implementing a decrement() function which traverses
- // nodes, we can simply keep track of this state and handle it.
- bool m_refersToEndOfPreviousNode { false };
-};
-
-inline bool operator==(const InlineIterator& it1, const InlineIterator& it2)
-{
- return it1.offset() == it2.offset() && it1.renderer() == it2.renderer();
-}
-
-inline bool operator!=(const InlineIterator& it1, const InlineIterator& it2)
-{
- return it1.offset() != it2.offset() || it1.renderer() != it2.renderer();
-}
-
-static inline UCharDirection embedCharFromDirection(TextDirection direction, EUnicodeBidi unicodeBidi)
-{
- if (unicodeBidi == Embed)
- return direction == TextDirection::RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING;
- return direction == TextDirection::RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE;
-}
-
-template <class Observer>
-static inline void notifyObserverEnteredObject(Observer* observer, RenderObject* object)
-{
- if (!observer || !object || !object->isRenderInline())
- return;
-
- const RenderStyle& style = object->style();
- EUnicodeBidi unicodeBidi = style.unicodeBidi();
- if (unicodeBidi == UBNormal) {
- // http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi
- // "The element does not open an additional level of embedding with respect to the bidirectional algorithm."
- // Thus we ignore any possible dir= attribute on the span.
- return;
- }
- if (isIsolated(unicodeBidi)) {
- // Make sure that explicit embeddings are committed before we enter the isolated content.
- observer->commitExplicitEmbedding();
- observer->enterIsolate();
- // Embedding/Override characters implied by dir= will be handled when
- // we process the isolated span, not when laying out the "parent" run.
- return;
- }
-
- if (!observer->inIsolate())
- observer->embed(embedCharFromDirection(style.direction(), unicodeBidi), FromStyleOrDOM);
-}
-
-template <class Observer>
-static inline void notifyObserverWillExitObject(Observer* observer, RenderObject* object)
-{
- if (!observer || !object || !object->isRenderInline())
- return;
-
- EUnicodeBidi unicodeBidi = object->style().unicodeBidi();
- if (unicodeBidi == UBNormal)
- return; // Nothing to do for unicode-bidi: normal
- if (isIsolated(unicodeBidi)) {
- observer->exitIsolate();
- return;
- }
-
- // Otherwise we pop any embed/override character we added when we opened this tag.
- if (!observer->inIsolate())
- observer->embed(U_POP_DIRECTIONAL_FORMAT, FromStyleOrDOM);
-}
-
-static inline bool isIteratorTarget(RenderObject* object)
-{
- ASSERT(object); // The iterator will of course return 0, but its not an expected argument to this function.
- return object->isTextOrLineBreak() || object->isFloating() || object->isOutOfFlowPositioned() || object->isReplaced();
-}
-
-static bool isEmptyInline(const RenderInline& renderer)
-{
- for (auto& current : childrenOfType<RenderObject>(renderer)) {
- if (current.isFloatingOrOutOfFlowPositioned())
- continue;
- if (is<RenderText>(current)) {
- if (!downcast<RenderText>(current).isAllCollapsibleWhitespace())
- return false;
- continue;
- }
- if (!is<RenderInline>(current) || !isEmptyInline(downcast<RenderInline>(current)))
- return false;
- }
- return true;
-}
-
-template <class Observer>
-static inline RenderObject* bidiNextSkippingEmptyInlines(RenderElement& root, RenderObject* current, Observer* observer)
-{
- RenderObject* next = nullptr;
-
- while (current) {
- next = nullptr;
- if (!isIteratorTarget(current)) {
- next = downcast<RenderElement>(*current).firstChild();
- notifyObserverEnteredObject(observer, next);
- }
-
- if (!next) {
- while (current && current != &root) {
- notifyObserverWillExitObject(observer, current);
-
- next = current->nextSibling();
- if (next) {
- notifyObserverEnteredObject(observer, next);
- break;
- }
-
- current = current->parent();
- }
- }
-
- if (!next)
- break;
-
- if (isIteratorTarget(next) || (is<RenderInline>(*next) && isEmptyInline(downcast<RenderInline>(*next))))
- break;
- current = next;
- }
-
- return next;
-}
-
-// This makes callers cleaner as they don't have to specify a type for the observer when not providing one.
-static inline RenderObject* bidiNextSkippingEmptyInlines(RenderElement& root, RenderObject* current)
-{
- InlineBidiResolver* observer = nullptr;
- return bidiNextSkippingEmptyInlines(root, current, observer);
-}
-
-static inline RenderObject* bidiFirstSkippingEmptyInlines(RenderElement& root, InlineBidiResolver* resolver = nullptr)
-{
- RenderObject* renderer = root.firstChild();
- if (!renderer)
- return nullptr;
-
- if (is<RenderInline>(*renderer)) {
- notifyObserverEnteredObject(resolver, renderer);
- if (!isEmptyInline(downcast<RenderInline>(*renderer)))
- renderer = bidiNextSkippingEmptyInlines(root, renderer, resolver);
- else {
- // Never skip empty inlines.
- if (resolver)
- resolver->commitExplicitEmbedding();
- return renderer;
- }
- }
-
- // FIXME: Unify this with the bidiNext call above.
- if (renderer && !isIteratorTarget(renderer))
- renderer = bidiNextSkippingEmptyInlines(root, renderer, resolver);
-
- if (resolver)
- resolver->commitExplicitEmbedding();
- return renderer;
-}
-
-inline void InlineIterator::fastIncrementInTextNode()
-{
- ASSERT(m_renderer);
- ASSERT(m_pos <= downcast<RenderText>(*m_renderer).text().length());
- ++m_pos;
-}
-
-inline void InlineIterator::incrementByCodePointInTextNode()
-{
- ASSERT(m_renderer);
- const auto& text = downcast<RenderText>(*m_renderer).text();
- ASSERT(m_pos < text.length());
- if (text.is8Bit()) {
- ++m_pos;
- return;
- }
- UChar32 character;
- U16_NEXT(text.characters16(), m_pos, text.length(), character);
-}
-
-inline void InlineIterator::setOffset(unsigned position)
-{
- ASSERT(position <= UINT_MAX - 10); // Sanity check
- m_pos = position;
-}
-
-inline void InlineIterator::setRefersToEndOfPreviousNode()
-{
- ASSERT(!m_pos);
- ASSERT(!m_refersToEndOfPreviousNode);
- m_refersToEndOfPreviousNode = true;
-}
-
-
-inline void InlineIterator::increment(InlineBidiResolver* resolver)
-{
- if (!m_renderer)
- return;
- if (is<RenderText>(*m_renderer)) {
- fastIncrementInTextNode();
- if (m_pos < downcast<RenderText>(*m_renderer).text().length())
- return;
- }
- // bidiNext can return nullptr
- RenderObject* bidiNext = bidiNextSkippingEmptyInlines(*m_root, m_renderer, resolver);
- if (bidiNext)
- moveToStartOf(*bidiNext);
- else
- clear();
-}
-
-inline void InlineIterator::fastDecrement()
-{
- ASSERT(!refersToEndOfPreviousNode());
- if (m_pos)
- setOffset(m_pos - 1);
- else
- setRefersToEndOfPreviousNode();
-}
-
-inline bool InlineIterator::atEnd() const
-{
- return !m_renderer;
-}
-
-inline UChar InlineIterator::characterAt(unsigned index) const
-{
- if (!is<RenderText>(m_renderer))
- return 0;
-
- return downcast<RenderText>(*m_renderer).characterAt(index);
-}
-
-inline UChar InlineIterator::current() const
-{
- return characterAt(m_pos);
-}
-
-inline UChar InlineIterator::previousInSameNode() const
-{
- return characterAt(m_pos - 1);
-}
-
-ALWAYS_INLINE UCharDirection InlineIterator::direction() const
-{
- if (UNLIKELY(!m_renderer))
- return U_OTHER_NEUTRAL;
-
- if (LIKELY(is<RenderText>(*m_renderer))) {
- UChar codeUnit = downcast<RenderText>(*m_renderer).characterAt(m_pos);
- if (LIKELY(U16_IS_SINGLE(codeUnit)))
- return u_charDirection(codeUnit);
- return surrogateTextDirection(codeUnit);
- }
-
- if (m_renderer->isListMarker())
- return m_renderer->style().isLeftToRightDirection() ? U_LEFT_TO_RIGHT : U_RIGHT_TO_LEFT;
-
- return U_OTHER_NEUTRAL;
-}
-
-template<>
-inline void InlineBidiResolver::incrementInternal()
-{
- m_current.increment(this);
-}
-
-static inline bool isIsolatedInline(RenderObject& object)
-{
- return object.isRenderInline() && isIsolated(object.style().unicodeBidi());
-}
-
-static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject& initialObject, RenderObject* root)
-{
- RenderObject* containingIsolateObject = nullptr;
- for (RenderObject* object = &initialObject; object && object != root; object = object->parent()) {
- if (isIsolatedInline(*object))
- containingIsolateObject = object;
- }
- return containingIsolateObject;
-}
-
-static inline unsigned numberOfIsolateAncestors(const InlineIterator& iter)
-{
- unsigned count = 0;
- typedef RenderObject* RenderObjectPtr;
- for (RenderObjectPtr object = iter.renderer(), root = iter.root(); object && object != root; object = object->parent()) {
- if (isIsolatedInline(*object))
- count++;
- }
- return count;
-}
-
-// FIXME: This belongs on InlineBidiResolver, except it's a template specialization
-// of BidiResolver which knows nothing about RenderObjects.
-static inline void addPlaceholderRunForIsolatedInline(InlineBidiResolver& resolver, RenderObject& obj, unsigned pos, RenderElement& root)
-{
- std::unique_ptr<BidiRun> isolatedRun = makeUnique<BidiRun>(pos, pos, obj, resolver.context(), resolver.dir());
- // FIXME: isolatedRuns() could be a hash of object->run and then we could cheaply
- // ASSERT here that we didn't create multiple objects for the same inline.
- resolver.setWhitespaceCollapsingTransitionForIsolatedRun(*isolatedRun, resolver.whitespaceCollapsingState().currentTransition());
- resolver.isolatedRuns().append(BidiIsolatedRun(obj, pos, root, *isolatedRun));
- resolver.runs().appendRun(WTFMove(isolatedRun));
-}
-
-class IsolateTracker {
-public:
- explicit IsolateTracker(unsigned nestedIsolateCount)
- : m_nestedIsolateCount(nestedIsolateCount)
- , m_haveAddedFakeRunForRootIsolate(false)
- {
- }
-
- void enterIsolate() { m_nestedIsolateCount++; }
- void exitIsolate()
- {
- ASSERT(m_nestedIsolateCount >= 1);
- m_nestedIsolateCount--;
- if (!inIsolate())
- m_haveAddedFakeRunForRootIsolate = false;
- }
- bool inIsolate() const { return m_nestedIsolateCount; }
-
- // We don't care if we encounter bidi directional overrides.
- void embed(UCharDirection, BidiEmbeddingSource) { }
- void commitExplicitEmbedding() { }
-
- void addFakeRunIfNecessary(RenderObject& obj, unsigned pos, unsigned end, RenderElement& root, InlineBidiResolver& resolver)
- {
- // We only need to add a fake run for a given isolated span once during each call to createBidiRunsForLine.
- // We'll be called for every span inside the isolated span so we just ignore subsequent calls.
- // We also avoid creating a fake run until we hit a child that warrants one, e.g. we skip floats.
- if (RenderBlock::shouldSkipCreatingRunsForObject(obj))
- return;
- if (!m_haveAddedFakeRunForRootIsolate) {
- // obj and pos together denote a single position in the inline, from which the parsing of the isolate will start.
- // We don't need to mark the end of the run because this is implicit: it is either endOfLine or the end of the
- // isolate, when we call createBidiRunsForLine it will stop at whichever comes first.
- addPlaceholderRunForIsolatedInline(resolver, obj, pos, root);
- }
- m_haveAddedFakeRunForRootIsolate = true;
- LegacyLineLayout::appendRunsForObject(nullptr, pos, end, obj, resolver);
- }
-
-private:
- unsigned m_nestedIsolateCount;
- bool m_haveAddedFakeRunForRootIsolate;
-};
-
-template<>
-inline void InlineBidiResolver::appendRunInternal()
-{
- if (!m_emptyRun && !m_eor.atEnd() && !m_reachedEndOfLine) {
- // Keep track of when we enter/leave "unicode-bidi: isolate" inlines.
- // Initialize our state depending on if we're starting in the middle of such an inline.
- // FIXME: Could this initialize from this->inIsolate() instead of walking up the render tree?
- IsolateTracker isolateTracker(numberOfIsolateAncestors(m_sor));
- int start = m_sor.offset();
- RenderObject* obj = m_sor.renderer();
- while (obj && obj != m_eor.renderer() && obj != endOfLine.renderer()) {
- if (isolateTracker.inIsolate())
- isolateTracker.addFakeRunIfNecessary(*obj, start, obj->length(), *m_sor.root(), *this);
- else
- LegacyLineLayout::appendRunsForObject(&m_runs, start, obj->length(), *obj, *this);
- // FIXME: start/obj should be an InlineIterator instead of two separate variables.
- start = 0;
- obj = bidiNextSkippingEmptyInlines(*m_sor.root(), obj, &isolateTracker);
- }
- if (obj) {
- unsigned pos = obj == m_eor.renderer() ? m_eor.offset() : UINT_MAX;
- if (obj == endOfLine.renderer() && endOfLine.offset() <= pos) {
- m_reachedEndOfLine = true;
- pos = endOfLine.offset();
- }
- // It's OK to add runs for zero-length RenderObjects, just don't make the run larger than it should be
- int end = obj->length() ? pos + 1 : 0;
- if (isolateTracker.inIsolate())
- isolateTracker.addFakeRunIfNecessary(*obj, start, obj->length(), *m_sor.root(), *this);
- else
- LegacyLineLayout::appendRunsForObject(&m_runs, start, end, *obj, *this);
- }
-
- m_eor.increment();
- m_sor = m_eor;
- }
-
- m_direction = U_OTHER_NEUTRAL;
- m_status.eor = U_OTHER_NEUTRAL;
-}
-
-template<>
-inline bool InlineBidiResolver::needsContinuePastEndInternal() const
-{
- // We don't collect runs beyond the endOfLine renderer. Stop traversing when the iterator moves to the next renderer to prevent O(n^2).
- return m_current.renderer() == endOfLine.renderer();
-}
-
-} // namespace WebCore
Copied: trunk/Source/WebCore/rendering/LegacyInlineIterator.cpp (from rev 283366, trunk/Source/WebCore/rendering/InlineIterator.cpp) (0 => 283367)
--- trunk/Source/WebCore/rendering/LegacyInlineIterator.cpp (rev 0)
+++ trunk/Source/WebCore/rendering/LegacyInlineIterator.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -0,0 +1,52 @@
+/*
+
+Copyright (C) 2014 Apple Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include "config.h"
+#include "LegacyInlineIterator.h"
+
+namespace WebCore {
+
+UCharDirection LegacyInlineIterator::surrogateTextDirection(UChar currentCodeUnit) const
+{
+ RenderText& text = downcast<RenderText>(*m_renderer);
+ UChar lead;
+ UChar trail;
+ if (U16_IS_LEAD(currentCodeUnit)) {
+ lead = currentCodeUnit;
+ trail = text.characterAt(m_pos + 1);
+ if (!U16_IS_TRAIL(trail))
+ return U_OTHER_NEUTRAL;
+ } else {
+ ASSERT(U16_IS_TRAIL(currentCodeUnit));
+ lead = text.characterAt(m_pos - 1);
+ if (!U16_IS_LEAD(lead))
+ return U_OTHER_NEUTRAL;
+ trail = currentCodeUnit;
+ }
+ return u_charDirection(U16_GET_SUPPLEMENTARY(lead, trail));
+}
+
+}
Copied: trunk/Source/WebCore/rendering/LegacyInlineIterator.h (from rev 283366, trunk/Source/WebCore/rendering/InlineIterator.h) (0 => 283367)
--- trunk/Source/WebCore/rendering/LegacyInlineIterator.h (rev 0)
+++ trunk/Source/WebCore/rendering/LegacyInlineIterator.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -0,0 +1,510 @@
+/*
+ * Copyright (C) 2000 Lars Knoll ([email protected])
+ * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#pragma once
+
+#include "BidiRun.h"
+#include "RenderBlockFlow.h"
+#include "RenderChildIterator.h"
+#include "RenderInline.h"
+#include "RenderText.h"
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+struct BidiIsolatedRun {
+ BidiIsolatedRun(RenderObject& object, unsigned position, RenderElement& root, BidiRun& runToReplace)
+ : object(object)
+ , root(root)
+ , runToReplace(runToReplace)
+ , position(position)
+ {
+ }
+
+ RenderObject& object;
+ RenderElement& root;
+ BidiRun& runToReplace;
+ unsigned position;
+};
+
+// This class is used to RenderInline subtrees, stepping by character within the
+// text children. LegacyInlineIterator will use next to find the next RenderText
+// optionally notifying a BidiResolver every time it steps into/out of a RenderInline.
+class LegacyInlineIterator {
+public:
+ LegacyInlineIterator()
+ {
+ }
+
+ LegacyInlineIterator(RenderElement* root, RenderObject* o, unsigned p)
+ : m_root(root)
+ , m_renderer(o)
+ , m_pos(p)
+ , m_refersToEndOfPreviousNode(false)
+ {
+ }
+
+ void clear()
+ {
+ setRenderer(nullptr);
+ setOffset(0);
+ setNextBreakablePosition(std::numeric_limits<unsigned>::max());
+ }
+ void moveToStartOf(RenderObject& object)
+ {
+ moveTo(object, 0);
+ }
+
+ void moveTo(RenderObject& object, unsigned offset, std::optional<unsigned> nextBreak = std::optional<unsigned>())
+ {
+ setRenderer(&object);
+ setOffset(offset);
+ setNextBreakablePosition(nextBreak);
+ }
+
+ RenderObject* renderer() const { return m_renderer; }
+ void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
+ unsigned offset() const { return m_pos; }
+ void setOffset(unsigned position);
+ RenderElement* root() const { return m_root; }
+ std::optional<unsigned> nextBreakablePosition() const { return m_nextBreakablePosition; }
+ void setNextBreakablePosition(std::optional<unsigned> position) { m_nextBreakablePosition = position; }
+ bool refersToEndOfPreviousNode() const { return m_refersToEndOfPreviousNode; }
+ void setRefersToEndOfPreviousNode();
+
+ void fastIncrementInTextNode();
+ void incrementByCodePointInTextNode();
+ void increment(InlineBidiResolver* = nullptr);
+ void fastDecrement();
+ bool atEnd() const;
+
+ bool atTextParagraphSeparator() const
+ {
+ return is<RenderText>(m_renderer) && m_renderer->preservesNewline() && downcast<RenderText>(*m_renderer).characterAt(m_pos) == '\n';
+ }
+
+ bool atParagraphSeparator() const
+ {
+ return (m_renderer && m_renderer->isBR()) || atTextParagraphSeparator();
+ }
+
+ UChar current() const;
+ UChar previousInSameNode() const;
+ ALWAYS_INLINE UCharDirection direction() const;
+
+private:
+ UChar characterAt(unsigned) const;
+
+ UCharDirection surrogateTextDirection(UChar currentCodeUnit) const;
+
+ RenderElement* m_root { nullptr };
+ RenderObject* m_renderer { nullptr };
+
+ std::optional<unsigned> m_nextBreakablePosition;
+ unsigned m_pos { 0 };
+
+ // There are a couple places where we want to decrement an LegacyInlineIterator.
+ // Usually this take the form of decrementing m_pos; however, m_pos might be 0.
+ // However, we shouldn't ever need to decrement an LegacyInlineIterator more than
+ // once, so rather than implementing a decrement() function which traverses
+ // nodes, we can simply keep track of this state and handle it.
+ bool m_refersToEndOfPreviousNode { false };
+};
+
+inline bool operator==(const LegacyInlineIterator& it1, const LegacyInlineIterator& it2)
+{
+ return it1.offset() == it2.offset() && it1.renderer() == it2.renderer();
+}
+
+inline bool operator!=(const LegacyInlineIterator& it1, const LegacyInlineIterator& it2)
+{
+ return it1.offset() != it2.offset() || it1.renderer() != it2.renderer();
+}
+
+static inline UCharDirection embedCharFromDirection(TextDirection direction, EUnicodeBidi unicodeBidi)
+{
+ if (unicodeBidi == Embed)
+ return direction == TextDirection::RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING;
+ return direction == TextDirection::RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE;
+}
+
+template <class Observer>
+static inline void notifyObserverEnteredObject(Observer* observer, RenderObject* object)
+{
+ if (!observer || !object || !object->isRenderInline())
+ return;
+
+ const RenderStyle& style = object->style();
+ EUnicodeBidi unicodeBidi = style.unicodeBidi();
+ if (unicodeBidi == UBNormal) {
+ // http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi
+ // "The element does not open an additional level of embedding with respect to the bidirectional algorithm."
+ // Thus we ignore any possible dir= attribute on the span.
+ return;
+ }
+ if (isIsolated(unicodeBidi)) {
+ // Make sure that explicit embeddings are committed before we enter the isolated content.
+ observer->commitExplicitEmbedding();
+ observer->enterIsolate();
+ // Embedding/Override characters implied by dir= will be handled when
+ // we process the isolated span, not when laying out the "parent" run.
+ return;
+ }
+
+ if (!observer->inIsolate())
+ observer->embed(embedCharFromDirection(style.direction(), unicodeBidi), FromStyleOrDOM);
+}
+
+template <class Observer>
+static inline void notifyObserverWillExitObject(Observer* observer, RenderObject* object)
+{
+ if (!observer || !object || !object->isRenderInline())
+ return;
+
+ EUnicodeBidi unicodeBidi = object->style().unicodeBidi();
+ if (unicodeBidi == UBNormal)
+ return; // Nothing to do for unicode-bidi: normal
+ if (isIsolated(unicodeBidi)) {
+ observer->exitIsolate();
+ return;
+ }
+
+ // Otherwise we pop any embed/override character we added when we opened this tag.
+ if (!observer->inIsolate())
+ observer->embed(U_POP_DIRECTIONAL_FORMAT, FromStyleOrDOM);
+}
+
+static inline bool isIteratorTarget(RenderObject* object)
+{
+ ASSERT(object); // The iterator will of course return 0, but its not an expected argument to this function.
+ return object->isTextOrLineBreak() || object->isFloating() || object->isOutOfFlowPositioned() || object->isReplaced();
+}
+
+template <class Observer>
+static inline RenderObject* nextInlineRendererSkippingEmpty(RenderElement& root, RenderObject* current, Observer* observer)
+{
+ RenderObject* next = nullptr;
+
+ while (current) {
+ next = nullptr;
+ if (!isIteratorTarget(current)) {
+ next = downcast<RenderElement>(*current).firstChild();
+ notifyObserverEnteredObject(observer, next);
+ }
+
+ if (!next) {
+ while (current && current != &root) {
+ notifyObserverWillExitObject(observer, current);
+
+ next = current->nextSibling();
+ if (next) {
+ notifyObserverEnteredObject(observer, next);
+ break;
+ }
+
+ current = current->parent();
+ }
+ }
+
+ if (!next)
+ break;
+
+ if (isIteratorTarget(next) || (is<RenderInline>(*next) && isEmptyInline(downcast<RenderInline>(*next))))
+ break;
+ current = next;
+ }
+
+ return next;
+}
+
+// This makes callers cleaner as they don't have to specify a type for the observer when not providing one.
+static inline RenderObject* nextInlineRendererSkippingEmpty(RenderElement& root, RenderObject* current)
+{
+ InlineBidiResolver* observer = nullptr;
+ return nextInlineRendererSkippingEmpty(root, current, observer);
+}
+
+static inline RenderObject* firstInlineRendererSkippingEmpty(RenderElement& root, InlineBidiResolver* resolver = nullptr)
+{
+ RenderObject* renderer = root.firstChild();
+ if (!renderer)
+ return nullptr;
+
+ if (is<RenderInline>(*renderer)) {
+ notifyObserverEnteredObject(resolver, renderer);
+ if (!isEmptyInline(downcast<RenderInline>(*renderer)))
+ renderer = nextInlineRendererSkippingEmpty(root, renderer, resolver);
+ else {
+ // Never skip empty inlines.
+ if (resolver)
+ resolver->commitExplicitEmbedding();
+ return renderer;
+ }
+ }
+
+ // FIXME: Unify this with the next call above.
+ if (renderer && !isIteratorTarget(renderer))
+ renderer = nextInlineRendererSkippingEmpty(root, renderer, resolver);
+
+ if (resolver)
+ resolver->commitExplicitEmbedding();
+ return renderer;
+}
+
+inline void LegacyInlineIterator::fastIncrementInTextNode()
+{
+ ASSERT(m_renderer);
+ ASSERT(m_pos <= downcast<RenderText>(*m_renderer).text().length());
+ ++m_pos;
+}
+
+inline void LegacyInlineIterator::incrementByCodePointInTextNode()
+{
+ ASSERT(m_renderer);
+ const auto& text = downcast<RenderText>(*m_renderer).text();
+ ASSERT(m_pos < text.length());
+ if (text.is8Bit()) {
+ ++m_pos;
+ return;
+ }
+ UChar32 character;
+ U16_NEXT(text.characters16(), m_pos, text.length(), character);
+}
+
+inline void LegacyInlineIterator::setOffset(unsigned position)
+{
+ ASSERT(position <= UINT_MAX - 10); // Sanity check
+ m_pos = position;
+}
+
+inline void LegacyInlineIterator::setRefersToEndOfPreviousNode()
+{
+ ASSERT(!m_pos);
+ ASSERT(!m_refersToEndOfPreviousNode);
+ m_refersToEndOfPreviousNode = true;
+}
+
+
+inline void LegacyInlineIterator::increment(InlineBidiResolver* resolver)
+{
+ if (!m_renderer)
+ return;
+ if (is<RenderText>(*m_renderer)) {
+ fastIncrementInTextNode();
+ if (m_pos < downcast<RenderText>(*m_renderer).text().length())
+ return;
+ }
+ // next can return nullptr
+ RenderObject* next = nextInlineRendererSkippingEmpty(*m_root, m_renderer, resolver);
+ if (next)
+ moveToStartOf(*next);
+ else
+ clear();
+}
+
+inline void LegacyInlineIterator::fastDecrement()
+{
+ ASSERT(!refersToEndOfPreviousNode());
+ if (m_pos)
+ setOffset(m_pos - 1);
+ else
+ setRefersToEndOfPreviousNode();
+}
+
+inline bool LegacyInlineIterator::atEnd() const
+{
+ return !m_renderer;
+}
+
+inline UChar LegacyInlineIterator::characterAt(unsigned index) const
+{
+ if (!is<RenderText>(m_renderer))
+ return 0;
+
+ return downcast<RenderText>(*m_renderer).characterAt(index);
+}
+
+inline UChar LegacyInlineIterator::current() const
+{
+ return characterAt(m_pos);
+}
+
+inline UChar LegacyInlineIterator::previousInSameNode() const
+{
+ return characterAt(m_pos - 1);
+}
+
+ALWAYS_INLINE UCharDirection LegacyInlineIterator::direction() const
+{
+ if (UNLIKELY(!m_renderer))
+ return U_OTHER_NEUTRAL;
+
+ if (LIKELY(is<RenderText>(*m_renderer))) {
+ UChar codeUnit = downcast<RenderText>(*m_renderer).characterAt(m_pos);
+ if (LIKELY(U16_IS_SINGLE(codeUnit)))
+ return u_charDirection(codeUnit);
+ return surrogateTextDirection(codeUnit);
+ }
+
+ if (m_renderer->isListMarker())
+ return m_renderer->style().isLeftToRightDirection() ? U_LEFT_TO_RIGHT : U_RIGHT_TO_LEFT;
+
+ return U_OTHER_NEUTRAL;
+}
+
+template<>
+inline void InlineBidiResolver::incrementInternal()
+{
+ m_current.increment(this);
+}
+
+static inline bool isIsolatedInline(RenderObject& object)
+{
+ return object.isRenderInline() && isIsolated(object.style().unicodeBidi());
+}
+
+static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject& initialObject, RenderObject* root)
+{
+ RenderObject* containingIsolateObject = nullptr;
+ for (RenderObject* object = &initialObject; object && object != root; object = object->parent()) {
+ if (isIsolatedInline(*object))
+ containingIsolateObject = object;
+ }
+ return containingIsolateObject;
+}
+
+static inline unsigned numberOfIsolateAncestors(const LegacyInlineIterator& iter)
+{
+ unsigned count = 0;
+ typedef RenderObject* RenderObjectPtr;
+ for (RenderObjectPtr object = iter.renderer(), root = iter.root(); object && object != root; object = object->parent()) {
+ if (isIsolatedInline(*object))
+ count++;
+ }
+ return count;
+}
+
+// FIXME: This belongs on InlineBidiResolver, except it's a template specialization
+// of BidiResolver which knows nothing about RenderObjects.
+static inline void addPlaceholderRunForIsolatedInline(InlineBidiResolver& resolver, RenderObject& obj, unsigned pos, RenderElement& root)
+{
+ std::unique_ptr<BidiRun> isolatedRun = makeUnique<BidiRun>(pos, pos, obj, resolver.context(), resolver.dir());
+ // FIXME: isolatedRuns() could be a hash of object->run and then we could cheaply
+ // ASSERT here that we didn't create multiple objects for the same inline.
+ resolver.setWhitespaceCollapsingTransitionForIsolatedRun(*isolatedRun, resolver.whitespaceCollapsingState().currentTransition());
+ resolver.isolatedRuns().append(BidiIsolatedRun(obj, pos, root, *isolatedRun));
+ resolver.runs().appendRun(WTFMove(isolatedRun));
+}
+
+class IsolateTracker {
+public:
+ explicit IsolateTracker(unsigned nestedIsolateCount)
+ : m_nestedIsolateCount(nestedIsolateCount)
+ , m_haveAddedFakeRunForRootIsolate(false)
+ {
+ }
+
+ void enterIsolate() { m_nestedIsolateCount++; }
+ void exitIsolate()
+ {
+ ASSERT(m_nestedIsolateCount >= 1);
+ m_nestedIsolateCount--;
+ if (!inIsolate())
+ m_haveAddedFakeRunForRootIsolate = false;
+ }
+ bool inIsolate() const { return m_nestedIsolateCount; }
+
+ // We don't care if we encounter bidi directional overrides.
+ void embed(UCharDirection, BidiEmbeddingSource) { }
+ void commitExplicitEmbedding() { }
+
+ void addFakeRunIfNecessary(RenderObject& obj, unsigned pos, unsigned end, RenderElement& root, InlineBidiResolver& resolver)
+ {
+ // We only need to add a fake run for a given isolated span once during each call to createBidiRunsForLine.
+ // We'll be called for every span inside the isolated span so we just ignore subsequent calls.
+ // We also avoid creating a fake run until we hit a child that warrants one, e.g. we skip floats.
+ if (RenderBlock::shouldSkipCreatingRunsForObject(obj))
+ return;
+ if (!m_haveAddedFakeRunForRootIsolate) {
+ // obj and pos together denote a single position in the inline, from which the parsing of the isolate will start.
+ // We don't need to mark the end of the run because this is implicit: it is either endOfLine or the end of the
+ // isolate, when we call createBidiRunsForLine it will stop at whichever comes first.
+ addPlaceholderRunForIsolatedInline(resolver, obj, pos, root);
+ }
+ m_haveAddedFakeRunForRootIsolate = true;
+ LegacyLineLayout::appendRunsForObject(nullptr, pos, end, obj, resolver);
+ }
+
+private:
+ unsigned m_nestedIsolateCount;
+ bool m_haveAddedFakeRunForRootIsolate;
+};
+
+template<>
+inline void InlineBidiResolver::appendRunInternal()
+{
+ if (!m_emptyRun && !m_eor.atEnd() && !m_reachedEndOfLine) {
+ // Keep track of when we enter/leave "unicode-bidi: isolate" inlines.
+ // Initialize our state depending on if we're starting in the middle of such an inline.
+ // FIXME: Could this initialize from this->inIsolate() instead of walking up the render tree?
+ IsolateTracker isolateTracker(numberOfIsolateAncestors(m_sor));
+ int start = m_sor.offset();
+ RenderObject* obj = m_sor.renderer();
+ while (obj && obj != m_eor.renderer() && obj != endOfLine.renderer()) {
+ if (isolateTracker.inIsolate())
+ isolateTracker.addFakeRunIfNecessary(*obj, start, obj->length(), *m_sor.root(), *this);
+ else
+ LegacyLineLayout::appendRunsForObject(&m_runs, start, obj->length(), *obj, *this);
+ // FIXME: start/obj should be an LegacyInlineIterator instead of two separate variables.
+ start = 0;
+ obj = nextInlineRendererSkippingEmpty(*m_sor.root(), obj, &isolateTracker);
+ }
+ if (obj) {
+ unsigned pos = obj == m_eor.renderer() ? m_eor.offset() : UINT_MAX;
+ if (obj == endOfLine.renderer() && endOfLine.offset() <= pos) {
+ m_reachedEndOfLine = true;
+ pos = endOfLine.offset();
+ }
+ // It's OK to add runs for zero-length RenderObjects, just don't make the run larger than it should be
+ int end = obj->length() ? pos + 1 : 0;
+ if (isolateTracker.inIsolate())
+ isolateTracker.addFakeRunIfNecessary(*obj, start, obj->length(), *m_sor.root(), *this);
+ else
+ LegacyLineLayout::appendRunsForObject(&m_runs, start, end, *obj, *this);
+ }
+
+ m_eor.increment();
+ m_sor = m_eor;
+ }
+
+ m_direction = U_OTHER_NEUTRAL;
+ m_status.eor = U_OTHER_NEUTRAL;
+}
+
+template<>
+inline bool InlineBidiResolver::needsContinuePastEndInternal() const
+{
+ // We don't collect runs beyond the endOfLine renderer. Stop traversing when the iterator moves to the next renderer to prevent O(n^2).
+ return m_current.renderer() == endOfLine.renderer();
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/LegacyLineLayout.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/LegacyLineLayout.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/LegacyLineLayout.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -30,11 +30,11 @@
#include "BreakingContext.h"
#include "FloatingObjects.h"
#include "HTMLParserIdioms.h"
-#include "InlineIterator.h"
#include "InlineTextBoxStyle.h"
#include "InlineWalker.h"
#include "LayoutIntegrationRunIterator.h"
#include "LegacyInlineElementBox.h"
+#include "LegacyInlineIterator.h"
#include "LegacyInlineTextBox.h"
#include "LineLayoutState.h"
#include "Logging.h"
@@ -67,7 +67,7 @@
lineBoxes().deleteLineBoxTree();
};
-static void determineDirectionality(TextDirection& dir, InlineIterator iter)
+static void determineDirectionality(TextDirection& dir, LegacyInlineIterator iter)
{
while (!iter.atEnd()) {
if (iter.atParagraphSeparator())
@@ -99,7 +99,7 @@
LineWhitespaceCollapsingState& lineWhitespaceCollapsingState = resolver.whitespaceCollapsingState();
bool haveNextTransition = (lineWhitespaceCollapsingState.currentTransition() < lineWhitespaceCollapsingState.numTransitions());
- InlineIterator nextTransition;
+ LegacyInlineIterator nextTransition;
if (haveNextTransition)
nextTransition = lineWhitespaceCollapsingState.transitions()[lineWhitespaceCollapsingState.currentTransition()];
if (lineWhitespaceCollapsingState.betweenTransitions()) {
@@ -1169,7 +1169,7 @@
}
// FIXME: BidiResolver should have this logic.
-static inline void constructBidiRunsForSegment(InlineBidiResolver& topResolver, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& endOfRuns, VisualDirectionOverride override, bool previousLineBrokeCleanly)
+static inline void constructBidiRunsForSegment(InlineBidiResolver& topResolver, BidiRunList<BidiRun>& bidiRuns, const LegacyInlineIterator& endOfRuns, VisualDirectionOverride override, bool previousLineBrokeCleanly)
{
// FIXME: We should pass a BidiRunList into createBidiRunsForLine instead
// of the resolver owning the runs.
@@ -1198,7 +1198,7 @@
EUnicodeBidi unicodeBidi = isolatedInline->style().unicodeBidi();
TextDirection direction;
if (unicodeBidi == Plaintext)
- determineDirectionality(direction, InlineIterator(isolatedInline, &isolatedRun.object, 0));
+ determineDirectionality(direction, LegacyInlineIterator(isolatedInline, &isolatedRun.object, 0));
else {
ASSERT(unicodeBidi == Isolate || unicodeBidi == IsolateOverride);
direction = isolatedInline->style().direction();
@@ -1210,7 +1210,7 @@
// The starting position is the beginning of the first run within the isolate that was identified
// during the earlier call to createBidiRunsForLine. This can be but is not necessarily the
// first run within the isolate.
- InlineIterator iter = InlineIterator(isolatedInline, &startObject, isolatedRun.position);
+ LegacyInlineIterator iter = LegacyInlineIterator(isolatedInline, &startObject, isolatedRun.position);
isolatedResolver.setPositionIgnoringNestedIsolates(iter);
// We stop at the next end of line; we may re-enter this isolate in the next call to constructBidiRuns().
@@ -1236,7 +1236,7 @@
}
// This function constructs line boxes for all of the text runs in the resolver and computes their position.
-LegacyRootInlineBox* LegacyLineLayout::createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeasurements& wordMeasurements)
+LegacyRootInlineBox* LegacyLineLayout::createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const LegacyInlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeasurements& wordMeasurements)
{
if (!bidiRuns.runCount())
return nullptr;
@@ -1336,7 +1336,7 @@
// We also find the first clean line and extract these lines. We will add them back
// if we determine that we're able to synchronize after handling all our dirty lines.
- InlineIterator cleanLineStart;
+ LegacyInlineIterator cleanLineStart;
BidiStatus cleanLineBidiStatus;
if (!layoutState.isFullLayout() && startLine)
determineEndPosition(layoutState, startLine, cleanLineStart, cleanLineBidiStatus);
@@ -1369,7 +1369,7 @@
}
// Before restarting the layout loop with a new logicalHeight, remove all floats that were added and reset the resolver.
-inline const InlineIterator& LegacyLineLayout::restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver& resolver, const InlineIterator& oldEnd)
+inline const LegacyInlineIterator& LegacyLineLayout::restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver& resolver, const LegacyInlineIterator& oldEnd)
{
m_flow.removeFloatingObjectsBelow(lastFloatFromPreviousLine, oldLogicalHeight);
m_flow.setLogicalHeight(newLogicalHeight);
@@ -1377,12 +1377,12 @@
return oldEnd;
}
-void LegacyLineLayout::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines)
+void LegacyLineLayout::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, InlineBidiResolver& resolver, const LegacyInlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines)
{
const RenderStyle& styleToUse = style();
bool paginated = layoutContext().layoutState() && layoutContext().layoutState()->isPaginated();
LineWhitespaceCollapsingState& lineWhitespaceCollapsingState = resolver.whitespaceCollapsingState();
- InlineIterator end = resolver.position();
+ LegacyInlineIterator end = resolver.position();
bool checkForEndLineMatch = layoutState.endLine();
RenderTextInfo renderTextInfo;
VerticalPositionCache verticalPositionCache;
@@ -1394,7 +1394,7 @@
if (checkForEndLineMatch) {
layoutState.setEndLineMatched(matchedEndLine(layoutState, resolver, cleanLineStart, cleanLineBidiStatus));
if (layoutState.endLineMatched()) {
- resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0), 0);
+ resolver.setPosition(LegacyInlineIterator(resolver.position().root(), 0, 0), 0);
layoutState.marginInfo().clearMargin();
break;
}
@@ -1405,7 +1405,7 @@
layoutState.lineInfo().setEmpty(true);
layoutState.lineInfo().resetRunsFromLeadingWhitespace();
- const InlineIterator oldEnd = end;
+ const LegacyInlineIterator oldEnd = end;
bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly();
FloatingObject* lastFloatFromPreviousLine = (m_flow.containsFloats()) ? m_flow.floatingObjects()->set().last().get() : nullptr;
@@ -1419,7 +1419,7 @@
resolver.runs().clear();
resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced by an ASSERT (or just removed).
layoutState.setCheckForFloatsFromLastLine(true);
- resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0), 0);
+ resolver.setPosition(LegacyInlineIterator(resolver.position().root(), 0, 0), 0);
break;
}
@@ -1958,21 +1958,21 @@
if (lastLine) {
m_flow.setLogicalHeight(lastLine->lineBoxBottom());
- InlineIterator iter = InlineIterator(&m_flow, lastLine->lineBreakObj(), lastLine->lineBreakPos());
+ LegacyInlineIterator iter = LegacyInlineIterator(&m_flow, lastLine->lineBreakObj(), lastLine->lineBreakPos());
resolver.setPosition(iter, numberOfIsolateAncestors(iter));
resolver.setStatus(lastLine->lineBreakBidiStatus());
} else {
TextDirection direction = style().direction();
if (style().unicodeBidi() == Plaintext)
- determineDirectionality(direction, InlineIterator(&m_flow, bidiFirstSkippingEmptyInlines(m_flow), 0));
+ determineDirectionality(direction, LegacyInlineIterator(&m_flow, firstInlineRendererSkippingEmpty(m_flow), 0));
resolver.setStatus(BidiStatus(direction, isOverride(style().unicodeBidi())));
- InlineIterator iter = InlineIterator(&m_flow, bidiFirstSkippingEmptyInlines(m_flow, &resolver), 0);
+ LegacyInlineIterator iter = LegacyInlineIterator(&m_flow, firstInlineRendererSkippingEmpty(m_flow, &resolver), 0);
resolver.setPosition(iter, numberOfIsolateAncestors(iter));
}
return currentLine;
}
-void LegacyLineLayout::determineEndPosition(LineLayoutState& layoutState, LegacyRootInlineBox* startLine, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus)
+void LegacyLineLayout::determineEndPosition(LineLayoutState& layoutState, LegacyRootInlineBox* startLine, LegacyInlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus)
{
auto iteratorForFirstDirtyFloat = [](LineLayoutState::FloatList& floats) {
auto lastCleanFloat = floats.lastCleanFloat();
@@ -2015,7 +2015,7 @@
// At this point, |last| is the first line in a run of clean lines that ends with the last line
// in the block.
LegacyRootInlineBox* previousLine = lastLine->prevRootBox();
- cleanLineStart = InlineIterator(&m_flow, previousLine->lineBreakObj(), previousLine->lineBreakPos());
+ cleanLineStart = LegacyInlineIterator(&m_flow, previousLine->lineBreakObj(), previousLine->lineBreakPos());
cleanLineBidiStatus = previousLine->lineBreakBidiStatus();
layoutState.setEndLineLogicalTop(previousLine->lineBoxBottom());
@@ -2084,7 +2084,7 @@
return rootBox->paginatedLineWidth() != m_flow.availableLogicalWidthForContent(currentFragment);
}
-bool LegacyLineLayout::matchedEndLine(LineLayoutState& layoutState, const InlineBidiResolver& resolver, const InlineIterator& endLineStart, const BidiStatus& endLineStatus)
+bool LegacyLineLayout::matchedEndLine(LineLayoutState& layoutState, const InlineBidiResolver& resolver, const LegacyInlineIterator& endLineStart, const BidiStatus& endLineStatus)
{
if (resolver.position() == endLineStart) {
if (resolver.status() != endLineStatus)
Modified: trunk/Source/WebCore/rendering/LegacyLineLayout.h (283366 => 283367)
--- trunk/Source/WebCore/rendering/LegacyLineLayout.h 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/LegacyLineLayout.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -38,7 +38,7 @@
class FloatWithRect;
class FrameViewLayoutContext;
class LegacyInlineBox;
-class InlineIterator;
+class LegacyInlineIterator;
class LineInfo;
class LineLayoutState;
class RenderBlockFlow;
@@ -91,18 +91,18 @@
void computeBlockDirectionPositionsForLine(LegacyRootInlineBox*, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache&);
inline BidiRun* handleTrailingSpaces(BidiRunList<BidiRun>& bidiRuns, BidiContext* currentContext);
void appendFloatingObjectToLastLine(FloatingObject&);
- LegacyRootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);
+ LegacyRootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const LegacyInlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);
void layoutRunsAndFloats(LineLayoutState&, bool hasInlineChild);
- inline const InlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver&, const InlineIterator& oldEnd);
- void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines);
+ inline const LegacyInlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver&, const LegacyInlineIterator& oldEnd);
+ void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, const LegacyInlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines);
void reattachCleanLineFloats(LegacyRootInlineBox& cleanLine, LayoutUnit delta, bool isFirstCleanLine);
void linkToEndLineIfNeeded(LineLayoutState&);
void checkFloatInCleanLine(LegacyRootInlineBox& cleanLine, RenderBox& floatBoxOnCleanLine, FloatWithRect& matchingFloatWithRect, bool& encounteredNewFloat, bool& dirtiedByFloat);
LegacyRootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&);
- void determineEndPosition(LineLayoutState&, LegacyRootInlineBox* startLine, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus);
+ void determineEndPosition(LineLayoutState&, LegacyRootInlineBox* startLine, LegacyInlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus);
bool checkPaginationAndFloatsAtEndLine(LineLayoutState&);
bool lineWidthForPaginatedLineChanged(LegacyRootInlineBox* rootBox, LayoutUnit lineDelta, RenderFragmentedFlow*) const;
- bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const InlineIterator& endLineStart, const BidiStatus& endLineStatus);
+ bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const LegacyInlineIterator& endLineStart, const BidiStatus& endLineStatus);
void deleteEllipsisLineBoxes();
void checkLinesForTextOverflow();
void updateFragmentForLine(LegacyRootInlineBox*) const;
Modified: trunk/Source/WebCore/rendering/LegacyRootInlineBox.h (283366 => 283367)
--- trunk/Source/WebCore/rendering/LegacyRootInlineBox.h 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/LegacyRootInlineBox.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -200,7 +200,7 @@
LayoutUnit beforeAnnotationsAdjustment() const;
// Where this line ended. The exact object and the position within that object are stored so that
- // we can create an InlineIterator beginning just after the end of this line.
+ // we can create an LegacyInlineIterator beginning just after the end of this line.
WeakPtr<RenderObject> m_lineBreakObj;
RefPtr<BidiContext> m_lineBreakContext;
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -39,7 +39,6 @@
#include "HitTestLocation.h"
#include "HitTestResult.h"
#include "ImageBuffer.h"
-#include "InlineIterator.h"
#include "InlineWalker.h"
#include "LayoutRepainter.h"
#include "LegacyInlineElementBox.h"
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -33,7 +33,6 @@
#include "HTMLParserIdioms.h"
#include "HTMLTextAreaElement.h"
#include "HitTestLocation.h"
-#include "InlineIterator.h"
#include "LayoutIntegrationLineIterator.h"
#include "LayoutIntegrationLineLayout.h"
#include "LayoutIntegrationRunIterator.h"
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -1118,4 +1118,20 @@
}
}
+bool isEmptyInline(const RenderInline& renderer)
+{
+ for (auto& current : childrenOfType<RenderObject>(renderer)) {
+ if (current.isFloatingOrOutOfFlowPositioned())
+ continue;
+ if (is<RenderText>(current)) {
+ if (!downcast<RenderText>(current).isAllCollapsibleWhitespace())
+ return false;
+ continue;
+ }
+ if (!is<RenderInline>(current) || !isEmptyInline(downcast<RenderInline>(current)))
+ return false;
+ }
+ return true;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderInline.h (283366 => 283367)
--- trunk/Source/WebCore/rendering/RenderInline.h 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -148,6 +148,8 @@
RenderLineBoxList m_lineBoxes; // All of the line boxes created for this inline flow. For example, <i>Hello<br>world.</i> will have two <i> line boxes.
};
+bool isEmptyInline(const RenderInline&);
+
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderInline, isRenderInline())
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -35,7 +35,6 @@
#include "HTMLElement.h"
#include "HTMLNames.h"
#include "HTMLSpanElement.h"
-#include "InlineIterator.h"
#include "LayoutIntegrationRunIterator.h"
#include "LegacyInlineTextBox.h"
#include "Logging.h"
Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (283366 => 283367)
--- trunk/Source/WebCore/rendering/line/BreakingContext.h 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -129,7 +129,7 @@
}
RenderObject* currentObject() { return m_current.renderer(); }
- InlineIterator lineBreak() { return m_lineBreak; }
+ LegacyInlineIterator lineBreak() { return m_lineBreak; }
LineWidth& lineWidth() { return m_width; }
bool atEnd() { return m_atEnd; }
@@ -145,10 +145,10 @@
void handleEmptyInline();
void handleReplaced();
bool handleText(WordMeasurements&, bool& hyphenated, unsigned& consecutiveHyphenatedLines);
- void trailingSpacesHang(InlineIterator&, RenderObject&, bool canBreakMidWord, bool previousCharacterIsSpace);
+ void trailingSpacesHang(LegacyInlineIterator&, RenderObject&, bool canBreakMidWord, bool previousCharacterIsSpace);
bool canBreakAtThisPosition();
void commitAndUpdateLineBreakIfNeeded();
- InlineIterator handleEndOfLine();
+ LegacyInlineIterator handleEndOfLine();
float computeAdditionalBetweenWordsWidth(RenderText&, TextLayout*, UChar, WordTrailingSpace&, HashSet<const Font*>& fallbackFonts, WordMeasurements&, const FontCascade&, bool isFixedPitch, unsigned lastSpace, float lastSpaceWordSpacing, float wordSpacingForWordMeasurement, unsigned offset);
@@ -177,9 +177,9 @@
LineBreaker& m_lineBreaker;
InlineBidiResolver& m_resolver;
- InlineIterator m_current;
- InlineIterator m_lineBreak;
- InlineIterator m_startOfIgnoredSpaces;
+ LegacyInlineIterator m_current;
+ LegacyInlineIterator m_lineBreak;
+ LegacyInlineIterator m_startOfIgnoredSpaces;
RenderBlockFlow& m_block;
RenderObject* m_lastObject;
@@ -237,7 +237,7 @@
m_hadUncommittedWidthBeforeCurrent = !!m_width.uncommittedWidth();
auto& renderer = *m_current.renderer();
- m_nextObject = bidiNextSkippingEmptyInlines(m_block, &renderer);
+ m_nextObject = nextInlineRendererSkippingEmpty(m_block, &renderer);
if (m_nextObject && m_nextObject->parent() && !m_nextObject->parent()->isDescendantOf(renderer.parent()))
m_includeEndWidth = true;
@@ -292,7 +292,7 @@
// collapsed away so that it doesn't push the text out from the container's right-hand edge.
// FIXME: Do this regardless of the container's alignment - will require rebaselining a lot of test results.
else if (m_ignoringSpaces && (m_blockStyle.textAlign() == TextAlignMode::Right || m_blockStyle.textAlign() == TextAlignMode::WebKitRight))
- m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset()));
+ m_lineWhitespaceCollapsingState.stopIgnoringSpaces(LegacyInlineIterator(0, m_current.renderer(), m_current.offset()));
if (!m_lineInfo.isEmpty())
usedClear = RenderStyle::usedClear(br);
@@ -403,15 +403,15 @@
// have an effect on whitespace at the start of the line.
inline bool shouldSkipWhitespaceAfterStartObject(RenderBlockFlow& block, RenderObject* o, LineWhitespaceCollapsingState& lineWhitespaceCollapsingState)
{
- RenderObject* next = bidiNextSkippingEmptyInlines(block, o);
+ RenderObject* next = nextInlineRendererSkippingEmpty(block, o);
while (next && next->isFloatingOrOutOfFlowPositioned())
- next = bidiNextSkippingEmptyInlines(block, next);
+ next = nextInlineRendererSkippingEmpty(block, next);
if (is<RenderText>(next) && downcast<RenderText>(*next).text().length() > 0) {
RenderText& nextText = downcast<RenderText>(*next);
UChar nextChar = nextText.characterAt(0);
if (nextText.style().isCollapsibleWhiteSpace(nextChar)) {
- lineWhitespaceCollapsingState.startIgnoringSpaces(InlineIterator(nullptr, o, 0));
+ lineWhitespaceCollapsingState.startIgnoringSpaces(LegacyInlineIterator(nullptr, o, 0));
return true;
}
}
@@ -474,7 +474,7 @@
m_hangsAtEnd = false;
if (m_ignoringSpaces)
- m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, &replacedBox, 0));
+ m_lineWhitespaceCollapsingState.stopIgnoringSpaces(LegacyInlineIterator(0, &replacedBox, 0));
m_lineInfo.setEmpty(false, &m_block, &m_width);
m_ignoringSpaces = false;
@@ -515,7 +515,7 @@
return 0;
}
-inline bool iteratorIsBeyondEndOfRenderCombineText(const InlineIterator& iter, RenderCombineText& renderer)
+inline bool iteratorIsBeyondEndOfRenderCombineText(const LegacyInlineIterator& iter, RenderCombineText& renderer)
{
return iter.renderer() == &renderer && iter.offset() >= renderer.text().length();
}
@@ -561,14 +561,14 @@
}
// Adding a pair of whitespace collapsing transitions before a character will split it out into a new line box.
-inline void ensureCharacterGetsLineBox(LineWhitespaceCollapsingState& lineWhitespaceCollapsingState, InlineIterator& textParagraphSeparator)
+inline void ensureCharacterGetsLineBox(LineWhitespaceCollapsingState& lineWhitespaceCollapsingState, LegacyInlineIterator& textParagraphSeparator)
{
- InlineIterator transition(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset());
- lineWhitespaceCollapsingState.startIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset() - 1));
- lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()));
+ LegacyInlineIterator transition(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset());
+ lineWhitespaceCollapsingState.startIgnoringSpaces(LegacyInlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset() - 1));
+ lineWhitespaceCollapsingState.stopIgnoringSpaces(LegacyInlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()));
}
-inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, float availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, std::optional<unsigned> nextBreakable, bool& hyphenated)
+inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, float availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, LegacyInlineIterator& lineBreak, std::optional<unsigned> nextBreakable, bool& hyphenated)
{
// Map 'hyphenate-limit-{before,after}: auto;' to 2.
unsigned minimumPrefixLength;
@@ -816,7 +816,7 @@
m_ignoringSpaces = false;
wordSpacingForWordMeasurement = 0;
lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in any of the ignored spaces.
- m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, &renderer, m_current.offset()));
+ m_lineWhitespaceCollapsingState.stopIgnoringSpaces(LegacyInlineIterator(0, &renderer, m_current.offset()));
stoppedIgnoringSpaces = true;
} else {
// Just keep ignoring these spaces.
@@ -977,7 +977,7 @@
// spaces. Create a transition to terminate the run
// before the second space.
m_lineWhitespaceCollapsingState.startIgnoringSpaces(m_startOfIgnoredSpaces);
- m_trailingObjects.updateWhitespaceCollapsingTransitionsForTrailingBoxes(m_lineWhitespaceCollapsingState, InlineIterator(), TrailingObjects::CollapseFirstSpace::No);
+ m_trailingObjects.updateWhitespaceCollapsingTransitionsForTrailingBoxes(m_lineWhitespaceCollapsingState, LegacyInlineIterator(), TrailingObjects::CollapseFirstSpace::No);
}
}
// Measuring the width of complex text character-by-character, rather than measuring it all together,
@@ -994,7 +994,7 @@
lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0;
wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurements.last().width) ? wordSpacing : 0;
lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in any of the ignored spaces.
- m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(nullptr, &renderer, m_current.offset()));
+ m_lineWhitespaceCollapsingState.stopIgnoringSpaces(LegacyInlineIterator(nullptr, &renderer, m_current.offset()));
}
if (m_hangsAtEnd && !renderer.isHangableStopOrComma(c))
m_hangsAtEnd = false;
@@ -1082,7 +1082,7 @@
return c == ' ' || c == '\t' || (c == '\n' && !nextText.preservesNewline());
}
-inline void BreakingContext::trailingSpacesHang(InlineIterator& lineBreak, RenderObject& renderObject, bool canBreakMidWord, bool previousCharacterIsSpace)
+inline void BreakingContext::trailingSpacesHang(LegacyInlineIterator& lineBreak, RenderObject& renderObject, bool canBreakMidWord, bool previousCharacterIsSpace)
{
ASSERT(m_currWS == WhiteSpace::BreakSpaces);
// Avoid breaking before the first white-space after a word if there is a
@@ -1182,16 +1182,16 @@
}
}
-inline TrailingObjects::CollapseFirstSpace checkWhitespaceCollapsingTransitions(LineWhitespaceCollapsingState& lineWhitespaceCollapsingState, const InlineIterator& lBreak)
+inline TrailingObjects::CollapseFirstSpace checkWhitespaceCollapsingTransitions(LineWhitespaceCollapsingState& lineWhitespaceCollapsingState, const LegacyInlineIterator& lBreak)
{
// Check to see if our last transition is a start point beyond the line break. If so,
// shave it off the list, and shave off a trailing space if the previous end point doesn't
// preserve whitespace.
if (lBreak.renderer() && lineWhitespaceCollapsingState.numTransitions() && !(lineWhitespaceCollapsingState.numTransitions() % 2)) {
- const InlineIterator* transitions = lineWhitespaceCollapsingState.transitions().data();
- const InlineIterator& endpoint = transitions[lineWhitespaceCollapsingState.numTransitions() - 2];
- const InlineIterator& startpoint = transitions[lineWhitespaceCollapsingState.numTransitions() - 1];
- InlineIterator currpoint = endpoint;
+ const LegacyInlineIterator* transitions = lineWhitespaceCollapsingState.transitions().data();
+ const LegacyInlineIterator& endpoint = transitions[lineWhitespaceCollapsingState.numTransitions() - 2];
+ const LegacyInlineIterator& startpoint = transitions[lineWhitespaceCollapsingState.numTransitions() - 1];
+ LegacyInlineIterator currpoint = endpoint;
while (!currpoint.atEnd() && currpoint != startpoint && currpoint != lBreak)
currpoint.increment();
if (currpoint == lBreak) {
@@ -1206,7 +1206,7 @@
return TrailingObjects::CollapseFirstSpace::Yes;
}
-inline InlineIterator BreakingContext::handleEndOfLine()
+inline LegacyInlineIterator BreakingContext::handleEndOfLine()
{
if (m_lineBreak == m_resolver.position()) {
if (!m_lineBreak.renderer() || !m_lineBreak.renderer()->isBR()) {
Modified: trunk/Source/WebCore/rendering/line/LineBreaker.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/line/LineBreaker.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/line/LineBreaker.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -43,7 +43,7 @@
// object iteration process.
// NB. this function will insert any floating elements that would otherwise
// be skipped but it will not position them.
-void LineBreaker::skipTrailingWhitespace(InlineIterator& iterator, const LineInfo& lineInfo)
+void LineBreaker::skipTrailingWhitespace(LegacyInlineIterator& iterator, const LineInfo& lineInfo)
{
while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhitespace)) {
RenderObject& object = *iterator.renderer();
@@ -77,7 +77,7 @@
resolver.commitExplicitEmbedding();
}
-InlineIterator LineBreaker::nextLineBreak(InlineBidiResolver& resolver, LineInfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements)
+LegacyInlineIterator LineBreaker::nextLineBreak(InlineBidiResolver& resolver, LineInfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements)
{
reset();
Modified: trunk/Source/WebCore/rendering/line/LineBreaker.h (283366 => 283367)
--- trunk/Source/WebCore/rendering/line/LineBreaker.h 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/line/LineBreaker.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -24,7 +24,7 @@
#pragma once
-#include "InlineIterator.h"
+#include "LegacyInlineIterator.h"
#include "LineInfo.h"
#include "LineInlineHeaders.h"
#include <wtf/Vector.h>
@@ -51,7 +51,7 @@
reset();
}
- InlineIterator nextLineBreak(InlineBidiResolver&, LineInfo&, RenderTextInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements&);
+ LegacyInlineIterator nextLineBreak(InlineBidiResolver&, LineInfo&, RenderTextInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements&);
bool lineWasHyphenated() { return m_hyphenated; }
const Vector<RenderBox*>& positionedObjects() { return m_positionedObjects; }
@@ -60,7 +60,7 @@
private:
void reset();
- void skipTrailingWhitespace(InlineIterator&, const LineInfo&);
+ void skipTrailingWhitespace(LegacyInlineIterator&, const LineInfo&);
void skipLeadingWhitespace(InlineBidiResolver&, LineInfo&, FloatingObject* lastFloatFromPreviousLine, LineWidth&);
FloatingObject* insertFloatingObject(RenderBox& floatBox) { return m_block.insertFloatingObject(floatBox); }
Modified: trunk/Source/WebCore/rendering/line/LineInlineHeaders.h (283366 => 283367)
--- trunk/Source/WebCore/rendering/line/LineInlineHeaders.h 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/line/LineInlineHeaders.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -72,7 +72,7 @@
|| (whitespacePosition == TrailingWhitespace && style->whiteSpace() == WhiteSpace::PreWrap && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly()));
}
-inline bool skipNonBreakingSpace(const InlineIterator& it, const LineInfo& lineInfo)
+inline bool skipNonBreakingSpace(const LegacyInlineIterator& it, const LineInfo& lineInfo)
{
if (it.renderer()->style().nbspMode() != NBSPMode::Space || it.current() != noBreakSpace)
return false;
@@ -96,7 +96,7 @@
return isEmptyInline(flow) && hasInlineDirectionBordersPaddingOrMargin(flow);
}
-inline bool requiresLineBox(const InlineIterator& it, const LineInfo& lineInfo = LineInfo(), WhitespacePosition whitespacePosition = LeadingWhitespace)
+inline bool requiresLineBox(const LegacyInlineIterator& it, const LineInfo& lineInfo = LineInfo(), WhitespacePosition whitespacePosition = LeadingWhitespace)
{
if (it.renderer()->isFloatingOrOutOfFlowPositioned())
return false;
Modified: trunk/Source/WebCore/rendering/line/TrailingObjects.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/line/TrailingObjects.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/line/TrailingObjects.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -25,11 +25,11 @@
#include "config.h"
#include "TrailingObjects.h"
-#include "InlineIterator.h"
+#include "LegacyInlineIterator.h"
namespace WebCore {
-void TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes(LineWhitespaceCollapsingState& lineWhitespaceCollapsingState, const InlineIterator& lBreak, CollapseFirstSpace collapseFirstSpace)
+void TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes(LineWhitespaceCollapsingState& lineWhitespaceCollapsingState, const LegacyInlineIterator& lBreak, CollapseFirstSpace collapseFirstSpace)
{
if (!m_whitespace)
return;
@@ -63,7 +63,7 @@
// Add a new end transition that stops right at the very end.
unsigned length = m_whitespace->text().length();
unsigned pos = length >= 2 ? length - 2 : UINT_MAX;
- InlineIterator endMid(0, m_whitespace, pos);
+ LegacyInlineIterator endMid(0, m_whitespace, pos);
lineWhitespaceCollapsingState.startIgnoringSpaces(endMid);
for (size_t i = 0; i < m_boxes.size(); ++i)
lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(m_boxes[i]);
Modified: trunk/Source/WebCore/rendering/line/TrailingObjects.h (283366 => 283367)
--- trunk/Source/WebCore/rendering/line/TrailingObjects.h 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/line/TrailingObjects.h 2021-10-01 15:12:38 UTC (rev 283367)
@@ -28,7 +28,7 @@
namespace WebCore {
-class InlineIterator;
+class LegacyInlineIterator;
class RenderBoxModelObject;
class RenderText;
@@ -38,8 +38,8 @@
template <class Iterator, class Run> class BidiResolver;
template <class Iterator, class Run, class IsolateRun> class BidiResolverWithIsolate;
template <class Iterator> class WhitespaceCollapsingState;
-typedef BidiResolverWithIsolate<InlineIterator, BidiRun, BidiIsolatedRun> InlineBidiResolver;
-typedef WhitespaceCollapsingState<InlineIterator> LineWhitespaceCollapsingState;
+typedef BidiResolverWithIsolate<LegacyInlineIterator, BidiRun, BidiIsolatedRun> InlineBidiResolver;
+typedef WhitespaceCollapsingState<LegacyInlineIterator> LineWhitespaceCollapsingState;
class TrailingObjects {
public:
@@ -57,7 +57,7 @@
}
enum class CollapseFirstSpace { No, Yes };
- void updateWhitespaceCollapsingTransitionsForTrailingBoxes(LineWhitespaceCollapsingState&, const InlineIterator& lBreak, CollapseFirstSpace);
+ void updateWhitespaceCollapsingTransitionsForTrailingBoxes(LineWhitespaceCollapsingState&, const LegacyInlineIterator& lBreak, CollapseFirstSpace);
private:
RenderText* m_whitespace { nullptr };
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp (283366 => 283367)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp 2021-10-01 14:23:58 UTC (rev 283366)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp 2021-10-01 15:12:38 UTC (rev 283367)
@@ -24,7 +24,7 @@
#include "config.h"
#include "RenderTreeBuilderList.h"
-#include "InlineIterator.h"
+#include "LegacyInlineIterator.h"
#include "LineInlineHeaders.h"
#include "RenderChildIterator.h"
#include "RenderListMarker.h"
@@ -34,10 +34,10 @@
namespace WebCore {
-// FIXME: This shouldn't need InlineIterator
+// FIXME: This shouldn't need LegacyInlineIterator
static bool generatesLineBoxesForInlineChild(RenderBlock& current, RenderObject* inlineObj)
{
- InlineIterator it(¤t, inlineObj, 0);
+ LegacyInlineIterator it(¤t, inlineObj, 0);
while (!it.atEnd() && !requiresLineBox(it))
it.increment();
return !it.atEnd();