RESOLVED FIXED 211306
Change HitTestResult::NodeSet from set of RefPtrs to set of Refs
https://bugs.webkit.org/show_bug.cgi?id=211306
Summary Change HitTestResult::NodeSet from set of RefPtrs to set of Refs
Daniel Bates
Reported 2020-05-01 11:52:59 PDT
Change HitTestResult::NodeSet from set of RefPtrs to set of Refs because the set never contains nullptrs.
Attachments
Patch (14.13 KB, patch)
2020-05-01 12:02 PDT, Daniel Bates
no flags
Daniel Bates
Comment 1 2020-05-01 12:02:21 PDT
Daniel Bates
Comment 2 2020-05-01 15:02:02 PDT
Comment on attachment 398212 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398212&action=review > Source/WebCore/ChangeLog:14 > + required me to fix up caretRangeFromPoint(), which lead me to fix up nodeFromPoint() as well. lead => led
Simon Fraser (smfr)
Comment 3 2020-05-01 15:04:40 PDT
Comment on attachment 398212 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398212&action=review > Source/WebCore/dom/TreeScope.cpp:406 > + RefPtr<Node> node = retargetToScope(listBasedNode); auto?
Daniel Bates
Comment 4 2020-05-01 15:09:51 PDT
Comment on attachment 398212 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398212&action=review Thanks for the review, Simon. >> Source/WebCore/dom/TreeScope.cpp:406 >> + RefPtr<Node> node = retargetToScope(listBasedNode); > > auto? Intentional; I need a RefPtr from a Ref. I think the new hotness is makeRefPtr(). So, I do that an allow one user-defined conversion.
Daniel Bates
Comment 5 2020-05-01 15:14:58 PDT
Comment on attachment 398212 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398212&action=review >>> Source/WebCore/dom/TreeScope.cpp:406 >>> + RefPtr<Node> node = retargetToScope(listBasedNode); >> >> auto? > > Intentional; I need a RefPtr from a Ref. I think the new hotness is makeRefPtr(). So, I do that an allow one user-defined conversion. Nope, compiler is not happy with makeRefPtr(). makeRefPtr() expects an l-value. I could fix this.... though it's turned me off on using makeRefPtr(). Going to do what I have now.
Daniel Bates
Comment 6 2020-05-01 15:16:23 PDT
Comment on attachment 398212 [details] Patch Clearing flags on attachment: 398212 Committed r261028: <https://trac.webkit.org/changeset/261028>
Daniel Bates
Comment 7 2020-05-01 15:16:27 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2020-05-01 15:17:15 PDT
Darin Adler
Comment 9 2020-05-01 18:10:37 PDT
Comment on attachment 398212 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398212&action=review > Source/WebCore/rendering/HitTestResult.cpp:103 > - m_listBasedTestResult = other.m_listBasedTestResult ? makeUnique<NodeSet>(*other.m_listBasedTestResult) : nullptr; > + if (other.m_listBasedTestResult) { > + m_listBasedTestResult = makeUnique<NodeSet>(); > + appendToNodeSet(*other.m_listBasedTestResult, *m_listBasedTestResult); > + } This code is definitely getting worse. The fact that you can’t copy a Ref stinks. It was a well meaning decision originally, but it leads to bad stuff like this. > Source/WebCore/rendering/HitTestResult.cpp:123 > - m_listBasedTestResult = other.m_listBasedTestResult ? makeUnique<NodeSet>(*other.m_listBasedTestResult) : nullptr; > + if (other.m_listBasedTestResult) { > + m_listBasedTestResult = makeUnique<NodeSet>(); > + appendToNodeSet(*other.m_listBasedTestResult, *m_listBasedTestResult); > + } Ditto.
Note You need to log in before you can comment on or make changes to this bug.