зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1048752. Part 18: Add nsCaret::SchedulePaint. r=tn
We'll use this later. --HG-- extra : rebase_source : e2d81ec006718d1c91b47978c16df0bffd42ff5b
This commit is contained in:
Родитель
0a6d04586e
Коммит
3c5e54cdcc
|
@ -41,6 +41,7 @@ static const int32_t kMinBidiIndicatorPixels = 2;
|
|||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
/**
|
||||
* Find the first frame in an in-order traversal of the frame subtree rooted
|
||||
|
@ -370,6 +371,28 @@ nsCaret::GetGeometry(nsISelection* aSelection, nsRect* aRect)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Selection*
|
||||
nsCaret::GetSelectionInternal()
|
||||
{
|
||||
return static_cast<Selection*>(GetSelection());
|
||||
}
|
||||
|
||||
void nsCaret::SchedulePaint()
|
||||
{
|
||||
nsINode* focusNode = mLastContent ?
|
||||
mLastContent.get() : GetSelectionInternal()->GetFocusNode();
|
||||
if (!focusNode || !focusNode->IsContent()) {
|
||||
return;
|
||||
}
|
||||
nsIFrame* f = focusNode->AsContent()->GetPrimaryFrame();
|
||||
if (!f) {
|
||||
return;
|
||||
}
|
||||
// This may not be the correct continuation frame, but that's OK since we're
|
||||
// just scheduling a paint of the window (or popup).
|
||||
f->SchedulePaint();
|
||||
}
|
||||
|
||||
void nsCaret::DrawCaretAfterBriefDelay()
|
||||
{
|
||||
// Make sure readonly caret gets drawn again if it needs to be
|
||||
|
@ -1100,11 +1123,7 @@ void nsCaret::CaretBlinkCallback(nsITimer *aTimer, void *aClosure)
|
|||
nsFrameSelection*
|
||||
nsCaret::GetFrameSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelection> sel = do_QueryReferent(mDomSelectionWeak);
|
||||
if (!sel)
|
||||
return nullptr;
|
||||
|
||||
return static_cast<dom::Selection*>(sel.get())->GetFrameSelection();
|
||||
return GetSelectionInternal()->GetFrameSelection();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -169,6 +169,10 @@ class nsCaret : public nsISelectionListener
|
|||
protected:
|
||||
static void CaretBlinkCallback(nsITimer *aTimer, void *aClosure);
|
||||
|
||||
// Schedule a repaint for the frame where the caret would appear.
|
||||
// Does not check visibility etc.
|
||||
void SchedulePaint();
|
||||
|
||||
void KillTimer();
|
||||
nsresult PrimeTimer();
|
||||
|
||||
|
@ -181,6 +185,8 @@ protected:
|
|||
uint8_t aBidiLevel,
|
||||
bool aInvalidate);
|
||||
|
||||
mozilla::dom::Selection* GetSelectionInternal();
|
||||
|
||||
struct Metrics {
|
||||
nscoord mBidiIndicatorSize; // width and height of bidi indicator
|
||||
nscoord mCaretWidth; // full caret width including bidi indicator
|
||||
|
@ -220,8 +226,6 @@ protected:
|
|||
// 3. The caret selection is empty.
|
||||
bool IsMenuPopupHidingCaret();
|
||||
|
||||
protected:
|
||||
|
||||
nsWeakPtr mPresShell;
|
||||
nsWeakPtr mDomSelectionWeak;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче