mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1048752. Part 2: Remove InvalidateOutsideCaret and MaybeInvalidateCaretPosition. r=tn
I'm quite sure DLBI means we don't need these anymore. --HG-- extra : rebase_source : 6cb6cd7c160a46688793c6ab1cdded333aecdd61
This commit is contained in:
parent
390b776bf9
commit
96dcfbdcd0
@ -762,12 +762,6 @@ NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak()
|
||||
nsRefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// Batching the selection and moving nodes out from under the caret causes
|
||||
// caret turds. Ask the shell to invalidate the caret now to avoid the turds.
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_NOT_INITIALIZED);
|
||||
shell->MaybeInvalidateCaretPosition();
|
||||
|
||||
nsTextRulesInfo ruleInfo(EditAction::insertBreak);
|
||||
ruleInfo.maxLength = mMaxTextLength;
|
||||
bool cancel, handled;
|
||||
|
@ -457,16 +457,6 @@ nsIFrame * nsCaret::GetCaretFrame(int32_t *aOffset)
|
||||
return frame;
|
||||
}
|
||||
|
||||
void nsCaret::InvalidateOutsideCaret()
|
||||
{
|
||||
nsIFrame *frame = GetCaretFrame();
|
||||
|
||||
// Only invalidate if we are not fully contained by our frame's rect.
|
||||
if (frame && !frame->GetVisualOverflowRect().Contains(GetCaretRect())) {
|
||||
frame->SchedulePaint();
|
||||
}
|
||||
}
|
||||
|
||||
void nsCaret::UpdateCaretPosition()
|
||||
{
|
||||
// We'll recalculate anyway if we're not drawn right now.
|
||||
|
@ -111,13 +111,6 @@ class nsCaret : public nsISelectionListener
|
||||
return r;
|
||||
}
|
||||
|
||||
/** InvalidateOutsideCaret
|
||||
* Invalidate the area that the caret currently occupies if the caret is
|
||||
* outside of its frame's overflow area. This is used when the content that
|
||||
* the caret is currently drawn is is being deleted or reflowed.
|
||||
*/
|
||||
void InvalidateOutsideCaret();
|
||||
|
||||
/** UpdateCaretPosition
|
||||
* Update the caret's current frame and rect, but don't draw yet. This is
|
||||
* useful for flickerless moving of the caret (e.g., when the frame the
|
||||
|
@ -137,10 +137,9 @@ typedef struct CapturingContentInfo {
|
||||
nsIContent* mContent;
|
||||
} CapturingContentInfo;
|
||||
|
||||
//a4e5ff3a-dc5c-4b3a-a625-d164a9e50619
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0xa4e5ff3a, 0xdc5c, 0x4b3a, \
|
||||
{0xa6, 0x25, 0xd1, 0x64, 0xa9, 0xe5, 0x06, 0x19}}
|
||||
{ 0x42e9a352, 0x76f3, 0x4ba3, \
|
||||
{ 0x94, 0x0b, 0x78, 0x9e, 0x58, 0x38, 0x73, 0x4f } }
|
||||
|
||||
// debug VerifyReflow flags
|
||||
#define VERIFY_REFLOW_ON 0x01
|
||||
@ -789,13 +788,6 @@ public:
|
||||
*/
|
||||
virtual already_AddRefed<nsCaret> GetCaret() const = 0;
|
||||
|
||||
/**
|
||||
* Invalidate the caret's current position if it's outside of its frame's
|
||||
* boundaries. This function is useful if you're batching selection
|
||||
* notifications and might remove the caret's frame out from under it.
|
||||
*/
|
||||
virtual void MaybeInvalidateCaretPosition() = 0;
|
||||
|
||||
/**
|
||||
* Set the current caret to a new caret. To undo this, call RestoreCaret.
|
||||
*/
|
||||
|
@ -2209,13 +2209,6 @@ already_AddRefed<SelectionCarets> PresShell::GetSelectionCarets() const
|
||||
return selectionCaret.forget();
|
||||
}
|
||||
|
||||
void PresShell::MaybeInvalidateCaretPosition()
|
||||
{
|
||||
if (mCaret) {
|
||||
mCaret->InvalidateOutsideCaret();
|
||||
}
|
||||
}
|
||||
|
||||
void PresShell::SetCaret(nsCaret *aNewCaret)
|
||||
{
|
||||
mCaret = aNewCaret;
|
||||
@ -4287,29 +4280,6 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PresShell::CharacterDataWillChange(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo)
|
||||
{
|
||||
NS_PRECONDITION(!mIsDocumentGone, "Unexpected CharacterDataChanged");
|
||||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
|
||||
if (mCaret) {
|
||||
// Invalidate the caret's current location before we call into the frame
|
||||
// constructor. It is important to do this now, and not wait until the
|
||||
// resulting reflow, because this call causes continuation frames of the
|
||||
// text frame the caret is in to forget what part of the content they
|
||||
// refer to, making it hard for them to return the correct continuation
|
||||
// frame to the caret.
|
||||
//
|
||||
// It's also important to do this before the content actually changes, since
|
||||
// in bidi text the caret needs to look at the content to determine its
|
||||
// position and shape.
|
||||
mCaret->InvalidateOutsideCaret();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PresShell::CharacterDataChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
@ -4504,11 +4474,6 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
|
||||
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentRemoved");
|
||||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
|
||||
// Make sure that the caret doesn't leave a turd where the child used to be.
|
||||
if (mCaret) {
|
||||
mCaret->InvalidateOutsideCaret();
|
||||
}
|
||||
|
||||
// Notify the ESM that the content has been removed, so that
|
||||
// it can clean up any state related to the content.
|
||||
|
||||
@ -8633,12 +8598,6 @@ PresShell::DidCauseReflow()
|
||||
void
|
||||
PresShell::WillDoReflow()
|
||||
{
|
||||
// We just reflowed, tell the caret that its frame might have moved.
|
||||
// XXXbz that comment makes no sense
|
||||
if (mCaret) {
|
||||
mCaret->InvalidateOutsideCaret();
|
||||
}
|
||||
|
||||
mPresContext->FlushUserFontSet();
|
||||
|
||||
mPresContext->FlushCounterStyles();
|
||||
@ -8666,9 +8625,6 @@ PresShell::DidDoReflow(bool aInterruptible, bool aWasInterrupted)
|
||||
}
|
||||
|
||||
if (mCaret) {
|
||||
// Update the caret's position now to account for any changes created by
|
||||
// the reflow.
|
||||
mCaret->InvalidateOutsideCaret();
|
||||
mCaret->UpdateCaretPosition();
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,6 @@ public:
|
||||
virtual mozilla::dom::Element* GetSelectionCaretsEndElement() const MOZ_OVERRIDE;
|
||||
// caret handling
|
||||
virtual already_AddRefed<nsCaret> GetCaret() const MOZ_OVERRIDE;
|
||||
virtual void MaybeInvalidateCaretPosition() MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetCaretEnabled(bool aInEnable) MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetCaretReadOnly(bool aReadOnly) MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetCaretEnabled(bool *aOutEnabled) MOZ_OVERRIDE;
|
||||
@ -276,7 +275,6 @@ public:
|
||||
NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEREMOVED
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATAWILLCHANGE
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
||||
|
Loading…
Reference in New Issue
Block a user