Rename SelectionData classes and structures HighlightData, etc to be more inclusive...
authormegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Feb 2020 19:32:19 +0000 (19:32 +0000)
committermegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Feb 2020 19:32:19 +0000 (19:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=206340

Reviewed by Ryosuke Niwa.

Rename only, no behaviour change.

With the new Highlight API, we will be using these data structures to support Highlights as well as Selection,
rename to Highlight, as a Selection is a type of Highlight.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/DragImage.cpp:
(WebCore::ScopedFrameSelectionState::~ScopedFrameSelectionState):
(WebCore::createDragImageForRange):
* rendering/ComplexLineLayout.cpp:
(WebCore::ComplexLineLayout::constructLine):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::paint):
* rendering/EllipsisBox.h:
* rendering/HighlightData.cpp: Renamed from Source/WebCore/rendering/SelectionRangeData.cpp.
(WebCore::isValidRendererForSelection):
(WebCore::collect):
(WebCore::HighlightData::HighlightData):
(WebCore::HighlightData::setRenderRange):
(WebCore::HighlightData::selectionStateForRenderer):
(WebCore::HighlightData::set):
(WebCore::HighlightData::clear):
(WebCore::HighlightData::repaint const):
(WebCore::HighlightData::collectBounds const):
(WebCore::HighlightData::apply):
* rendering/HighlightData.h: Renamed from Source/WebCore/rendering/SelectionRangeData.h.
(WebCore::HighlightData::RenderRange::RenderRange):
(WebCore::HighlightData::RenderRange::operator== const):
(WebCore::HighlightData::get const):
(WebCore::HighlightData::start const):
(WebCore::HighlightData::end const):
(WebCore::HighlightData::startOffset const):
(WebCore::HighlightData::endOffset const):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::selectionState):
* rendering/InlineBox.h:
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::selectionState):
* rendering/InlineFlowBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::selectionState):
(WebCore::InlineTextBox::verifySelectionState const):
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::clampedStartEndForState const):
(WebCore::InlineTextBox::highlightStartEnd const):
(WebCore::InlineTextBox::collectMarkedTextsForHighlights const):
* rendering/InlineTextBox.h:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::shouldPaintSelectionGaps const):
(WebCore::RenderBlock::selectionGaps):
(WebCore::RenderBlock::blockSelectionGaps):
(WebCore::RenderBlock::getSelectionGapInfo):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::setSelectionState):
(WebCore::RenderBlockFlow::inlineSelectionGaps):
* rendering/RenderBlockFlow.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::setSelectionState):
* rendering/RenderBoxModelObject.h:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::setSelectionState):
* rendering/RenderLineBreak.h:
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
(WebCore::RenderListMarker::setSelectionState):
(WebCore::RenderListMarker::selectionRectForRepaint):
* rendering/RenderListMarker.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::isSelectionBorder const):
* rendering/RenderObject.h:
(WebCore::RenderObject::selectionState const):
(WebCore::RenderObject::setSelectionState):
(WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
(WebCore::RenderObject::RenderObjectBitfields::selectionState const):
(WebCore::RenderObject::RenderObjectBitfields::setSelectionState):
(WebCore::RenderObject::setSelectionStateIfNeeded):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldDrawSelectionTint const):
(WebCore::RenderReplaced::paint):
(WebCore::RenderReplaced::setSelectionState):
(WebCore::RenderReplaced::isSelected const):
* rendering/RenderReplaced.h:
* rendering/RenderSelectionInfo.h:
(WebCore::RenderSelectionInfoBase::state const):
* rendering/RenderText.cpp:
(WebCore::RenderText::setSelectionState):
(WebCore::RenderText::collectSelectionRectsForLineBoxes):
* rendering/RenderText.h:
* rendering/RenderTextLineBoxes.cpp:
(WebCore::RenderTextLineBoxes::setSelectionState):
* rendering/RenderTextLineBoxes.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintAttachment):
* rendering/RenderView.h:
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::setSelectionState):
* rendering/RenderWidget.h:
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::lineSelectionGap):
(WebCore::RootInlineBox::selectionState):
(WebCore::RootInlineBox::firstSelectedBox):
(WebCore::RootInlineBox::lastSelectedBox):
(WebCore::RootInlineBox::selectionTopAdjustedForPrecedingBlock const):
* rendering/RootInlineBox.h:
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForWithReason):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paintSelectionBackground):
(WebCore::SVGInlineTextBox::paint):
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::paint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256196 268f45cc-cd09-0410-ab3c-d52691b4dbfc

46 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Headers.cmake
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/DragImage.cpp
Source/WebCore/rendering/ComplexLineLayout.cpp
Source/WebCore/rendering/EllipsisBox.cpp
Source/WebCore/rendering/EllipsisBox.h
Source/WebCore/rendering/HighlightData.cpp [moved from Source/WebCore/rendering/SelectionRangeData.cpp with 72% similarity]
Source/WebCore/rendering/HighlightData.h [moved from Source/WebCore/rendering/SelectionRangeData.h with 74% similarity]
Source/WebCore/rendering/InlineBox.cpp
Source/WebCore/rendering/InlineBox.h
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/InlineFlowBox.h
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/InlineTextBox.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderLineBreak.cpp
Source/WebCore/rendering/RenderLineBreak.h
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/RenderListMarker.h
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderReplaced.h
Source/WebCore/rendering/RenderSelectionInfo.h
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderText.h
Source/WebCore/rendering/RenderTextLineBoxes.cpp
Source/WebCore/rendering/RenderTextLineBoxes.h
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderView.h
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/RenderWidget.h
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/RootInlineBox.h
Source/WebCore/rendering/SimpleLineLayout.cpp
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Source/WebCore/rendering/svg/SVGRootInlineBox.cpp

index 4f4577c..f088961 100644 (file)
@@ -1,3 +1,124 @@
+2020-02-10  Megan Gardner  <megan_gardner@apple.com>
+
+        Rename SelectionData classes and structures HighlightData, etc to be more inclusive for their new use cases
+        https://bugs.webkit.org/show_bug.cgi?id=206340
+
+        Reviewed by Ryosuke Niwa.
+
+        Rename only, no behaviour change.
+
+        With the new Highlight API, we will be using these data structures to support Highlights as well as Selection, 
+        rename to Highlight, as a Selection is a type of Highlight.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/DragImage.cpp:
+        (WebCore::ScopedFrameSelectionState::~ScopedFrameSelectionState):
+        (WebCore::createDragImageForRange):
+        * rendering/ComplexLineLayout.cpp:
+        (WebCore::ComplexLineLayout::constructLine):
+        * rendering/EllipsisBox.cpp:
+        (WebCore::EllipsisBox::paint):
+        * rendering/EllipsisBox.h:
+        * rendering/HighlightData.cpp: Renamed from Source/WebCore/rendering/SelectionRangeData.cpp.
+        (WebCore::isValidRendererForSelection):
+        (WebCore::collect):
+        (WebCore::HighlightData::HighlightData):
+        (WebCore::HighlightData::setRenderRange):
+        (WebCore::HighlightData::selectionStateForRenderer):
+        (WebCore::HighlightData::set):
+        (WebCore::HighlightData::clear):
+        (WebCore::HighlightData::repaint const):
+        (WebCore::HighlightData::collectBounds const):
+        (WebCore::HighlightData::apply):
+        * rendering/HighlightData.h: Renamed from Source/WebCore/rendering/SelectionRangeData.h.
+        (WebCore::HighlightData::RenderRange::RenderRange):
+        (WebCore::HighlightData::RenderRange::operator== const):
+        (WebCore::HighlightData::get const):
+        (WebCore::HighlightData::start const):
+        (WebCore::HighlightData::end const):
+        (WebCore::HighlightData::startOffset const):
+        (WebCore::HighlightData::endOffset const):
+        * rendering/InlineBox.cpp:
+        (WebCore::InlineBox::selectionState):
+        * rendering/InlineBox.h:
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::selectionState):
+        * rendering/InlineFlowBox.h:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::selectionState):
+        (WebCore::InlineTextBox::verifySelectionState const):
+        (WebCore::InlineTextBox::paint):
+        (WebCore::InlineTextBox::clampedStartEndForState const):
+        (WebCore::InlineTextBox::highlightStartEnd const):
+        (WebCore::InlineTextBox::collectMarkedTextsForHighlights const):
+        * rendering/InlineTextBox.h:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::shouldPaintSelectionGaps const):
+        (WebCore::RenderBlock::selectionGaps):
+        (WebCore::RenderBlock::blockSelectionGaps):
+        (WebCore::RenderBlock::getSelectionGapInfo):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::setSelectionState):
+        (WebCore::RenderBlockFlow::inlineSelectionGaps):
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::setSelectionState):
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderLineBreak.cpp:
+        (WebCore::RenderLineBreak::setSelectionState):
+        * rendering/RenderLineBreak.h:
+        * rendering/RenderListMarker.cpp:
+        (WebCore::RenderListMarker::paint):
+        (WebCore::RenderListMarker::setSelectionState):
+        (WebCore::RenderListMarker::selectionRectForRepaint):
+        * rendering/RenderListMarker.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::isSelectionBorder const):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::selectionState const):
+        (WebCore::RenderObject::setSelectionState):
+        (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
+        (WebCore::RenderObject::RenderObjectBitfields::selectionState const):
+        (WebCore::RenderObject::RenderObjectBitfields::setSelectionState):
+        (WebCore::RenderObject::setSelectionStateIfNeeded):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::shouldDrawSelectionTint const):
+        (WebCore::RenderReplaced::paint):
+        (WebCore::RenderReplaced::setSelectionState):
+        (WebCore::RenderReplaced::isSelected const):
+        * rendering/RenderReplaced.h:
+        * rendering/RenderSelectionInfo.h:
+        (WebCore::RenderSelectionInfoBase::state const):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::setSelectionState):
+        (WebCore::RenderText::collectSelectionRectsForLineBoxes):
+        * rendering/RenderText.h:
+        * rendering/RenderTextLineBoxes.cpp:
+        (WebCore::RenderTextLineBoxes::setSelectionState):
+        * rendering/RenderTextLineBoxes.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintAttachment):
+        * rendering/RenderView.h:
+        * rendering/RenderWidget.cpp:
+        (WebCore::RenderWidget::setSelectionState):
+        * rendering/RenderWidget.h:
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::lineSelectionGap):
+        (WebCore::RootInlineBox::selectionState):
+        (WebCore::RootInlineBox::firstSelectedBox):
+        (WebCore::RootInlineBox::lastSelectedBox):
+        (WebCore::RootInlineBox::selectionTopAdjustedForPrecedingBlock const):
+        * rendering/RootInlineBox.h:
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseForWithReason):
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::paintSelectionBackground):
+        (WebCore::SVGInlineTextBox::paint):
+        * rendering/svg/SVGRootInlineBox.cpp:
+        (WebCore::SVGRootInlineBox::paint):
+
 2020-02-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         Unreachable code hit in WebCore::Shape::createShape
index c664a9a..163b229 100644 (file)
@@ -1290,6 +1290,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS
     rendering/EventRegion.h
     rendering/FloatingObjects.h
     rendering/GapRects.h
+    rendering/HighlightData.h
     rendering/HitTestLocation.h
     rendering/HitTestRequest.h
     rendering/HitTestResult.h
@@ -1345,7 +1346,6 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS
     rendering/RenderWidget.h
     rendering/RootInlineBox.h
     rendering/ScrollAlignment.h
