Bug 1314080 Part 2: Expand GetPartialTextRect with a new text collecting parameter. r?smaug draft
authorBrad Werth <bwerth@mozilla.com>
Wed, 02 Nov 2016 12:07:49 -0700
changeset 433444 674b7dfa5e93ad3236e87113016146c63bf14706
parent 433443 ae4cb34a4bd753f6cb10a624e9ccb9cce8484e78
child 433445 c4ad1f2d6f24d11cb5e5783bc07729d8bb600153
push id34574
push userbwerth@mozilla.com
push dateThu, 03 Nov 2016 17:53:35 +0000
reviewerssmaug
bugs1314080
milestone52.0a1
Bug 1314080 Part 2: Expand GetPartialTextRect with a new text collecting parameter. r?smaug MozReview-Commit-ID: 6eEDFFwKh0c
dom/base/nsRange.cpp
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -2893,16 +2893,17 @@ GetTextFrameForContent(nsIContent* aCont
     if (frame && frame->GetType() == nsGkAtoms::textFrame) {
       return static_cast<nsTextFrame*>(frame);
     }
   }
   return nullptr;
 }
 
 static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback,
+                                   mozilla::dom::DOMStringList* aTextList,
                                    nsIContent* aContent, int32_t aStartOffset,
                                    int32_t aEndOffset, bool aClampToEdge,
                                    bool aFlushLayout)
 {
   nsTextFrame* textFrame = GetTextFrameForContent(aContent, aFlushLayout);
   if (textFrame) {
     nsIFrame* relativeTo = nsLayoutUtils::GetContainingBlockForClientRect(textFrame);
     for (nsTextFrame* f = textFrame; f; f = static_cast<nsTextFrame*>(f->GetNextContinuation())) {
@@ -2989,21 +2990,21 @@ nsRange::CollectClientRectsAndText(nsLay
     iter.Next();
     nsCOMPtr<nsIContent> content = do_QueryInterface(node);
     if (!content)
       continue;
     if (content->IsNodeOfType(nsINode::eTEXT)) {
        if (node == startContainer) {
          int32_t offset = startContainer == endContainer ?
            aEndOffset : content->GetText()->GetLength();
-         GetPartialTextRect(aCollector, content, aStartOffset, offset,
+         GetPartialTextRect(aCollector, aTextList, content, aStartOffset, offset,
                             aClampToEdge, aFlushLayout);
          continue;
        } else if (node == endContainer) {
-         GetPartialTextRect(aCollector, content, 0, aEndOffset,
+         GetPartialTextRect(aCollector, aTextList, content, 0, aEndOffset,
                             aClampToEdge, aFlushLayout);
          continue;
        }
     }
 
     nsIFrame* frame = content->GetPrimaryFrame();
     if (frame) {
       nsLayoutUtils::GetAllInFlowRects(frame,