Bug 1481292 - part 1: Get rid of ContentEventHandler::GetNodePositionHavingFlatText() because of unused r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 07 Aug 2018 13:50:23 +0000
changeset 430450 43373390fa8dc93e0535ed6661665be963888809
parent 430449 431c15d94478f0362b43d18f0ebec0ab82dbdc0a
child 430451 fcf0193311b07f01b62eaa3c0aa53606ce5c5deb
push id34405
push userncsoregi@mozilla.com
push dateWed, 08 Aug 2018 09:57:26 +0000
treeherdermozilla-central@c65991f3fa10 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1481292
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1481292 - part 1: Get rid of ContentEventHandler::GetNodePositionHavingFlatText() because of unused r=smaug ContentEventHandler::GetNodePositionHavingFlatText() is not used by anybody. So, we should just get rid of it. Differential Revision: https://phabricator.services.mozilla.com/D2842
dom/events/ContentEventHandler.cpp
dom/events/ContentEventHandler.h
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -1556,60 +1556,16 @@ ContentEventHandler::EnsureNonEmptyRect(
 
 void
 ContentEventHandler::EnsureNonEmptyRect(LayoutDeviceIntRect& aRect) const
 {
   aRect.height = std::max(1, aRect.height);
   aRect.width = std::max(1, aRect.width);
 }
 
-ContentEventHandler::NodePosition
-ContentEventHandler::GetNodePositionHavingFlatText(
-                       const NodePosition& aNodePosition)
-{
-  return GetNodePositionHavingFlatText(aNodePosition.Container(),
-                                       aNodePosition.Offset());
-}
-
-ContentEventHandler::NodePosition
-ContentEventHandler::GetNodePositionHavingFlatText(nsINode* aNode,
-                                                   int32_t aNodeOffset)
-{
-  if (aNode->IsText()) {
-    return NodePosition(aNode, aNodeOffset);
-  }
-
-  int32_t childCount = static_cast<int32_t>(aNode->GetChildCount());
-
-  // If it's a empty element node, returns itself.
-  if (!childCount) {
-    MOZ_ASSERT(!aNodeOffset || aNodeOffset == 1);
-    return NodePosition(aNode, aNodeOffset);
-  }
-
-  // If there is a node at given position, return the start of it.
-  if (aNodeOffset < childCount) {
-    return NodePosition(aNode->GetChildAt_Deprecated(aNodeOffset), 0);
-  }
-
-  // If the offset represents "after" the node, we need to return the last
-  // child of it.  For example, if a range is |<p>[<br>]</p>|, then, the
-  // end point is {<p>, 1}.  In such case, callers need the <br> node.
-  if (aNodeOffset == childCount) {
-    nsINode* node = aNode->GetChildAt_Deprecated(childCount - 1);
-    return NodePosition(node,
-      node->IsText()
-        ? static_cast<int32_t>(node->AsContent()->TextLength())
-        : 1);
-  }
-
-  NS_WARNING("aNodeOffset is invalid value");
-  return NodePosition();
-}
-
 ContentEventHandler::FrameAndNodeOffset
 ContentEventHandler::GetFirstFrameInRangeForTextRect(const RawRange& aRawRange)
 {
   NodePosition nodePosition;
   nsCOMPtr<nsIContentIterator> iter = NS_NewPreContentIterator();
   nsresult rv =
     iter->Init(aRawRange.Start().AsRaw(), aRawRange.End().AsRaw());
   if (NS_WARN_IF(NS_FAILED(rv))) {
--- a/dom/events/ContentEventHandler.h
+++ b/dom/events/ContentEventHandler.h
@@ -355,21 +355,16 @@ protected:
   nsresult GenerateFlatFontRanges(const RawRange& aRawRange,
                                   FontRangeArray& aFontRanges,
                                   uint32_t& aLength,
                                   LineBreakType aLineBreakType);
   nsresult QueryTextRectByRange(const RawRange& aRawRange,
                                 LayoutDeviceIntRect& aRect,
                                 WritingMode& aWritingMode);
 
-  // Returns a node and position in the node for computing text rect.
-  NodePosition GetNodePositionHavingFlatText(const NodePosition& aNodePosition);
-  NodePosition GetNodePositionHavingFlatText(nsINode* aNode,
-                                             int32_t aNodeOffset);
-
   struct MOZ_STACK_CLASS FrameAndNodeOffset final
   {
     // mFrame is safe since this can live in only stack class and
     // ContentEventHandler doesn't modify layout after
     // ContentEventHandler::Init() flushes pending layout.  In other words,
     // this struct shouldn't be used before calling
     // ContentEventHandler::Init().
     nsIFrame* mFrame;