-    rendering/SelectionRangeData.h
     rendering/SimpleLineLayout.h
     rendering/SimpleLineLayoutCoverage.h
     rendering/SimpleLineLayoutFlowContents.h
index 928ec55..76e9e1f 100644 (file)
@@ -2185,7 +2185,7 @@ rendering/RenderView.cpp
 rendering/RenderWidget.cpp
 rendering/RootInlineBox.cpp
 rendering/ScrollAlignment.cpp
-rendering/SelectionRangeData.cpp
+rendering/HighlightData.cpp
 rendering/SimpleLineLayout.cpp
 rendering/SimpleLineLayoutCoverage.cpp
 rendering/SimpleLineLayoutFlowContents.cpp
index 2a57c4c..772d668 100644 (file)
                CDCC9BCF22387E9A00FFB51C /* MediaCapabilitiesDecodingInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCC9BCE22387E9A00FFB51C /* MediaCapabilitiesDecodingInfo.h */; };
                CDCC9BD122387EAA00FFB51C /* MediaCapabilitiesEncodingInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCC9BD022387EAA00FFB51C /* MediaCapabilitiesEncodingInfo.h */; };
                CDCD41E81C3DDB0A00965D99 /* ParsedContentRange.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCD41E61C3DDB0900965D99 /* ParsedContentRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               CDCFABBD18C0AF78006F8450 /* SelectionRangeData.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCFABBB18C0AE31006F8450 /* SelectionRangeData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               CDCFABBD18C0AF78006F8450 /* HighlightData.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCFABBB18C0AE31006F8450 /* HighlightData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CDD7089718359F6F002B3DC6 /* SampleMap.h in Headers */ = {isa = PBXBuildFile; fileRef = CDD7089518359F6F002B3DC6 /* SampleMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CDDC1E7A18A952F30027A9D4 /* MediaSourcePrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CDDC1E7918A952F30027A9D4 /* MediaSourcePrivateClient.h */; };
                CDDE02ED18B3ED6D00CF7FF1 /* CDMSessionAVFoundationObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDDE02EB18B3ED6D00CF7FF1 /* CDMSessionAVFoundationObjC.mm */; };
                CDCD41E51C3DDB0900965D99 /* ParsedContentRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParsedContentRange.cpp; sourceTree = "<group>"; };
                CDCD41E61C3DDB0900965D99 /* ParsedContentRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParsedContentRange.h; sourceTree = "<group>"; };
                CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventTargetFactory.in; sourceTree = "<group>"; };
-               CDCFABBB18C0AE31006F8450 /* SelectionRangeData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionRangeData.h; sourceTree = "<group>"; };
-               CDCFABBC18C0AF19006F8450 /* SelectionRangeData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionRangeData.cpp; sourceTree = "<group>"; };
+               CDCFABBB18C0AE31006F8450 /* HighlightData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HighlightData.h; sourceTree = "<group>"; };
+               CDCFABBC18C0AF19006F8450 /* HighlightData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HighlightData.cpp; sourceTree = "<group>"; };
                CDD1E525167BA56400CE820B /* TextTrackRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackRepresentation.h; sourceTree = "<group>"; };
                CDD7089418359F6E002B3DC6 /* SampleMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SampleMap.cpp; sourceTree = "<group>"; };
                CDD7089518359F6F002B3DC6 /* SampleMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleMap.h; sourceTree = "<group>"; };
                                E112F46F1E3A85D800D6CDFD /* Grid.h */,
                                E12DE7151E4B748700F9ACCF /* GridTrackSizingAlgorithm.cpp */,
                                E12DE7161E4B748700F9ACCF /* GridTrackSizingAlgorithm.h */,
+                               CDCFABBC18C0AF19006F8450 /* HighlightData.cpp */,
+                               CDCFABBB18C0AE31006F8450 /* HighlightData.h */,
                                4969B0F013D0B33F00DF3521 /* HitTestingTransformState.cpp */,
                                4969B0F113D0B33F00DF3521 /* HitTestingTransformState.h */,
                                2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */,
                                A8CFF5DA0A155A05000A4234 /* RootInlineBox.h */,
                                5D925B650F64D4DD00B847F0 /* ScrollAlignment.cpp */,
                                5D925B660F64D4DD00B847F0 /* ScrollAlignment.h */,
-                               CDCFABBC18C0AF19006F8450 /* SelectionRangeData.cpp */,
-                               CDCFABBB18C0AE31006F8450 /* SelectionRangeData.h */,
                                E48944A0180B57D800F165D8 /* SimpleLineLayout.cpp */,
                                E48944A1180B57D800F165D8 /* SimpleLineLayout.h */,
                                11E067EB1E62461300162D16 /* SimpleLineLayoutCoverage.cpp */,
                                F55B3DC01251F12D003EF269 /* HiddenInputType.h in Headers */,
                                515BE19C1D54F6C100DD7C68 /* HIDGamepad.h in Headers */,
                                515BE19E1D54F6C100DD7C68 /* HIDGamepadProvider.h in Headers */,
+                               CDCFABBD18C0AF78006F8450 /* HighlightData.h in Headers */,
                                BC94D1540C275C8B006BC617 /* History.h in Headers */,
                                97DCE20210807C750057D394 /* HistoryController.h in Headers */,
                                51741D110B07259A00ED442C /* HistoryItem.h in Headers */,
                                974D2DA5146A535D00D51F8B /* SecurityPolicy.h in Headers */,
                                2D5BC42716F882EE007048D0 /* SecurityPolicyViolationEvent.h in Headers */,
                                B2C3DA2F0D006C1D00EF6F26 /* SegmentedString.h in Headers */,
-                               CDCFABBD18C0AF78006F8450 /* SelectionRangeData.h in Headers */,
                                BEA807C90F714A0300524199 /* SelectionRect.h in Headers */,
                                51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */,
                                E44B4BB4141650D7002B1D8B /* SelectorChecker.h in Headers */,
index f1e9a0d..2d41b73 100644 (file)
@@ -436,7 +436,7 @@ void FrameSelection::setNeedsSelectionUpdate(RevealSelectionAfterUpdate revealMo
         m_selectionRevealMode = SelectionRevealMode::Reveal;
     m_pendingSelectionUpdate = true;
     if (RenderView* view = m_frame->contentRenderer())
-        view->selection().clear();
+        view->selection().clearSelection();
 }
 
 void FrameSelection::updateAndRevealSelection(const AXTextStateChangeIntent& intent)
@@ -492,7 +492,7 @@ void DragCaretController::nodeWillBeRemoved(Node& node)
         return;
 
     if (RenderView* view = node.document().renderView())
-        view->selection().clear();
+        view->selection().clearSelection();
 
     clear();
 }
