зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1314080 Part 1: Rename CollectClientRects method and add a new parameter for collecting text. r=smaug
MozReview-Commit-ID: KQPky6Fh8sG --HG-- extra : rebase_source : 33bce65c1752aeb7a2225a981f2dadf7e2ce5916
This commit is contained in:
Родитель
2ec1fbff6c
Коммит
1e29a9cf1c
|
@ -30,6 +30,7 @@
|
|||
#include "mozilla/dom/DocumentType.h"
|
||||
#include "mozilla/dom/RangeBinding.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include "mozilla/dom/DOMStringList.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
@ -2930,11 +2931,12 @@ static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback,
|
|||
}
|
||||
|
||||
/* static */ void
|
||||
nsRange::CollectClientRects(nsLayoutUtils::RectCallback* aCollector,
|
||||
nsRange* aRange,
|
||||
nsINode* aStartParent, int32_t aStartOffset,
|
||||
nsINode* aEndParent, int32_t aEndOffset,
|
||||
bool aClampToEdge, bool aFlushLayout)
|
||||
nsRange::CollectClientRectsAndText(nsLayoutUtils::RectCallback* aCollector,
|
||||
mozilla::dom::DOMStringList* aTextList,
|
||||
nsRange* aRange,
|
||||
nsINode* aStartParent, int32_t aStartOffset,
|
||||
nsINode* aEndParent, int32_t aEndOffset,
|
||||
bool aClampToEdge, bool aFlushLayout)
|
||||
{
|
||||
// Hold strong pointers across the flush
|
||||
nsCOMPtr<nsINode> startContainer = aStartParent;
|
||||
|
@ -3027,8 +3029,8 @@ nsRange::GetBoundingClientRect(bool aClampToEdge, bool aFlushLayout)
|
|||
}
|
||||
|
||||
nsLayoutUtils::RectAccumulator accumulator;
|
||||
CollectClientRects(&accumulator, this, mStartParent, mStartOffset,
|
||||
mEndParent, mEndOffset, aClampToEdge, aFlushLayout);
|
||||
CollectClientRectsAndText(&accumulator, nullptr, this, mStartParent,
|
||||
mStartOffset, mEndParent, mEndOffset, aClampToEdge, aFlushLayout);
|
||||
|
||||
nsRect r = accumulator.mResultRect.IsEmpty() ? accumulator.mFirstRect :
|
||||
accumulator.mResultRect;
|
||||
|
@ -3055,8 +3057,8 @@ nsRange::GetClientRects(bool aClampToEdge, bool aFlushLayout)
|
|||
|
||||
nsLayoutUtils::RectListBuilder builder(rectList);
|
||||
|
||||
CollectClientRects(&builder, this, mStartParent, mStartOffset,
|
||||
mEndParent, mEndOffset, aClampToEdge, aFlushLayout);
|
||||
CollectClientRectsAndText(&builder, nullptr, this, mStartParent,
|
||||
mStartOffset, mEndParent, mEndOffset, aClampToEdge, aFlushLayout);
|
||||
return rectList.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -263,11 +263,16 @@ public:
|
|||
static bool IsNodeSelected(nsINode* aNode, uint32_t aStartOffset,
|
||||
uint32_t aEndOffset);
|
||||
|
||||
static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector,
|
||||
nsRange* aRange,
|
||||
nsINode* aStartParent, int32_t aStartOffset,
|
||||
nsINode* aEndParent, int32_t aEndOffset,
|
||||
bool aClampToEdge, bool aFlushLayout);
|
||||
/**
|
||||
* This helper function gets rects and correlated text for the given range.
|
||||
* @param aTextList optional where nullptr = don't retrieve text
|
||||
*/
|
||||
static void CollectClientRectsAndText(nsLayoutUtils::RectCallback* aCollector,
|
||||
mozilla::dom::DOMStringList* aTextList,
|
||||
nsRange* aRange,
|
||||
nsINode* aStartParent, int32_t aStartOffset,
|
||||
nsINode* aEndParent, int32_t aEndOffset,
|
||||
bool aClampToEdge, bool aFlushLayout);
|
||||
|
||||
/**
|
||||
* Scan this range for -moz-user-select:none nodes and split it up into
|
||||
|
|
|
@ -8869,7 +8869,7 @@ nsLayoutUtils::GetSelectionBoundingRect(Selection* aSel)
|
|||
RectAccumulator accumulator;
|
||||
for (int32_t idx = 0; idx < rangeCount; ++idx) {
|
||||
nsRange* range = aSel->GetRangeAt(idx);
|
||||
nsRange::CollectClientRects(&accumulator, range,
|
||||
nsRange::CollectClientRectsAndText(&accumulator, nullptr, range,
|
||||
range->GetStartParent(), range->StartOffset(),
|
||||
range->GetEndParent(), range->EndOffset(),
|
||||
true, false);
|
||||
|
|
|
@ -5886,7 +5886,7 @@ Selection::ContainsPoint(const nsPoint& aPoint)
|
|||
PointInRectChecker checker(aPoint);
|
||||
for (uint32_t i = 0; i < RangeCount(); i++) {
|
||||
nsRange* range = GetRangeAt(i);
|
||||
nsRange::CollectClientRects(&checker, range,
|
||||
nsRange::CollectClientRectsAndText(&checker, nullptr, range,
|
||||
range->GetStartParent(), range->StartOffset(),
|
||||
range->GetEndParent(), range->EndOffset(),
|
||||
true, false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче