Skip to content

Commit 796913a

Browse files
committed
[LFC][Integration] Rename LineIteratorLegacy::logicalLeft/right to contentLeft/right
https://bugs.webkit.org/show_bug.cgi?id=219215 Reviewed by Antti Koivisto. These functions are supposed to return the position where the content starts/ends inside the line box (see text-alignment as an example where the line's logical left edge is not where content starts). (WebCore::VisiblePosition::absoluteSelectionBoundsForLine const): * layout/integration/LayoutIntegrationLineIterator.h: (WebCore::LayoutIntegration::PathLine::selectionRect const): (WebCore::LayoutIntegration::PathLine::contentLogicalLeft const): (WebCore::LayoutIntegration::PathLine::contentLogicalRight const): (WebCore::LayoutIntegration::PathLine::logicalLeft const): Deleted. (WebCore::LayoutIntegration::PathLine::logicalRight const): Deleted. * layout/integration/LayoutIntegrationLineIteratorLegacyPath.h: (WebCore::LayoutIntegration::LineIteratorLegacyPath::contentLogicalLeft const): (WebCore::LayoutIntegration::LineIteratorLegacyPath::contentLogicalRight const): (WebCore::LayoutIntegration::LineIteratorLegacyPath::logicalLeft const): Deleted. (WebCore::LayoutIntegration::LineIteratorLegacyPath::logicalRight const): Deleted. * layout/integration/LayoutIntegrationLineIteratorModernPath.h: (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const): (WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalRight const): (WebCore::LayoutIntegration::LineIteratorModernPath::logicalLeft const): Deleted. (WebCore::LayoutIntegration::LineIteratorModernPath::logicalRight const): Deleted. * rendering/RenderLineBreak.cpp: (WebCore::RenderLineBreak::localCaretRect const): (WebCore::RenderLineBreak::collectSelectionRects): Canonical link: https://commits.webkit.org/231837@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3d951ff commit 796913a

6 files changed

Lines changed: 45 additions & 14 deletions

File tree

Source/WebCore/ChangeLog

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
2020-11-20 Zalan Bujtas <zalan@apple.com>
2+
3+
[LFC][Integration] Rename LineIteratorLegacy::logicalLeft/right to contentLeft/right
4+
https://bugs.webkit.org/show_bug.cgi?id=219215
5+
6+
Reviewed by Antti Koivisto.
7+
8+
These functions are supposed to return the position where the content starts/ends inside the line box (see text-alignment as an example
9+
where the line's logical left edge is not where content starts).
10+
11+
(WebCore::VisiblePosition::absoluteSelectionBoundsForLine const):
12+
* layout/integration/LayoutIntegrationLineIterator.h:
13+
(WebCore::LayoutIntegration::PathLine::selectionRect const):
14+
(WebCore::LayoutIntegration::PathLine::contentLogicalLeft const):
15+
(WebCore::LayoutIntegration::PathLine::contentLogicalRight const):
16+
(WebCore::LayoutIntegration::PathLine::logicalLeft const): Deleted.
17+
(WebCore::LayoutIntegration::PathLine::logicalRight const): Deleted.
18+
* layout/integration/LayoutIntegrationLineIteratorLegacyPath.h:
19+
(WebCore::LayoutIntegration::LineIteratorLegacyPath::contentLogicalLeft const):
20+
(WebCore::LayoutIntegration::LineIteratorLegacyPath::contentLogicalRight const):
21+
(WebCore::LayoutIntegration::LineIteratorLegacyPath::logicalLeft const): Deleted.
22+
(WebCore::LayoutIntegration::LineIteratorLegacyPath::logicalRight const): Deleted.
23+
* layout/integration/LayoutIntegrationLineIteratorModernPath.h:
24+
(WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalLeft const):
25+
(WebCore::LayoutIntegration::LineIteratorModernPath::contentLogicalRight const):
26+
(WebCore::LayoutIntegration::LineIteratorModernPath::logicalLeft const): Deleted.
27+
(WebCore::LayoutIntegration::LineIteratorModernPath::logicalRight const): Deleted.
28+
* rendering/RenderLineBreak.cpp:
29+
(WebCore::RenderLineBreak::localCaretRect const):
30+
(WebCore::RenderLineBreak::collectSelectionRects):
31+
132
2020-11-20 Chris Dumez <cdumez@apple.com>
233

334
AudioWorkletProcessor::process() may get called on non-audio worklet thread and crash

Source/WebCore/editing/VisiblePosition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ FloatRect VisiblePosition::absoluteSelectionBoundsForLine() const
660660
return { };
661661

662662
auto line = run.line();
663-
auto localRect = FloatRect { FloatPoint { line->logicalLeft(), line->selectionTop() }, FloatPoint { line->logicalRight(), line->selectionBottom() } };
663+
auto localRect = FloatRect { FloatPoint { line->contentLogicalLeft(), line->selectionTop() }, FloatPoint { line->contentLogicalRight(), line->selectionBottom() } };
664664
if (!line->isHorizontal())
665665
localRect = localRect.transposedRect();
666666

Source/WebCore/layout/integration/LayoutIntegrationLineIterator.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class PathLine {
6161
LayoutRect selectionRect() const;
6262

6363
float y() const;
64-
float logicalLeft() const;
65-
float logicalRight() const;
64+
float contentLogicalLeft() const;
65+
float contentLogicalRight() const;
6666
float logicalHeight() const;
6767

6868
int blockDirectionPointInLine() const;
@@ -180,7 +180,7 @@ inline LayoutUnit PathLine::lineBoxBottom() const
180180

181181
inline LayoutRect PathLine::selectionRect() const
182182
{
183-
return { LayoutPoint { logicalLeft(), selectionTop() }, LayoutPoint { logicalRight(), selectionBottom() } };
183+
return { LayoutPoint { contentLogicalLeft(), selectionTop() }, LayoutPoint { contentLogicalRight(), selectionBottom() } };
184184
}
185185

186186
inline float PathLine::y() const
@@ -190,17 +190,17 @@ inline float PathLine::y() const
190190
});
191191
}
192192