@@ -557,7 +557,7 @@ void FrameSelection::respondToNodeModification(Node& node, bool baseRemoved, boo
 
     if (clearRenderTreeSelection) {
         if (auto* renderView = node.document().renderView()) {
-            renderView->selection().clear();
+            renderView->selection().clearSelection();
 
             // Trigger a selection update so the selection will be set again.
             m_selectionRevealIntent = AXTextStateChangeIntent();
@@ -1570,7 +1570,7 @@ void FrameSelection::prepareForDestruction()
 #endif
 
     if (auto* view = m_frame->contentRenderer())
-        view->selection().clear();
+        view->selection().clearSelection();
 
     setSelectionWithoutUpdatingAppearance(VisibleSelection(), defaultSetSelectionOptions(), AlignCursorOnScrollIfNeeded, CharacterGranularity);
     m_previousCaretNode = nullptr;
@@ -2154,7 +2154,7 @@ void FrameSelection::updateAppearance()
 #endif
 
     if (!selection.isRange()) {
-        view->selection().clear();
+        view->selection().clearSelection();
         return;
     }
 
@@ -2179,7 +2179,7 @@ void FrameSelection::updateAppearance()
         RenderObject* endRenderer = endPos.deprecatedNode()->renderer();
         int endOffset = endPos.deprecatedEditingOffset();
         ASSERT(startOffset >= 0 && endOffset >= 0);
-        view->selection().set({ startRenderer, endRenderer, static_cast<unsigned>(startOffset), static_cast<unsigned>(endOffset) });
+        view->selection().setSelection({ startRenderer, endRenderer, static_cast<unsigned>(startOffset), static_cast<unsigned>(endOffset) });
     }
 }
 
index d9ac1c2..41aa08b 100644 (file)
@@ -4259,7 +4259,7 @@ void FrameView::paintContentsForSnapshot(GraphicsContext& context, const IntRect
     if (shouldPaintSelection == ExcludeSelection) {
         for (auto* frame = m_frame.ptr(); frame; frame = frame->tree().traverseNext(m_frame.ptr())) {
             if (auto* renderView = frame->contentRenderer())
-                renderView->selection().clear();
+                renderView->selection().clearSelection();
         }
     }
 
index 00ac98f..8b905f4 100644 (file)
@@ -145,12 +145,12 @@ struct ScopedFrameSelectionState {
     {
         if (auto* renderView = frame.contentRenderer()) {
             ASSERT(selection);
-            renderView->selection().set(selection.value(), SelectionRangeData::RepaintMode::Nothing);
+            renderView->selection().setSelection(selection.value(), HighlightData::RepaintMode::Nothing);
         }
     }
 
     const Frame& frame;
-    Optional<SelectionRangeData::Context> selection;
+    Optional<HighlightData::RenderRange> selection;
 };
 
 #if !PLATFORM(IOS_FAMILY)
@@ -187,7 +187,7 @@ DragImageRef createDragImageForRange(Frame& frame, Range& range, bool forceBlack
     int startOffset = start.deprecatedEditingOffset();
     int endOffset = end.deprecatedEditingOffset();
     ASSERT(startOffset >= 0 && endOffset >= 0);
-    view->selection().set({ startRenderer, endRenderer, static_cast<unsigned>(startOffset), static_cast<unsigned>(endOffset) }, SelectionRangeData::RepaintMode::Nothing);
+    view->selection().setSelection({ startRenderer, endRenderer, static_cast<unsigned>(startOffset), static_cast<unsigned>(endOffset) }, HighlightData::RepaintMode::Nothing);
     // We capture using snapshotFrameRect() because we fake up the selection using
     // FrameView but snapshotSelection() uses the selection from the Frame itself.
     return createDragImageFromSnapshot(snapshotFrameRect(frame, view->selection().boundsClippedToVisibleContent(), options), nullptr);
index f6fd16b..29ebe56 100644 (file)
@@ -310,7 +310,7 @@ RootInlineBox* ComplexLineLayout::constructLine(BidiRunList<BidiRun>& bidiRuns,
         InlineBox* box = createInlineBoxForRenderer(&r->renderer(), isOnlyRun);
         r->setBox(box);
 
-        if (!rootHasSelectedChildren && box->renderer().selectionState() != RenderObject::SelectionNone)
+        if (!rootHasSelectedChildren && box->renderer().selectionState() != RenderObject::HighlightState::None)
             rootHasSelectedChildren = true;
         
         // If we have no parent box yet, or if the run is not simply a sibling,
index 2274e7b..b584919 100644 (file)
@@ -60,7 +60,7 @@ void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, La
     }
 
     const FontCascade& font = lineStyle.fontCascade();
-    if (selectionState() != RenderObject::SelectionNone) {
+    if (selectionState() != RenderObject::HighlightState::None) {
         paintSelection(context, paintOffset, lineStyle, font);
 
         // Select the correct color for painting the text.
index 3f98b7d..4fa2d50 100644 (file)
@@ -33,7 +33,7 @@ public:
     EllipsisBox(RenderBlockFlow&, const AtomString& ellipsisStr, InlineFlowBox* parent, int width, int height, int y, bool firstLine, bool isHorizontal, InlineBox* markupBox);
     void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;
     bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) final;
-    void setSelectionState(RenderObject::SelectionState s) { m_selectionState = s; }
+    void setSelectionState(RenderObject::HighlightState s) { m_selectionState = s; }
     IntRect selectionRect();
 
     RenderBlockFlow& blockFlow() const { return downcast<RenderBlockFlow>(InlineBox::renderer()); }
@@ -41,12 +41,12 @@ public:
 private:
     void paintMarkupBox(PaintInfo&, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, const RenderStyle&);
     int height() const { return m_height; }
-    RenderObject::SelectionState selectionState() override { return m_selectionState; }
+    RenderObject::HighlightState selectionState() override { return m_selectionState; }
     void paintSelection(GraphicsContext&, const LayoutPoint&, const RenderStyle&, const FontCascade&);
     InlineBox* markupBox() const;
 
     bool m_shouldPaintMarkupBox;
-    RenderObject::SelectionState m_selectionState { RenderObject::SelectionNone };
+    RenderObject::HighlightState m_selectionState { RenderObject::HighlightState::None };
     int m_height;
     AtomString m_str;
 };
similarity index 72%
rename from Source/WebCore/rendering/SelectionRangeData.cpp
rename to Source/WebCore/rendering/HighlightData.cpp
index d218890..e5a4e57 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 #include "config.h"
-#include "SelectionRangeData.h"
+#include "HighlightData.h"
 
 #include "Document.h"
 #include "FrameSelection.h"
@@ -55,9 +55,9 @@ struct SelectionData {
     RenderBlockMap blocks;
 };
 
-class SelectionIterator {
+class HighlightIterator {
 public:
-    SelectionIterator(RenderObject* start)
+    HighlightIterator(RenderObject* start)
         : m_current(start)
     {
         checkForSpanner();
@@ -104,10 +104,10 @@ static RenderObject* rendererAfterOffset(const RenderObject& renderer, unsigned
     return child ? child : renderer.nextInPreOrderAfterChildren();
 }
 
-static bool isValidRendererForSelection(const RenderObject& renderer, const SelectionRangeData::Context& selection)
+static bool isValidRendererForSelection(const RenderObject& renderer, const HighlightData::RenderRange& selection)
 {
     return (renderer.canBeSelectionLeaf() || &renderer == selection.start() || &renderer == selection.end())
-        && renderer.selectionState() != RenderObject::SelectionNone
+        && renderer.selectionState() != RenderObject::HighlightState::None
         && renderer.containingBlock();
 }
 
@@ -117,7 +117,7 @@ static RenderBlock* containingBlockBelowView(const RenderObject& renderer)
     return is<RenderView>(containingBlock) ? nullptr : containingBlock;
 }
 
-static SelectionData collect(const SelectionRangeData::Context& selection, bool repaintDifference)
+static SelectionData collectSelectionData(const HighlightData::RenderRange& selection, bool repaintDifference)
 {
     SelectionData oldSelectionData { selection.startOffset(), selection.endOffset(), { }, { } };
     // Blocks contain selected objects and fill gaps between them, either on the left, right, or in between lines and blocks.
@@ -127,7 +127,7 @@ static SelectionData collect(const SelectionRangeData::Context& selection, bool
     RenderObject* stop = nullptr;
     if (selection.end())
         stop = rendererAfterOffset(*selection.end(), selection.endOffset().value());
-    SelectionIterator selectionIterator(start);
+    HighlightIterator selectionIterator(start);
     while (start && start != stop) {
         if (isValidRendererForSelection(*start, selection)) {
             // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
@@ -146,7 +146,7 @@ static SelectionData collect(const SelectionRangeData::Context& selection, bool
     return oldSelectionData;
 }
 
-SelectionRangeData::SelectionRangeData(RenderView& view)
+HighlightData::HighlightData(RenderView& view)
     : m_renderView(view)
 #if ENABLE(SERVICE_CONTROLS)
     , m_selectionRectGatherer(view)
@@ -154,52 +154,46 @@ SelectionRangeData::SelectionRangeData(RenderView& view)
 {
 }
 
-void SelectionRangeData::setContext(const Context& context)
+void HighlightData::setRenderRange(const RenderRange& renderRange)
 {
-    ASSERT(context.start() && context.end());
-    m_selectionContext = context;
+    ASSERT(renderRange.start() && renderRange.end());
+    m_renderRange = renderRange;
 }
 
-RenderObject::SelectionState SelectionRangeData::selectionStateForRenderer(RenderObject& renderer)
+RenderObject::HighlightState HighlightData::highlightStateForRenderer(RenderObject& renderer)
 {
-    // FIXME: we shouldln't have to check that a renderer is a descendant of the render node
-    // from the range. This is likely because we aren't using VisiblePositions yet.
-    // Planned fix in a followup: <rdar://problem/58095923>
-    // https://bugs.webkit.org/show_bug.cgi?id=205529
-    
-    if (&renderer == m_selectionContext.start()) {
-        if (m_selectionContext.start() && m_selectionContext.end() && m_selectionContext.start() == m_selectionContext.end())
-            return RenderObject::SelectionBoth;
-        if (m_selectionContext.start())
-            return RenderObject::SelectionStart;
+    if (&renderer == m_renderRange.start()) {
+        if (m_renderRange.start() && m_renderRange.end() && m_renderRange.start() == m_renderRange.end())
+            return RenderObject::HighlightState::Both;
+        if (m_renderRange.start())
+            return RenderObject::HighlightState::Start;
     }
-    if (&renderer == m_selectionContext.end())
-        return RenderObject::SelectionEnd;
-
-    RenderObject* selectionEnd = nullptr;
-    auto* selectionDataEnd = m_selectionContext.end();
-    if (selectionDataEnd)
-        selectionEnd = rendererAfterOffset(*selectionDataEnd, m_selectionContext.endOffset().value());
-    SelectionIterator selectionIterator(m_selectionContext.start());
-    for (auto* currentRenderer = m_selectionContext.start(); currentRenderer && currentRenderer != m_selectionContext.end(); currentRenderer = selectionIterator.next()) {
-        if (currentRenderer == m_selectionContext.start() || currentRenderer == m_selectionContext.end())
+    if (&renderer == m_renderRange.end())
+        return RenderObject::HighlightState::End;
+
+    RenderObject* highlightEnd = nullptr;
+    auto* highlightDataEnd = m_renderRange.end();
+    if (highlightDataEnd)
+        highlightEnd = rendererAfterOffset(*highlightDataEnd, m_renderRange.endOffset().value());
+    HighlightIterator highlightIterator(m_renderRange.start());
+    for (auto* currentRenderer = m_renderRange.start(); currentRenderer && currentRenderer != m_renderRange.end(); currentRenderer = highlightIterator.next()) {
+        if (currentRenderer == m_renderRange.start() || currentRenderer == m_renderRange.end())
             continue;
         if (!currentRenderer->canBeSelectionLeaf())
             continue;
         if (&renderer == currentRenderer)
-            return RenderObject::SelectionInside;
+            return RenderObject::HighlightState::Inside;
     }
-    return RenderObject::SelectionNone;
-    
+    return RenderObject::HighlightState::None;
 }
 
-void SelectionRangeData::set(const Context& selection, RepaintMode blockRepaintMode)
+void HighlightData::setSelection(const RenderRange& selection, RepaintMode blockRepaintMode)
 {
     if ((selection.start() && !selection.end()) || (selection.end() && !selection.start()))
         return;
     // Just return if the selection hasn't changed.
     auto isCaret = m_renderView.frame().selection().isCaret();
-    if (selection == m_selectionContext && m_selectionWasCaret == isCaret)
+    if (selection == m_renderRange && m_selectionWasCaret == isCaret)
         return;
 #if ENABLE(SERVICE_CONTROLS)
     // Clear the current rects and create a notifier for the new rects we are about to gather.
@@ -207,26 +201,26 @@ void SelectionRangeData::set(const Context& selection, RepaintMode blockRepaintM
     auto rectNotifier = m_selectionRectGatherer.clearAndCreateNotifier();
 #endif
     m_selectionWasCaret = isCaret;
-    apply(selection, blockRepaintMode);
+    applySelection(selection, blockRepaintMode);
 }
 
-void SelectionRangeData::clear()
+void HighlightData::clearSelection()
 {
     m_renderView.layer()->repaintBlockSelectionGaps();
-    set({ }, SelectionRangeData::RepaintMode::NewMinusOld);
+    setSelection({ }, HighlightData::RepaintMode::NewMinusOld);
 }
 
-void SelectionRangeData::repaint() const
+void HighlightData::repaint() const
 {
     HashSet<RenderBlock*> processedBlocks;
     RenderObject* end = nullptr;
-    if (m_selectionContext.end())
-        end = rendererAfterOffset(*m_selectionContext.end(), m_selectionContext.endOffset().value());
-    SelectionIterator selectionIterator(m_selectionContext.start());
-    for (auto* renderer = selectionIterator.current(); renderer && renderer != end; renderer = selectionIterator.next()) {
-        if (!renderer->canBeSelectionLeaf() && renderer != m_selectionContext.start() && renderer != m_selectionContext.end())
+    if (m_renderRange.end())
+        end = rendererAfterOffset(*m_renderRange.end(), m_renderRange.endOffset().value());
+    HighlightIterator highlightIterator(m_renderRange.start());
+    for (auto* renderer = highlightIterator.current(); renderer && renderer != end; renderer = highlightIterator.next()) {
+        if (!renderer->canBeSelectionLeaf() && renderer != m_renderRange.start() && renderer != m_renderRange.end())
             continue;
-        if (renderer->selectionState() == RenderObject::SelectionNone)
+        if (renderer->selectionState() == RenderObject::HighlightState::None)
             continue;
         RenderSelectionInfo(*renderer, true).repaint();
         // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
@@ -238,17 +232,17 @@ void SelectionRangeData::repaint() const
     }
 }
 
-IntRect SelectionRangeData::collectBounds(ClipToVisibleContent clipToVisibleContent) const
+IntRect HighlightData::collectBounds(ClipToVisibleContent clipToVisibleContent) const
 {
     SelectionData::RendererMap renderers;
-    auto* start = m_selectionContext.start();
+    auto* start = m_renderRange.start();
     RenderObject* stop = nullptr;
-    if (m_selectionContext.end())
-        stop = rendererAfterOffset(*m_selectionContext.end(), m_selectionContext.endOffset().value());
-    SelectionIterator selectionIterator(start);
+    if (m_renderRange.end())
+        stop = rendererAfterOffset(*m_renderRange.end(), m_renderRange.endOffset().value());
+    HighlightIterator highlightIterator(start);
     while (start && start != stop) {
-        if ((start->canBeSelectionLeaf() || start == m_selectionContext.start() || start == m_selectionContext.end())
-            && start->selectionState() != RenderObject::SelectionNone) {
+        if ((start->canBeSelectionLeaf() || start == m_renderRange.start() || start == m_renderRange.end())
+            && start->selectionState() != RenderObject::HighlightState::None) {
             // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
             renderers.set(start, makeUnique<RenderSelectionInfo>(*start, clipToVisibleContent == ClipToVisibleContent::Yes));
             auto* block = start->containingBlock();
@@ -260,7 +254,7 @@ IntRect SelectionRangeData::collectBounds(ClipToVisibleContent clipToVisibleCont
                 block = block->containingBlock();
             }
         }
-        start = selectionIterator.next();
+        start = highlightIterator.next();
     }
 
     // Now create a single bounding box rect that encloses the whole selection.
@@ -277,35 +271,35 @@ IntRect SelectionRangeData::collectBounds(ClipToVisibleContent clipToVisibleCont
     return snappedIntRect(selectionRect);
 }
 
-void SelectionRangeData::apply(const Context& newSelection, RepaintMode blockRepaintMode)
+void HighlightData::applySelection(const RenderRange& newSelection, RepaintMode blockRepaintMode)
 {
-    auto oldSelectionData = collect(m_selectionContext, blockRepaintMode == RepaintMode::NewXOROld);
+    auto oldSelectionData = collectSelectionData(m_renderRange, blockRepaintMode == RepaintMode::NewXOROld);
     // Remove current selection.
     for (auto* renderer : oldSelectionData.renderers.keys())
-        renderer->setSelectionStateIfNeeded(RenderObject::SelectionNone);
-    m_selectionContext = newSelection;
-    auto* selectionStart = m_selectionContext.start();
+        renderer->setSelectionStateIfNeeded(RenderObject::HighlightState::None);
+    m_renderRange = newSelection;
+    auto* selectionStart = m_renderRange.start();
     // Update the selection status of all objects between selectionStart and selectionEnd
-    if (selectionStart && selectionStart == m_selectionContext.end())
-        selectionStart->setSelectionStateIfNeeded(RenderObject::SelectionBoth);
+    if (selectionStart && selectionStart == m_renderRange.end())
+        selectionStart->setSelectionStateIfNeeded(RenderObject::HighlightState::Both);
     else {
         if (selectionStart)
-            selectionStart->setSelectionStateIfNeeded(RenderObject::SelectionStart);
-        if (auto* end = m_selectionContext.end())
-            end->setSelectionStateIfNeeded(RenderObject::SelectionEnd);
+            selectionStart->setSelectionStateIfNeeded(RenderObject::HighlightState::Start);
+        if (auto* end = m_renderRange.end())
+            end->setSelectionStateIfNeeded(RenderObject::HighlightState::End);
     }
 
     RenderObject* selectionEnd = nullptr;
-    auto* selectionDataEnd = m_selectionContext.end();
+    auto* selectionDataEnd = m_renderRange.end();
     if (selectionDataEnd)
-        selectionEnd = rendererAfterOffset(*selectionDataEnd, m_selectionContext.endOffset().value());
-    SelectionIterator selectionIterator(selectionStart);
+        selectionEnd = rendererAfterOffset(*selectionDataEnd, m_renderRange.endOffset().value());
+    HighlightIterator selectionIterator(selectionStart);
     for (auto* currentRenderer = selectionStart; currentRenderer && currentRenderer != selectionEnd; currentRenderer = selectionIterator.next()) {
-        if (currentRenderer == selectionStart || currentRenderer == m_selectionContext.end())
+        if (currentRenderer == selectionStart || currentRenderer == m_renderRange.end())
             continue;
         if (!currentRenderer->canBeSelectionLeaf())
             continue;
-        currentRenderer->setSelectionStateIfNeeded(RenderObject::SelectionInside);
+        currentRenderer->setSelectionStateIfNeeded(RenderObject::HighlightState::Inside);
     }
 
     if (blockRepaintMode != RepaintMode::Nothing)
@@ -315,9 +309,9 @@ void SelectionRangeData::apply(const Context& newSelection, RepaintMode blockRep
     // put them in the new objects list.
     SelectionData::RendererMap newSelectedRenderers;
     SelectionData::RenderBlockMap newSelectedBlocks;
-    selectionIterator = SelectionIterator(selectionStart);
+    selectionIterator = HighlightIterator(selectionStart);
     for (auto* currentRenderer = selectionStart; currentRenderer && currentRenderer != selectionEnd; currentRenderer = selectionIterator.next()) {
-        if (isValidRendererForSelection(*currentRenderer, m_selectionContext)) {
+        if (isValidRendererForSelection(*currentRenderer, m_renderRange)) {
             std::unique_ptr<RenderSelectionInfo> selectionInfo = makeUnique<RenderSelectionInfo>(*currentRenderer, true);
 #if ENABLE(SERVICE_CONTROLS)
             for (auto& rect : selectionInfo->collectedSelectionRects())
@@ -349,8 +343,8 @@ void SelectionRangeData::apply(const Context& newSelection, RepaintMode blockRep
         auto* newInfo = newSelectedRenderers.get(renderer);
         auto* oldInfo = selectedRendererInfo.value.get();
         if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() != newInfo->state()
-            || (m_selectionContext.start() == renderer && oldSelectionData.startOffset != m_selectionContext.startOffset())
-            || (m_selectionContext.end() == renderer && oldSelectionData.endOffset != m_selectionContext.endOffset())) {
+            || (m_renderRange.start() == renderer && oldSelectionData.startOffset != m_renderRange.startOffset())
+            || (m_renderRange.end() == renderer && oldSelectionData.endOffset != m_renderRange.endOffset())) {
             oldInfo->repaint();
             if (newInfo) {
                 newInfo->repaint();
similarity index 74%
rename from Source/WebCore/rendering/SelectionRangeData.h
rename to Source/WebCore/rendering/HighlightData.h
index ac613d9..a7e8494 100644 (file)
@@ -40,14 +40,14 @@ namespace WebCore {
 
 struct OldSelectionData;
     
-class SelectionRangeData {
+class HighlightData {
 public:
-    SelectionRangeData(RenderView&);
+    HighlightData(RenderView&);
     
-    class Context {
+    class RenderRange {
     public:
-        Context() = default;
-        Context(RenderObject* start, RenderObject* end, unsigned startOffset, unsigned endOffset)
+        RenderRange() = default;
+        RenderRange(RenderObject* start, RenderObject* end, unsigned startOffset, unsigned endOffset)
             : m_start(makeWeakPtr(start))
             , m_end(makeWeakPtr(end))
             , m_startOffset(startOffset)
@@ -60,7 +60,7 @@ public:
         Optional<unsigned> startOffset() const { return m_startOffset; }
         Optional<unsigned> endOffset() const { return m_endOffset; }
 
-        bool operator==(const Context& other) const
+        bool operator==(const RenderRange& other) const
         {
             return m_start == other.m_start && m_end == other.m_end && m_startOffset == other.m_startOffset && m_endOffset == other.m_endOffset;
         }
@@ -72,35 +72,35 @@ public:
         Optional<unsigned> m_endOffset;
     };
     
-    void setContext(const Context&);
+    void setRenderRange(const RenderRange&);
     
     enum class RepaintMode { NewXOROld, NewMinusOld, Nothing };
-    void set(const Context&, RepaintMode = RepaintMode::NewXOROld);
-    const Context& get() const { return m_selectionContext; }
+    void setSelection(const RenderRange&, RepaintMode = RepaintMode::NewXOROld);
+    const RenderRange& get() const { return m_renderRange; }
 
-    RenderObject* start() const { return m_selectionContext.start(); }
-    RenderObject* end() const { return m_selectionContext.end(); }
+    RenderObject* start() const { return m_renderRange.start(); }
+    RenderObject* end() const { return m_renderRange.end(); }
 
-    unsigned startOffset() const { ASSERT(m_selectionContext.startOffset()); return m_selectionContext.startOffset().valueOr(0); }
-    unsigned endOffset() const { ASSERT(m_selectionContext.endOffset()); return m_selectionContext.endOffset().valueOr(0); }
+    unsigned startOffset() const { ASSERT(m_renderRange.startOffset()); return m_renderRange.startOffset().valueOr(0); }
+    unsigned endOffset() const { ASSERT(m_renderRange.endOffset()); return m_renderRange.endOffset().valueOr(0); }
 
-    void clear();
+    void clearSelection();
     IntRect bounds() const { return collectBounds(ClipToVisibleContent::No); }
     IntRect boundsClippedToVisibleContent() const { return collectBounds(ClipToVisibleContent::Yes); }
     void repaint() const;
     
-    RenderObject::SelectionState selectionStateForRenderer(RenderObject&);
+    RenderObject::HighlightState highlightStateForRenderer(RenderObject&);
 
 private:
     enum class ClipToVisibleContent { Yes, No };
     IntRect collectBounds(ClipToVisibleContent) const;
-    void apply(const Context&, RepaintMode);
+    void applySelection(const RenderRange&, RepaintMode);
 
     const RenderView& m_renderView;
 #if ENABLE(SERVICE_CONTROLS)
     SelectionRectGatherer m_selectionRectGatherer;
 #endif
-    Context m_selectionContext;
+    RenderRange m_renderRange;
     bool m_selectionWasCaret { false };
 };
 
index 879774a..1a4579b 100644 (file)
@@ -257,7 +257,7 @@ InlineBox* InlineBox::previousLeafOnLineIgnoringLineBreak() const
     return leaf;
 }
 
-RenderObject::SelectionState InlineBox::selectionState()
+RenderObject::HighlightState InlineBox::selectionState()
 {
     return m_renderer.selectionState();
 }
index 2ab1125..59a11d6 100644 (file)
@@ -230,7 +230,7 @@ public:
 
     WEBCORE_EXPORT virtual void dirtyLineBoxes();
     
-    WEBCORE_EXPORT virtual RenderObject::SelectionState selectionState();
+    WEBCORE_EXPORT virtual RenderObject::HighlightState selectionState();
 
     WEBCORE_EXPORT virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const;
     // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system.
index c316494..3ab1a95 100644 (file)
@@ -1505,9 +1505,9 @@ InlineBox* InlineFlowBox::lastLeafDescendant() const
     return leaf;
 }
 
-RenderObject::SelectionState InlineFlowBox::selectionState()
+RenderObject::HighlightState InlineFlowBox::selectionState()
 {
-    return RenderObject::SelectionNone;
+    return RenderObject::HighlightState::None;
 }
 
 bool InlineFlowBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const
index d36a15b..40555ff 100644 (file)
@@ -201,7 +201,7 @@ public:
     
     void removeChild(InlineBox* child);
 
-    RenderObject::SelectionState selectionState() override;
+    RenderObject::HighlightState selectionState() override;
 
     bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const final;
     float placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, float &truncatedWidth, bool&) override;
index b4df6b8..c3cf9ca 100644 (file)
@@ -34,6 +34,7 @@
 #include "EventRegion.h"
 #include "Frame.h"
 #include "GraphicsContext.h"
+#include "HighlightData.h"
 #include "HighlightMap.h"
 #include "HitTestResult.h"
 #include "ImageBuffer.h"
@@ -50,7 +51,6 @@
 #include "RenderView.h"
 #include "RenderedDocumentMarker.h"
 #include "RuntimeEnabledFeatures.h"
-#include "SelectionRangeData.h"
 #include "Text.h"
 #include "TextDecorationPainter.h"
 #include "TextPaintStyle.h"
@@ -155,54 +155,54 @@ bool InlineTextBox::isSelected(unsigned startPosition, unsigned endPosition) con
     return clampedOffset(startPosition) < clampedOffset(endPosition);
 }
 
-RenderObject::SelectionState InlineTextBox::selectionState()
+RenderObject::HighlightState InlineTextBox::selectionState()
 {
     auto state = verifySelectionState(renderer().selectionState(), renderer().view().selection());
     
     // FIXME: this code mutates selection state, but it's used at a simple getter elsewhere
-    // in this file. This code should likely live in SelectionRangeData, or somewhere else.
+    // in this file. This code should likely live in HighlightData, or somewhere else.
     // <rdar://problem/58125978>
     // https://bugs.webkit.org/show_bug.cgi?id=205528
     // If there are ellipsis following, make sure their selection is updated.
     if (m_truncation != cNoTruncation && root().ellipsisBox()) {
         EllipsisBox* ellipsis = root().ellipsisBox();
-        if (state != RenderObject::SelectionNone) {
+        if (state != RenderObject::HighlightState::None) {
             auto [selectionStart, selectionEnd] = selectionStartEnd();
             // The ellipsis should be considered to be selected if the end of
             // the selection is past the beginning of the truncation and the
             // beginning of the selection is before or at the beginning of the
             // truncation.
             ellipsis->setSelectionState(selectionEnd >= m_truncation && selectionStart <= m_truncation ?
-                RenderObject::SelectionInside : RenderObject::SelectionNone);
+                RenderObject::HighlightState::Inside : RenderObject::HighlightState::None);
         } else
-            ellipsis->setSelectionState(RenderObject::SelectionNone);
+            ellipsis->setSelectionState(RenderObject::HighlightState::None);
     }
     
     return state;
 }
 
-RenderObject::SelectionState InlineTextBox::verifySelectionState(RenderObject::SelectionState state, SelectionRangeData& selection) const
+RenderObject::HighlightState InlineTextBox::verifySelectionState(RenderObject::HighlightState state, HighlightData& selection) const
 {
-    if (state == RenderObject::SelectionStart || state == RenderObject::SelectionEnd || state == RenderObject::SelectionBoth) {
+    if (state == RenderObject::HighlightState::Start || state == RenderObject::HighlightState::End || state == RenderObject::HighlightState::Both) {
         auto startOffset = selection.startOffset();
         auto endOffset = selection.endOffset();
         // The position after a hard line break is considered to be past its end.
         ASSERT(start() + len() >= (isLineBreak() ? 1 : 0));
         unsigned lastSelectable = start() + len() - (isLineBreak() ? 1 : 0);
 
-        bool start = (state != RenderObject::SelectionEnd && startOffset >= m_start && startOffset < m_start + m_len);
-        bool end = (state != RenderObject::SelectionStart && endOffset > m_start && endOffset <= lastSelectable);
+        bool start = (state != RenderObject::HighlightState::End && startOffset >= m_start && startOffset < m_start + m_len);
+        bool end = (state != RenderObject::HighlightState::Start && endOffset > m_start && endOffset <= lastSelectable);
         if (start && end)
-            state = RenderObject::SelectionBoth;
+            state = RenderObject::HighlightState::Both;
         else if (start)
-            state = RenderObject::SelectionStart;
+            state = RenderObject::HighlightState::Start;
         else if (end)
-            state = RenderObject::SelectionEnd;
-        else if ((state == RenderObject::SelectionEnd || startOffset < m_start)
-            && (state == RenderObject::SelectionStart || endOffset > lastSelectable))
-            state = RenderObject::SelectionInside;
-        else if (state == RenderObject::SelectionBoth)
-            state = RenderObject::SelectionNone;
+            state = RenderObject::HighlightState::End;
+        else if ((state == RenderObject::HighlightState::End || startOffset < m_start)
+            && (state == RenderObject::HighlightState::Start || endOffset > lastSelectable))
+            state = RenderObject::HighlightState::Inside;
+        else if (state == RenderObject::HighlightState::Both)
+            state = RenderObject::HighlightState::None;
     }
 
     return state;
@@ -493,7 +493,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
     bool isPrinting = renderer().document().printing();
     
     // Determine whether or not we're selected.
-    bool haveSelection = !isPrinting && paintInfo.phase != PaintPhase::TextClip && selectionState() != RenderObject::SelectionNone;
+    bool haveSelection = !isPrinting && paintInfo.phase != PaintPhase::TextClip && selectionState() != RenderObject::HighlightState::None;
     if (!haveSelection && paintInfo.phase == PaintPhase::Selection) {
         // When only painting the selection, don't bother to paint if there is none.
         return;
@@ -685,14 +685,14 @@ unsigned InlineTextBox::clampedOffset(unsigned x) const
     return offset;
 }
 
-std::pair<unsigned, unsigned> InlineTextBox::clampedStartEndForState(unsigned start, unsigned end, RenderObject::SelectionState selectionState) const
+std::pair<unsigned, unsigned> InlineTextBox::clampedStartEndForState(unsigned start, unsigned end, RenderObject::HighlightState selectionState) const
 {
-    if (selectionState == RenderObject::SelectionInside)
+    if (selectionState == RenderObject::HighlightState::Inside)
         return { 0, clampedOffset(m_start + m_len) };
     
-    if (selectionState == RenderObject::SelectionStart)
+    if (selectionState == RenderObject::HighlightState::Start)
         end = renderer().text().length();
-    else if (selectionState == RenderObject::SelectionEnd)
+    else if (selectionState == RenderObject::HighlightState::End)
         start = 0;
     return { clampedOffset(start), clampedOffset(end) };
 }
@@ -704,12 +704,12 @@ std::pair<unsigned, unsigned> InlineTextBox::selectionStartEnd() const
     return clampedStartEndForState(renderer().view().selection().startOffset(), renderer().view().selection().endOffset(), selectionState);
 }
 
-std::pair<unsigned, unsigned> InlineTextBox::highlightStartEnd(SelectionRangeData &rangeData) const
+std::pair<unsigned, unsigned> InlineTextBox::highlightStartEnd(HighlightData &rangeData) const
 {
-    auto state = rangeData.selectionStateForRenderer(renderer());
+    auto state = rangeData.highlightStateForRenderer(renderer());
     state = verifySelectionState(state, rangeData);
     
-    if (state == RenderObject::SelectionNone)
+    if (state == RenderObject::HighlightState::None)
         return {0, 0};
     
     return clampedStartEndForState(rangeData.startOffset(), rangeData.endOffset(), state);
@@ -1055,8 +1055,8 @@ Vector<MarkedText> InlineTextBox::collectMarkedTextsForHighlights(TextPaintPhase
                 ASSERT(startOffset >= 0 && endOffset >= 0);
                 if (!startRenderer || !endRenderer)
                     continue;
-                auto highlightData = SelectionRangeData(renderer().view());
-                highlightData.setContext({startRenderer, endRenderer, static_cast<unsigned>(startOffset), static_cast<unsigned>(endOffset)});
+                auto highlightData = HighlightData(renderer().view());
+                highlightData.setRenderRange({startRenderer, endRenderer, static_cast<unsigned>(startOffset), static_cast<unsigned>(endOffset)});
                 auto [highlightStart, highlightEnd] = highlightStartEnd(highlightData);
                 if (highlightStart < highlightEnd)
                     markedTexts.append({ highlightStart, highlightEnd, MarkedText::Highlight, nullptr, highlight.key });
index 46218b6..42d7455 100644 (file)
@@ -121,7 +121,7 @@ public:
     virtual LayoutRect localSelectionRect(unsigned startPos, unsigned endPos) const;
     bool isSelected(unsigned startPosition, unsigned endPosition) const;
     std::pair<unsigned, unsigned> selectionStartEnd() const;
-    std::pair<unsigned, unsigned> highlightStartEnd(SelectionRangeData&) const;
+    std::pair<unsigned, unsigned> highlightStartEnd(HighlightData&) const;
 
 protected:
     void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;
@@ -134,11 +134,11 @@ private:
     void extractLine() final;
     void attachLine() final;
     
-    RenderObject::SelectionState verifySelectionState(RenderObject::SelectionState, SelectionRangeData&) const;
-    std::pair<unsigned, unsigned> clampedStartEndForState(unsigned, unsigned, RenderObject::SelectionState) const;
+    RenderObject::HighlightState verifySelectionState(RenderObject::HighlightState, HighlightData&) const;
+    std::pair<unsigned, unsigned> clampedStartEndForState(unsigned, unsigned, RenderObject::HighlightState) const;
 
 public:
-    RenderObject::SelectionState selectionState() final;
+    RenderObject::HighlightState selectionState() final;
 
 private:
     void clearTruncation() final { m_truncation = cNoTruncation; }
index 2f3fa95..ceacb85 100644 (file)
@@ -1400,7 +1400,7 @@ bool RenderBlock::shouldPaintSelectionGaps() const
     if (settings().selectionPaintingWithoutSelectionGapsEnabled())
         return false;
 
-    return selectionState() != SelectionNone && style().visibility() == Visibility::Visible && isSelectionRoot();
+    return selectionState() != HighlightState::None && style().visibility() == Visibility::Visible && isSelectionRoot();
 }
 
 bool RenderBlock::isSelectionRoot() const
@@ -1550,7 +1550,7 @@ GapRects RenderBlock::selectionGaps(RenderBlock& rootBlock, const LayoutPoint& r
         result = blockSelectionGaps(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, cache, paintInfo);
 
     // Fill the vertical gap all the way to the bottom of our block if the selection extends past our block.
-    if (&rootBlock == this && (selectionState() != SelectionBoth && selectionState() != SelectionEnd) && !isRubyBase() && !isRubyText()) {
+    if (&rootBlock == this && (selectionState() != HighlightState::Both && selectionState() != HighlightState::End) && !isRubyBase() && !isRubyText()) {
         result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock,
             lastLogicalTop, lastLogicalLeft, lastLogicalRight, logicalHeight(), cache, paintInfo));
     }
@@ -1571,7 +1571,7 @@ GapRects RenderBlock::blockSelectionGaps(RenderBlock& rootBlock, const LayoutPoi
 
     // Jump right to the first block child that contains some selected objects.
     RenderBox* curr;
-    for (curr = firstChildBox(); curr && curr->selectionState() == SelectionNone; curr = curr->nextSiblingBox()) { }
+    for (curr = firstChildBox(); curr && curr->selectionState() == HighlightState::None; curr = curr->nextSiblingBox()) { }
     
     if (!curr)
         return result;
@@ -1579,8 +1579,8 @@ GapRects RenderBlock::blockSelectionGaps(RenderBlock& rootBlock, const LayoutPoi
     LogicalSelectionOffsetCaches childCache(*this, cache);
 
     for (bool sawSelectionEnd = false; curr && !sawSelectionEnd; curr = curr->nextSiblingBox()) {
-        SelectionState childState = curr->selectionState();
-        if (childState == SelectionBoth || childState == SelectionEnd)
+        HighlightState childState = curr->selectionState();
+        if (childState == HighlightState::Both || childState == HighlightState::End)
             sawSelectionEnd = true;
 
         if (curr->isFloatingOrOutOfFlowPositioned())
@@ -1595,10 +1595,10 @@ GapRects RenderBlock::blockSelectionGaps(RenderBlock& rootBlock, const LayoutPoi
         }
 
         bool paintsOwnSelection = curr->shouldPaintSelectionGaps() || curr->isTable(); // FIXME: Eventually we won't special-case table like this.
-        bool fillBlockGaps = (paintsOwnSelection || (curr->canBeSelectionLeaf() && childState != SelectionNone)) && !isRubyBase() && !isRubyText();
+        bool fillBlockGaps = (paintsOwnSelection || (curr->canBeSelectionLeaf() && childState != HighlightState::None)) && !isRubyBase() && !isRubyText();
         if (fillBlockGaps) {
             // We need to fill the vertical gap above this object.
-            if (childState == SelectionEnd || childState == SelectionInside) {
+            if (childState == HighlightState::End || childState == HighlightState::Inside) {
                 // Fill the gap above the object.
                 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock,
                     lastLogicalTop, lastLogicalLeft, lastLogicalRight, curr->logicalTop(), cache, paintInfo));
@@ -1606,8 +1606,8 @@ GapRects RenderBlock::blockSelectionGaps(RenderBlock& rootBlock, const LayoutPoi
 
             // Only fill side gaps for objects that paint their own selection if we know for sure the selection is going to extend all the way *past*
             // our object.  We know this if the selection did not end inside our object.
-            if (paintsOwnSelection && (childState == SelectionStart || sawSelectionEnd))
-                childState = SelectionNone;
+            if (paintsOwnSelection && (childState == HighlightState::Start || sawSelectionEnd))
+                childState = HighlightState::None;
 
             // Fill side gaps on this object based off its state.
             bool leftGap, rightGap;
@@ -1624,7 +1624,7 @@ GapRects RenderBlock::blockSelectionGaps(RenderBlock& rootBlock, const LayoutPoi
             lastLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + curr->logicalBottom();
             lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, curr->logicalBottom(), cache);
             lastLogicalRight = logicalRightSelectionOffset(rootBlock, curr->logicalBottom(), cache);
-        } else if (childState != SelectionNone && is<RenderBlock>(*curr)) {
+        } else if (childState != HighlightState::None && is<RenderBlock>(*curr)) {
             // We must be a block that has some selected object inside it, so recur.
             result.unite(downcast<RenderBlock>(*curr).selectionGaps(rootBlock, rootBlockPhysicalPosition, LayoutSize(offsetFromRootBlock.width() + curr->x(), offsetFromRootBlock.height() + curr->y()),
                 lastLogicalTop, lastLogicalLeft, lastLogicalRight, childCache, paintInfo));
@@ -1688,15 +1688,11 @@ LayoutRect RenderBlock::logicalRightSelectionGap(RenderBlock& rootBlock, const L
     return gapRect;
 }
 
-void RenderBlock::getSelectionGapInfo(SelectionState state, bool& leftGap, bool& rightGap)
+void RenderBlock::getSelectionGapInfo(HighlightState state, bool& leftGap, bool& rightGap)
 {
     bool ltr = style().isLeftToRightDirection();
-    leftGap = (state == RenderObject::SelectionInside) ||
-              (state == RenderObject::SelectionEnd && ltr) ||
-              (state == RenderObject::SelectionStart && !ltr);
-    rightGap = (state == RenderObject::SelectionInside) ||
-               (state == RenderObject::SelectionStart && ltr) ||
-               (state == RenderObject::SelectionEnd && !ltr);
+    leftGap = (state == RenderObject::HighlightState::Inside) || (state == RenderObject::HighlightState::End && ltr) || (state == RenderObject::HighlightState::Start && !ltr);
+    rightGap = (state == RenderObject::HighlightState::Inside) || (state == RenderObject::HighlightState::Start && ltr) || (state == RenderObject::HighlightState::End && !ltr);
 }
 
 LayoutUnit RenderBlock::logicalLeftSelectionOffset(RenderBlock& rootBlock, LayoutUnit position, const LogicalSelectionOffsetCaches& cache)
index a051517..df019f7 100644 (file)
@@ -177,7 +177,7 @@ public:
         RenderBoxModelObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, LayoutUnit logicalHeight, const LogicalSelectionOffsetCaches&, const PaintInfo*);
     LayoutRect logicalRightSelectionGap(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
         RenderBoxModelObject* selObj, LayoutUnit logicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const LogicalSelectionOffsetCaches&, const PaintInfo*);
-    void getSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap);
+    void getSelectionGapInfo(HighlightState, bool& leftGap, bool& rightGap);
     bool isSelectionRoot() const;
 
     LayoutRect logicalRectToPhysicalRect(const LayoutPoint& physicalPosition, const LayoutRect& logicalRect);
index d1ca027..a555bd8 100644 (file)
@@ -3178,9 +3178,9 @@ Optional<int> RenderBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirecti
     return style().overflowY() == Overflow::Visible ? lastBaseline : std::min(boxHeight, lastBaseline);
 }
 
-void RenderBlockFlow::setSelectionState(SelectionState state)
+void RenderBlockFlow::setSelectionState(HighlightState state)
 {
-    if (state != SelectionNone)
+    if (state != HighlightState::None)
         ensureLineBoxes();
     RenderBoxModelObject::setSelectionState(state);
 }
@@ -3192,7 +3192,7 @@ GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock& rootBlock, const Layo
 
     GapRects result;
 
-    bool containsStart = selectionState() == SelectionStart || selectionState() == SelectionBoth;
+    bool containsStart = selectionState() == HighlightState::Start || selectionState() == HighlightState::Both;
 
     if (!hasLines()) {
         if (containsStart) {
@@ -3214,7 +3214,7 @@ GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock& rootBlock, const Layo
         LayoutUnit selHeight = curr->selectionHeightAdjustedForPrecedingBlock();
 
         if (!containsStart && !lastSelectedLine &&
-            selectionState() != SelectionStart && selectionState() != SelectionBoth && !isRubyBase())
+            selectionState() != HighlightState::Start && selectionState() != HighlightState::Both && !isRubyBase())
             result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, selTop, cache, paintInfo));
         
         LayoutRect logicalRect { LayoutUnit(curr->logicalLeft()), selTop, LayoutUnit(curr->logicalWidth()), selTop + selHeight };
@@ -3231,7 +3231,7 @@ GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock& rootBlock, const Layo
         // VisibleSelection must start just after our last line.
         lastSelectedLine = lastRootBox();
 
-    if (lastSelectedLine && selectionState() != SelectionEnd && selectionState() != SelectionBoth) {
+    if (lastSelectedLine && selectionState() != HighlightState::End && selectionState() != HighlightState::Both) {
         // Update our lastY to be the bottom of the last selected line.
         lastLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + lastSelectedLine->selectionBottom();
         lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, lastSelectedLine->selectionBottom(), cache);
index 277767d..b429b76 100644 (file)
@@ -559,7 +559,7 @@ private:
     int m_widthForTextAutosizing;
     unsigned m_lineCountForTextAutosizing : 2;
 #endif
-    void setSelectionState(SelectionState) final;
+    void setSelectionState(HighlightState) final;
 
 public:
     // FIXME-BLOCKFLOW: These can be made protected again once all callers have been moved here.
index 4dba07f..31efa5a 100644 (file)
@@ -129,14 +129,14 @@ static FirstLetterRemainingTextMap& firstLetterRemainingTextMap()
     return map;
 }
 
-void RenderBoxModelObject::setSelectionState(SelectionState state)
+void RenderBoxModelObject::setSelectionState(HighlightState state)
 {
-    if (state == SelectionInside && selectionState() != SelectionNone)
+    if (state == HighlightState::Inside && selectionState() != HighlightState::None)
         return;
 
-    if ((state == SelectionStart && selectionState() == SelectionEnd)
-        || (state == SelectionEnd && selectionState() == SelectionStart))
-        RenderLayerModelObject::setSelectionState(SelectionBoth);
+    if ((state == HighlightState::Start && selectionState() == HighlightState::End)
+        || (state == HighlightState::End && selectionState() == HighlightState::Start))
+        RenderLayerModelObject::setSelectionState(HighlightState::Both);
     else
         RenderLayerModelObject::setSelectionState(state);
 
index e60d3c2..ac593ca 100644 (file)
@@ -215,7 +215,7 @@ public:
 
     void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const override;
 
-    void setSelectionState(SelectionState) override;
+    void setSelectionState(HighlightState) override;
 
     bool canHaveBoxInfoInFragment() const { return !isFloating() && !isReplaced() && !isInline() && !isTableCell() && isRenderBlock() && !isRenderSVGBlock(); }
 
index 74090ae..4fd476b 100644 (file)
@@ -147,14 +147,14 @@ VisiblePosition RenderLineBreak::positionForPoint(const LayoutPoint&, const Rend
     return createVisiblePosition(0, DOWNSTREAM);
 }
 
-void RenderLineBreak::setSelectionState(SelectionState state)
+void RenderLineBreak::setSelectionState(HighlightState state)
 {
-    if (state != SelectionNone)
+    if (state != HighlightState::None)
         ensureLineBoxes();
     RenderBoxModelObject::setSelectionState(state);
     if (!m_inlineBoxWrapper)
         return;
-    m_inlineBoxWrapper->root().setHasSelectedChildren(state != SelectionNone);
+    m_inlineBoxWrapper->root().setHasSelectedChildren(state != HighlightState::None);
 }
 
 LayoutRect RenderLineBreak::localCaretRect(InlineBox* inlineBox, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine)
index edfeff5..2429f58 100644 (file)
@@ -68,7 +68,7 @@ private:
     int caretMaxOffset() const override;
     bool canBeSelectionLeaf() const override;
     LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine) override;
-    void setSelectionState(SelectionState) override;
+    void setSelectionState(HighlightState) override;
 
     LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode) const override;
     int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode) const override;
index ce019ba..6cb6280 100644 (file)
@@ -1147,7 +1147,7 @@ void RenderListMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
     if (isImage()) {
         if (RefPtr<Image> markerImage = m_image->image(this, markerRect.size()))
             context.drawImage(*markerImage, markerRect);
-        if (selectionState() != SelectionNone) {
+        if (selectionState() != HighlightState::None) {
             LayoutRect selRect = localSelectionRect();
             selRect.moveBy(boxOrigin);
             context.fillRect(snappedIntRect(selRect), m_listItem->selectionBackgroundColor());
@@ -1155,7 +1155,7 @@ void RenderListMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
         return;
     }
 
-    if (selectionState() != SelectionNone) {
+    if (selectionState() != HighlightState::None) {
         LayoutRect selRect = localSelectionRect();
         selRect.moveBy(boxOrigin);
         context.fillRect(snappedIntRect(selRect), m_listItem->selectionBackgroundColor());
@@ -1833,20 +1833,20 @@ FloatRect RenderListMarker::getRelativeMarkerRect()
     return relativeRect;
 }
 
-void RenderListMarker::setSelectionState(SelectionState state)
+void RenderListMarker::setSelectionState(HighlightState state)
 {
     // The selection state for our containing block hierarchy is updated by the base class call.
     RenderBox::setSelectionState(state);
 
     if (m_inlineBoxWrapper && canUpdateSelectionOnRootLineBoxes())
-        m_inlineBoxWrapper->root().setHasSelectedChildren(state != SelectionNone);
+        m_inlineBoxWrapper->root().setHasSelectedChildren(state != HighlightState::None);
 }
 
 LayoutRect RenderListMarker::selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent)
 {
     ASSERT(!needsLayout());
 
-    if (selectionState() == SelectionNone || !inlineBoxWrapper())
+    if (selectionState() == HighlightState::None || !inlineBoxWrapper())
         return LayoutRect();
 
     RootInlineBox& rootBox = inlineBoxWrapper()->root();
index 14304ae..69618c1 100644 (file)
@@ -72,7 +72,7 @@ private:
     bool isImage() const override;
     bool isText() const { return !isImage(); }
 
-    void setSelectionState(SelectionState) override;
+    void setSelectionState(HighlightState) override;
     LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent = true) override;
     bool canBeSelectionLeaf() const override { return true; }
 
index 3df455b..430f733 100644 (file)
@@ -1450,10 +1450,10 @@ RenderElement* RenderObject::container(const RenderLayerModelObject* repaintCont
 
 bool RenderObject::isSelectionBorder() const
 {
-    SelectionState st = selectionState();
-    return st == SelectionStart
-        || st == SelectionEnd
-        || st == SelectionBoth
+    HighlightState st = selectionState();
+    return st == HighlightState::Start
+        || st == HighlightState::End
+        || st == HighlightState::Both
         || view().selection().start() == this
         || view().selection().end() == this;
 }
index f5d69e9..28fa2ca 100644 (file)
@@ -64,7 +64,7 @@ class RenderLayerModelObject;
 class RenderFragmentContainer;
 class RenderTheme;
 class RenderTreeBuilder;
-class SelectionRangeData;
+class HighlightData;
 class TransformState;
 class VisiblePosition;
 
@@ -693,19 +693,19 @@ public:
 
     bool isFloatingOrOutOfFlowPositioned() const { return (isFloating() || isOutOfFlowPositioned()); }
 
-    enum SelectionState {
-        SelectionNone, // The object is not selected.
-        SelectionStart, // The object either contains the start of a selection run or is the start of a run
-        SelectionInside, // The object is fully encompassed by a selection run
-        SelectionEnd, // The object either contains the end of a selection run or is the end of a run
-        SelectionBoth // The object contains an entire run or is the sole selected object in that run
+    enum HighlightState {
+        None, // The object is not selected.
+        Start, // The object either contains the start of a selection run or is the start of a run
+        Inside, // The object is fully encompassed by a selection run
+        End, // The object either contains the end of a selection run or is the end of a run
+        Both // The object contains an entire run or is the sole selected object in that run
     };
 
     // The current selection state for an object.  For blocks, the state refers to the state of the leaf
-    // descendants (as described above in the SelectionState enum declaration).
-    SelectionState selectionState() const { return m_bitfields.selectionState(); }
-    virtual void setSelectionState(SelectionState state) { m_bitfields.setSelectionState(state); }
-    inline void setSelectionStateIfNeeded(SelectionState);
+    // descendants (as described above in the HighlightState enum declaration).
+    HighlightState selectionState() const { return m_bitfields.selectionState(); }
+    virtual void setSelectionState(HighlightState state) { m_bitfields.setSelectionState(state); }
+    inline void setSelectionStateIfNeeded(HighlightState);
     bool canUpdateSelectionOnRootLineBoxes();
 
     // A single rectangle that encompasses all of the selected objects within this object.  Used to determine the tightest
@@ -895,7 +895,7 @@ private:
             , m_childrenInline(false)
             , m_isExcludedFromNormalLayout(false)
             , m_positionedState(IsStaticallyPositioned)
-            , m_selectionState(SelectionNone)
+            , m_selectionState(HighlightState::None)
             , m_fragmentedFlowState(NotInsideFragmentedFlow)
             , m_boxDecorationState(NoBoxDecorations)
         {
@@ -951,8 +951,8 @@ private:
         }
         void clearPositionedState() { m_positionedState = static_cast<unsigned>(PositionType::Static); }
 
-        ALWAYS_INLINE SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
-        ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_selectionState = selectionState; }
+        ALWAYS_INLINE HighlightState selectionState() const { return static_cast<HighlightState>(m_selectionState); }
+        ALWAYS_INLINE void setSelectionState(HighlightState selectionState) { m_selectionState = selectionState; }
         
         ALWAYS_INLINE FragmentedFlowState fragmentedFlowState() const { return static_cast<FragmentedFlowState>(m_fragmentedFlowState); }
         ALWAYS_INLINE void setFragmentedFlowState(FragmentedFlowState fragmentedFlowState) { m_fragmentedFlowState = fragmentedFlowState; }
@@ -1067,7 +1067,7 @@ inline bool RenderObject::preservesNewline() const
     return style().preserveNewline();
 }
 
-inline void RenderObject::setSelectionStateIfNeeded(SelectionState state)
+inline void RenderObject::setSelectionStateIfNeeded(HighlightState state)
 {
     if (selectionState() == state)
         return;
index beccd39..3607467 100644 (file)
@@ -136,7 +136,7 @@ void RenderReplaced::intrinsicSizeChanged()
 
 bool RenderReplaced::shouldDrawSelectionTint() const
 {
-    return selectionState() != SelectionNone && !document().printing();
+    return selectionState() != HighlightState::None && !document().printing();
 }
 
 inline static bool draggedContentContainsReplacedElement(const Vector<RenderedDocumentMarker*>& markers, const Element& element)
@@ -206,7 +206,7 @@ void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
     
     bool drawSelectionTint = shouldDrawSelectionTint();
     if (paintInfo.phase == PaintPhase::Selection) {
-        if (selectionState() == SelectionNone)
+        if (selectionState() == HighlightState::None)
             return;
         drawSelectionTint = false;
     }
@@ -672,7 +672,7 @@ LayoutRect RenderReplaced::localSelectionRect(bool checkWhetherSelected) const
     return LayoutRect(newLogicalTop, 0_lu, rootBox.selectionHeight(), height());
 }
 
-void RenderReplaced::setSelectionState(SelectionState state)
+void RenderReplaced::setSelectionState(HighlightState state)
 {
     // The selection state for our containing block hierarchy is updated by the base class call.
     RenderBox::setSelectionState(state);
@@ -683,21 +683,21 @@ void RenderReplaced::setSelectionState(SelectionState state)
 
 bool RenderReplaced::isSelected() const
 {
-    SelectionState state = selectionState();
-    if (state == SelectionNone)
+    HighlightState state = selectionState();
+    if (state == HighlightState::None)
         return false;
-    if (state == SelectionInside)
+    if (state == HighlightState::Inside)
         return true;
 
     auto selectionStart = view().selection().startOffset();
     auto selectionEnd = view().selection().endOffset();
-    if (state == SelectionStart)
+    if (state == HighlightState::Start)
         return !selectionStart;
 
     unsigned end = element()->hasChildNodes() ? element()->countChildNodes() : 1;
-    if (state == SelectionEnd)
+    if (state == HighlightState::End)
         return selectionEnd == end;
-    if (state == SelectionBoth)
+    if (state == HighlightState::Both)
         return !selectionStart && selectionEnd == end;
     ASSERT_NOT_REACHED();
     return false;
index 2cf0b87..fc4c332 100644 (file)
@@ -55,7 +55,7 @@ protected:
 
     virtual LayoutUnit minimumReplacedHeight() const { return 0_lu; }
 
-    void setSelectionState(SelectionState) override;
+    void setSelectionState(HighlightState) override;
 
     bool isSelected() const;
 
index c88df5c..536f0e7 100644 (file)
@@ -35,7 +35,7 @@ class RenderSelectionInfoBase {
 public:
     explicit RenderSelectionInfoBase(RenderObject& renderer);
     RenderLayerModelObject* repaintContainer() const { return m_repaintContainer; }
-    RenderObject::SelectionState state() const { return m_state; }
+    RenderObject::HighlightState state() const { return m_state; }
 
 protected:
     void repaintRectangle(const LayoutRect& repaintRect);
@@ -44,7 +44,7 @@ protected:
     RenderLayerModelObject* m_repaintContainer;
 
 private:
-    RenderObject::SelectionState m_state;
+    RenderObject::HighlightState m_state;
 };
 
 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject.
index 4489090..426eca4 100644 (file)
@@ -1092,9 +1092,9 @@ IntPoint RenderText::firstRunLocation() const
     return IntPoint(first->rect().location());
 }
 
-void RenderText::setSelectionState(SelectionState state)
+void RenderText::setSelectionState(HighlightState state)
 {
-    if (state != SelectionNone)
+    if (state != HighlightState::None)
         ensureLineBoxes();
 
     RenderObject::setSelectionState(state);
@@ -1446,7 +1446,7 @@ LayoutRect RenderText::collectSelectionRectsForLineBoxes(const RenderLayerModelO
     ASSERT(!needsLayout());
     ASSERT(!simpleLineLayout());
 
-    if (selectionState() == SelectionNone)
+    if (selectionState() == HighlightState::None)
         return LayoutRect();
     if (!containingBlock())
         return LayoutRect();
@@ -1455,16 +1455,16 @@ LayoutRect RenderText::collectSelectionRectsForLineBoxes(const RenderLayerModelO
     // We include a selection while endPos > 0
     unsigned startOffset;
     unsigned endOffset;
-    if (selectionState() == SelectionInside) {
+    if (selectionState() == HighlightState::Inside) {
         // We are fully selected.
         startOffset = 0;
         endOffset = text().length();
     } else {
         startOffset = view().selection().startOffset();
         endOffset = view().selection().endOffset();
-        if (selectionState() == SelectionStart)
+        if (selectionState() == HighlightState::Start)
             endOffset = text().length();
-        else if (selectionState() == SelectionEnd)
+        else if (selectionState() == HighlightState::End)
             startOffset = 0;
     }
 
index 7c7a1d7..b080724 100644 (file)
@@ -207,7 +207,7 @@ private:
 
     VisiblePosition positionForPoint(const LayoutPoint&, const RenderFragmentContainer*) override;
 
-    void setSelectionState(SelectionState) final;
+    void setSelectionState(HighlightState) final;
     LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent = true) final;
     LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr) override;
     LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const final;
index 204dd64..5ee559c 100644 (file)
@@ -342,22 +342,22 @@ VisiblePosition RenderTextLineBoxes::positionForPoint(const RenderText& renderer
     return renderer.createVisiblePosition(0, DOWNSTREAM);
 }
 
-void RenderTextLineBoxes::setSelectionState(RenderText& renderer, RenderObject::SelectionState state)
+void RenderTextLineBoxes::setSelectionState(RenderText& renderer, RenderObject::HighlightState state)
 {
-    if (state == RenderObject::SelectionInside || state == RenderObject::SelectionNone) {
+    if (state == RenderObject::HighlightState::Inside || state == RenderObject::HighlightState::None) {
         for (auto* box = m_first; box; box = box->nextTextBox())
-            box->root().setHasSelectedChildren(state == RenderObject::SelectionInside);
+            box->root().setHasSelectedChildren(state == RenderObject::HighlightState::Inside);
         return;
     }
 
     auto start = renderer.view().selection().startOffset();
     auto end = renderer.view().selection().endOffset();
-    if (state == RenderObject::SelectionStart) {
+    if (state == RenderObject::HighlightState::Start) {
         end = renderer.text().length();
         // to handle selection from end of text to end of line
         if (start && start == end)
             start = end - 1;
-    } else if (state == RenderObject::SelectionEnd)
+    } else if (state == RenderObject::HighlightState::End)
         start = 0;
 
     for (auto* box = m_first; box; box = box->nextTextBox()) {
index e9a6605..2eb5dd3 100644 (file)
@@ -58,7 +58,7 @@ public:
 
     VisiblePosition positionForPoint(const RenderText&, const LayoutPoint&) const;
 
-    void setSelectionState(RenderText&, RenderObject::SelectionState);
+    void setSelectionState(RenderText&, RenderObject::HighlightState);
     LayoutRect selectionRectForRange(unsigned start, unsigned end);
     void collectSelectionRectsForRange(unsigned start, unsigned end, Vector<LayoutRect>& rects);
 
index 239fe20..b32e394 100644 (file)
@@ -2907,7 +2907,7 @@ bool RenderThemeMac::paintAttachment(const RenderObject& renderer, const PaintIn
     const RenderAttachment& attachment = downcast<RenderAttachment>(renderer);
 
     auto layoutStyle = AttachmentLayoutStyle::NonSelected;
-    if (attachment.selectionState() != RenderObject::SelectionNone && paintInfo.phase != PaintPhase::Selection)
+    if (attachment.selectionState() != RenderObject::HighlightState::None && paintInfo.phase != PaintPhase::Selection)
         layoutStyle = AttachmentLayoutStyle::Selected;
 
     AttachmentLayout layout(attachment, layoutStyle);
index 1842b30..1fb7dfb 100644 (file)
 #pragma once
 
 #include "FrameView.h"
+#include "HighlightData.h"
 #include "Region.h"
 #include "RenderBlockFlow.h"
 #include "RenderWidget.h"
-#include "SelectionRangeData.h"
 #include <memory>
 #include <wtf/HashSet.h>
 #include <wtf/ListHashSet.h>
@@ -78,7 +78,7 @@ public:
     // Return the renderer whose background style is used to paint the root background.
     RenderElement* rendererForRootBackground() const;
 
-    SelectionRangeData& selection() { return m_selection; }
+    HighlightData& selection() { return m_selection; }
 
     bool printing() const;
 
@@ -220,7 +220,7 @@ private:
     uint64_t m_rendererCount { 1 };
 
     mutable std::unique_ptr<Region> m_accumulatedRepaintRegion;
-    SelectionRangeData m_selection;
+    HighlightData m_selection;
 
     WeakPtr<RenderLayer> m_styleChangeLayerMutationRoot;
 
index 7d77538..3f6f33b 100644 (file)
@@ -346,7 +346,7 @@ IntRect RenderWidget::windowClipRect() const
     return intersection(view().frameView().contentsToWindow(m_clipRect), view().frameView().windowClipRect());
 }
 
-void RenderWidget::setSelectionState(SelectionState state)
+void RenderWidget::setSelectionState(HighlightState state)
 {
     // The selection state for our containing block hierarchy is updated by the base class call.
     RenderReplaced::setSelectionState(state);
index 8ae3d2c..370096f 100644 (file)
@@ -93,7 +93,7 @@ private:
     bool needsPreferredWidthsRecalculation() const final;
     RenderBox* embeddedContentBox() const final;
 
-    void setSelectionState(SelectionState) final;
+    void setSelectionState(HighlightState) final;
     void setOverlapTestResult(bool) final;
 
     bool setWidgetGeometry(const LayoutRect&);
index 78c1a0e..3649263 100644 (file)
@@ -423,7 +423,7 @@ LayoutUnit RootInlineBox::lineSnapAdjustment(LayoutUnit delta) const
 GapRects RootInlineBox::lineSelectionGap(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     LayoutUnit selTop, LayoutUnit selHeight, const LogicalSelectionOffsetCaches& cache, const PaintInfo* paintInfo)
 {
-    RenderObject::SelectionState lineState = selectionState();
+    RenderObject::HighlightState lineState = selectionState();
 
     bool leftGap, rightGap;
     blockFlow().getSelectionGapInfo(lineState, leftGap, rightGap);
@@ -451,9 +451,9 @@ GapRects RootInlineBox::lineSelectionGap(RenderBlock& rootBlock, const LayoutPoi
     if (firstBox && firstBox != lastBox) {
         // Now fill in any gaps on the line that occurred between two selected elements.
         LayoutUnit lastLogicalLeft { firstBox->logicalRight() };
-        bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::SelectionNone;
+        bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject::HighlightState::None;
         for (InlineBox* box = firstBox->nextLeafOnLine(); box; box = box->nextLeafOnLine()) {
-            if (box->selectionState() != RenderObject::SelectionNone) {
+            if (box->selectionState() != RenderObject::HighlightState::None) {
                 LayoutRect logicalRect { lastLogicalLeft, selTop, LayoutUnit(box->logicalLeft() - lastLogicalLeft), selHeight };
                 logicalRect.move(renderer().isHorizontalWritingMode() ? offsetFromRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.width()));
                 LayoutRect gapRect = rootBlock.logicalRectToPhysicalRect(rootBlockPhysicalPosition, logicalRect);
@@ -467,7 +467,7 @@ GapRects RootInlineBox::lineSelectionGap(RenderBlock& rootBlock, const LayoutPoi
             }
             if (box == lastBox)
                 break;
-            isPreviousBoxSelected = box->selectionState() != RenderObject::SelectionNone;
+            isPreviousBoxSelected = box->selectionState() != RenderObject::HighlightState::None;
         }
     }
 
@@ -527,24 +527,23 @@ IntRect RootInlineBox::computeCaretRect(float logicalLeftPosition, unsigned care
     return blockStyle.isHorizontalWritingMode() ? IntRect(left, top, caretWidth, height) : IntRect(top, left, height, caretWidth);
 }
 
-RenderObject::SelectionState RootInlineBox::selectionState()
+RenderObject::HighlightState RootInlineBox::selectionState()
 {
     // Walk over all of the selected boxes.
-    RenderObject::SelectionState state = RenderObject::SelectionNone;
+    RenderObject::HighlightState state = RenderObject::HighlightState::None;
     for (InlineBox* box = firstLeafDescendant(); box; box = box->nextLeafOnLine()) {
-        RenderObject::SelectionState boxState = box->selectionState();
-        if ((boxState == RenderObject::SelectionStart && state == RenderObject::SelectionEnd) ||
-            (boxState == RenderObject::SelectionEnd && state == RenderObject::SelectionStart))
-            state = RenderObject::SelectionBoth;
-        else if (state == RenderObject::SelectionNone ||
-                 ((boxState == RenderObject::SelectionStart || boxState == RenderObject::SelectionEnd) &&
-                  (state == RenderObject::SelectionNone || state == RenderObject::SelectionInside)))
+        RenderObject::HighlightState boxState = box->selectionState();
+        if ((boxState == RenderObject::HighlightState::Start && state == RenderObject::HighlightState::End)
+            || (boxState == RenderObject::HighlightState::End && state == RenderObject::HighlightState::Start))
+            state = RenderObject::HighlightState::Both;
+        else if (state == RenderObject::HighlightState::None || ((boxState == RenderObject::HighlightState::Start || boxState == RenderObject::HighlightState::End)
+            && (state == RenderObject::HighlightState::None || state == RenderObject::HighlightState::Inside)))
             state = boxState;
-        else if (boxState == RenderObject::SelectionNone && state == RenderObject::SelectionStart) {
+        else if (boxState == RenderObject::HighlightState::None && state == RenderObject::HighlightState::Start) {
             // We are past the end of the selection.
-            state = RenderObject::SelectionBoth;
+            state = RenderObject::HighlightState::Both;
         }
-        if (state == RenderObject::SelectionBoth)
+        if (state == RenderObject::HighlightState::Both)
             break;
     }
 
@@ -554,7 +553,7 @@ RenderObject::SelectionState RootInlineBox::selectionState()
 InlineBox* RootInlineBox::firstSelectedBox()
 {
     for (auto* box = firstLeafDescendant(); box; box = box->nextLeafOnLine()) {
-        if (box->selectionState() != RenderObject::SelectionNone)
+        if (box->selectionState() != RenderObject::HighlightState::None)
             return box;
     }
     return nullptr;
@@ -563,7 +562,7 @@ InlineBox* RootInlineBox::firstSelectedBox()
 InlineBox* RootInlineBox::lastSelectedBox()
 {
     for (auto* box = lastLeafDescendant(); box; box = box->previousLeafOnLine()) {
-        if (box->selectionState() != RenderObject::SelectionNone)
+        if (box->selectionState() != RenderObject::HighlightState::None)
             return box;
     }
     return nullptr;
@@ -664,7 +663,7 @@ LayoutUnit RootInlineBox::selectionTopAdjustedForPrecedingBlock() const
     LayoutUnit top = selectionTop();
 
     auto blockSelectionState = rootBox.blockFlow().selectionState();
-    if (blockSelectionState != RenderObject::SelectionInside && blockSelectionState != RenderObject::SelectionEnd)
+    if (blockSelectionState != RenderObject::HighlightState::Inside && blockSelectionState != RenderObject::HighlightState::End)
         return top;
 
     LayoutSize offsetToBlockBefore;
@@ -677,8 +676,8 @@ LayoutUnit RootInlineBox::selectionTopAdjustedForPrecedingBlock() const
         return top;
 
     if (auto* lastLine = downcast<RenderBlockFlow>(*blockBefore).lastRootBox()) {
-        RenderObject::SelectionState lastLineSelectionState = lastLine->selectionState();
-        if (lastLineSelectionState != RenderObject::SelectionInside && lastLineSelectionState != RenderObject::SelectionStart)
+        RenderObject::HighlightState lastLineSelectionState = lastLine->selectionState();
+        if (lastLineSelectionState != RenderObject::HighlightState::Inside && lastLineSelectionState != RenderObject::HighlightState::Start)
             return top;
 
         LayoutUnit lastLineSelectionBottom = lastLine->selectionBottom() + offsetToBlockBefore.height();
index 247e55c..f8976c6 100644 (file)
@@ -126,7 +126,7 @@ public:
     using InlineBox::hasSelectedChildren;
     using InlineBox::setHasSelectedChildren;
 
-    RenderObject::SelectionState selectionState() final;
+    RenderObject::HighlightState selectionState() final;
     InlineBox* firstSelectedBox();
     InlineBox* lastSelectedBox();
 
index f10dc0b..7ad4e19 100644 (file)
@@ -307,7 +307,7 @@ AvoidanceReasonFlags canUseForWithReason(const RenderBlockFlow& flow, IncludeRea
     // This currently covers <blockflow>#text</blockflow>, <blockflow>#text<br></blockflow> and mutiple (sibling) RenderText cases.
     // The <blockflow><inline>#text</inline></blockflow> case is also popular and should be relatively easy to cover.
     for (const auto* child = flow.firstChild(); child;) {
-        if (child->selectionState() != RenderObject::SelectionNone)
+        if (child->selectionState() != RenderObject::HighlightState::None)
             SET_REASON_AND_RETURN_IF_NEEDED(FlowChildIsSelected, reasons, includeReasons);
         if (is<RenderText>(*child)) {
             const auto& renderText = downcast<RenderText>(*child);
index 55c2b79..fcedb3b 100644 (file)
@@ -189,7 +189,7 @@ void SVGInlineTextBox::paintSelectionBackground(PaintInfo& paintInfo)
 
     // Determine whether or not we're selected.
     bool paintSelectedTextOnly = paintInfo.phase == PaintPhase::Selection;
-    bool hasSelection = selectionState() != RenderObject::SelectionNone;
+    bool hasSelection = selectionState() != RenderObject::HighlightState::None;
     if (!hasSelection || paintSelectedTextOnly)
         return;
 
@@ -247,7 +247,7 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
 
     bool paintSelectedTextOnly = paintInfo.phase == PaintPhase::Selection;
     bool shouldPaintSelectionHighlight = !(paintInfo.paintBehavior.contains(PaintBehavior::SkipSelectionHighlight));
-    bool hasSelection = !parentRenderer.document().printing() && selectionState() != RenderObject::SelectionNone;
+    bool hasSelection = !parentRenderer.document().printing() && selectionState() != RenderObject::HighlightState::None;
     if (!hasSelection && paintSelectedTextOnly)
         return;
 
index bf5f3ad..ff219e9 100644 (file)
@@ -55,7 +55,7 @@ void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
     ASSERT(!paintInfo.context().paintingDisabled());
 
     bool isPrinting = renderSVGText().document().printing();
-    bool hasSelection = !isPrinting && selectionState() != RenderObject::SelectionNone;
+    bool hasSelection = !isPrinting && selectionState() != RenderObject::HighlightState::None;
     bool shouldPaintSelectionHighlight = !(paintInfo.paintBehavior.contains(PaintBehavior::SkipSelectionHighlight));
 
     PaintInfo childPaintInfo(paintInfo);