Diff
Modified: trunk/Source/WebCore/ChangeLog (282338 => 282339)
--- trunk/Source/WebCore/ChangeLog 2021-09-13 17:57:14 UTC (rev 282338)
+++ trunk/Source/WebCore/ChangeLog 2021-09-13 18:06:30 UTC (rev 282339)
@@ -1,5 +1,32 @@
2021-09-13 Antti Koivisto <[email protected]>
+ Expose TextBoxSelectableRange in the iterator
+ https://bugs.webkit.org/show_bug.cgi?id=230213
+
+ Reviewed by Alan Bujtas.
+
+ Replace isSelectable with more generic TextBoxSelectableRange accessor.
+ This will be helpful in the future.
+
+ * layout/integration/LayoutIntegrationRunIterator.h:
+ (WebCore::LayoutIntegration::PathTextRun::selectableRange const):
+ (WebCore::LayoutIntegration::PathTextRun::isSelectable const): Deleted.
+ * layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
+ (WebCore::LayoutIntegration::RunIteratorLegacyPath::selectableRange const):
+ (WebCore::LayoutIntegration::RunIteratorLegacyPath::isSelectable const): Deleted.
+ * layout/integration/LayoutIntegrationRunIteratorModernPath.h:
+ (WebCore::LayoutIntegration::RunIteratorModernPath::selectableRange const):
+ (WebCore::LayoutIntegration::RunIteratorModernPath::isSelectable const): Deleted.
+ * rendering/LegacyInlineTextBox.cpp:
+ (WebCore::LegacyInlineTextBox::isSelectable const): Deleted.
+ * rendering/LegacyInlineTextBox.h:
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::inlineSelectionGaps):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::absoluteQuadsForRange const):
+
+2021-09-13 Antti Koivisto <[email protected]>
+
Remove redundant copy of visibleToHitTesting function
https://bugs.webkit.org/show_bug.cgi?id=230212
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h (282338 => 282339)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h 2021-09-13 17:57:14 UTC (rev 282338)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h 2021-09-13 18:06:30 UTC (rev 282339)
@@ -114,7 +114,7 @@
unsigned offsetForPosition(float x) const;
float positionForOffset(unsigned) const;
- bool isSelectable(unsigned start, unsigned end) const;
+ TextBoxSelectableRange selectableRange() const;
LayoutRect selectionRect(unsigned start, unsigned end) const;
const RenderText& renderer() const { return downcast<RenderText>(PathRun::renderer()); }
@@ -343,10 +343,10 @@
});
}
-inline bool PathTextRun::isSelectable(unsigned start, unsigned end) const
+inline TextBoxSelectableRange PathTextRun::selectableRange() const
{
return WTF::switchOn(m_pathVariant, [&](auto& path) {
- return path.isSelectable(start, end);
+ return path.selectableRange();
});
}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h (282338 => 282339)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h 2021-09-13 17:57:14 UTC (rev 282338)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h 2021-09-13 18:06:30 UTC (rev 282339)
@@ -28,6 +28,7 @@
#include "LegacyInlineTextBox.h"
#include "LegacyRootInlineBox.h"
#include "RenderText.h"
+#include "TextBoxSelectableRange.h"
#include <wtf/RefCountedArray.h>
#include <wtf/Vector.h>
@@ -74,7 +75,7 @@
unsigned offsetForPosition(float x) const { return inlineTextBox()->offsetForPosition(x); }
float positionForOffset(unsigned offset) const { return inlineTextBox()->positionForOffset(offset); }
- bool isSelectable(unsigned start, unsigned end) const { return inlineTextBox()->isSelectable(start, end); }
+ TextBoxSelectableRange selectableRange() const { return inlineTextBox()->selectableRange(); }
LayoutRect selectionRect(unsigned start, unsigned end) const { return inlineTextBox()->localSelectionRect(start, end); }
const RenderObject& renderer() const
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h (282338 => 282339)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h 2021-09-13 17:57:14 UTC (rev 282338)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h 2021-09-13 18:06:30 UTC (rev 282339)
@@ -100,9 +100,14 @@
return snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr()).maxX();
}
- bool isSelectable(unsigned start, unsigned end) const
+ TextBoxSelectableRange selectableRange() const
{
- return selectableRange().intersects(start, end);
+ return {
+ start(),
+ length(),
+ run().style().hyphenString().length(),
+ run().isLineBreak()
+ };
}
LayoutRect selectionRect(unsigned rangeStart, unsigned rangeEnd) const
@@ -219,16 +224,6 @@
} while (!atEnd() && run().isInlineBox());
}
- TextBoxSelectableRange selectableRange() const
- {
- return {
- start(),
- length(),
- run().style().hyphenString().length(),
- run().isLineBreak()
- };
- }
-
enum class HyphenMode { Include, Ignore };
TextRun createTextRun(HyphenMode hyphenMode) const
{
Modified: trunk/Source/WebCore/rendering/LegacyInlineTextBox.cpp (282338 => 282339)
--- trunk/Source/WebCore/rendering/LegacyInlineTextBox.cpp 2021-09-13 17:57:14 UTC (rev 282338)
+++ trunk/Source/WebCore/rendering/LegacyInlineTextBox.cpp 2021-09-13 18:06:30 UTC (rev 282339)
@@ -154,11 +154,6 @@
return root().selectionHeight();
}
-bool LegacyInlineTextBox::isSelectable(unsigned startPosition, unsigned endPosition) const
-{
- return selectableRange().intersects(startPosition, endPosition);
-}
-
RenderObject::HighlightState LegacyInlineTextBox::selectionState() const
{
return renderer().view().selection().highlightStateForTextBox(renderer(), selectableRange());
Modified: trunk/Source/WebCore/rendering/LegacyInlineTextBox.h (282338 => 282339)
--- trunk/Source/WebCore/rendering/LegacyInlineTextBox.h 2021-09-13 17:57:14 UTC (rev 282338)
+++ trunk/Source/WebCore/rendering/LegacyInlineTextBox.h 2021-09-13 18:06:30 UTC (rev 282339)
@@ -115,7 +115,6 @@
public:
virtual LayoutRect localSelectionRect(unsigned startPos, unsigned endPos) const;
- bool isSelectable(unsigned startPosition, unsigned endPosition) const;
std::pair<unsigned, unsigned> selectionStartEnd() const;
protected:
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (282338 => 282339)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-09-13 17:57:14 UTC (rev 282338)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-09-13 18:06:30 UTC (rev 282339)
@@ -3260,7 +3260,7 @@
case RenderObject::HighlightState::Both:
break;
}
- if (textBox.isSelectable(start, end))
+ if (textBox.selectableRange().intersects(start, end))
return true;
}
return false;
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (282338 => 282339)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2021-09-13 17:57:14 UTC (rev 282338)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2021-09-13 18:06:30 UTC (rev 282339)
@@ -491,7 +491,7 @@
Vector<FloatQuad> quads;
for (auto& run : LayoutIntegration::textRunsFor(*this)) {
- if (ignoreEmptyTextSelections && !run.isSelectable(start, end))
+ if (ignoreEmptyTextSelections && !run.selectableRange().intersects(start, end))
continue;
if (start <= run.start() && run.end() <= end) {
auto boundaries = boundariesForTextRun(run);