193-
inline float PathLine::logicalLeft() const
193+
inline float PathLine::contentLogicalLeft() const
194194
{
195195
return WTF::switchOn(m_pathVariant, [](const auto& path) {
196-
return path.logicalLeft();
196+
return path.contentLogicalLeft();
197197
});
198198
}
199199

200-
inline float PathLine::logicalRight() const
200+
inline float PathLine::contentLogicalRight() const
201201
{
202202
return WTF::switchOn(m_pathVariant, [](const auto& path) {
203-
return path.logicalRight();
203+
return path.contentLogicalRight();
204204
});
205205
}
206206

Source/WebCore/layout/integration/LayoutIntegrationLineIteratorLegacyPath.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class LineIteratorLegacyPath {
5353
LayoutUnit lineBoxBottom() const { return m_rootInlineBox->lineBoxBottom(); }
5454

5555
float y() const { return m_rootInlineBox->y(); }
56-
float logicalLeft() const { return m_rootInlineBox->logicalLeft(); }
57-
float logicalRight() const { return m_rootInlineBox->logicalRight(); }
56+
float contentLogicalLeft() const { return m_rootInlineBox->logicalLeft(); }
57+
float contentLogicalRight() const { return m_rootInlineBox->logicalRight(); }
5858
float logicalHeight() const { return m_rootInlineBox->logicalHeight(); }
5959
bool isHorizontal() const { return m_rootInlineBox->isHorizontal(); }
6060

Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class LineIteratorModernPath {
5959
LayoutUnit selectionTopForHitTesting() const { return top(); }
6060
LayoutUnit selectionBottom() const { return bottom(); }
6161

62-
float logicalLeft() const { return line().rect().x() + line().horizontalAlignmentOffset(); }
63-
float logicalRight() const { return logicalLeft() + line().lineBoxWidth(); }
62+
float contentLogicalLeft() const { return line().rect().x() + line().horizontalAlignmentOffset(); }
63+
float contentLogicalRight() const { return contentLogicalLeft() + line().rect().width(); }
6464
float y() const { return lineBoxTop(); }
6565
float logicalHeight() const { return line().rect().height(); }
6666
bool isHorizontal() const { return true; }

Source/WebCore/rendering/RenderLineBreak.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ LayoutRect RenderLineBreak::localCaretRect(const InlineRunAndOffset& runAndOffse
167167
return LayoutRect();
168168

169169
auto line = runAndOffset.run.line();
170-
return line->containingBlock().computeCaretRect(line->selectionRect(), line->logicalLeft(), caretWidth, caretRectMode);
170+
return line->containingBlock().computeCaretRect(line->selectionRect(), line->contentLogicalLeft(), caretWidth, caretRectMode);
171171
}
172172

173173
IntRect RenderLineBreak::linesBoundingBox() const
@@ -214,7 +214,7 @@ void RenderLineBreak::collectSelectionRects(Vector<SelectionRect>& rects, unsign
214214
const RootInlineBox& rootBox = box->root();
215215

216216
auto line = LayoutIntegration::LineIterator(&rootBox);
217-
LayoutRect rect = rootBox.blockFlow().computeCaretRect(line->selectionRect(), line->logicalLeft(), 0);
217+
LayoutRect rect = rootBox.blockFlow().computeCaretRect(line->selectionRect(), line->contentLogicalLeft(), 0);
218218

219219
if (rootBox.isFirstAfterPageBreak()) {
220220
if (box->isHorizontal())

0 commit comments

Comments
 (0)