mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 845562 - remove GetFrameSelection() from nsISelectionPrivate r=smaug
This commit is contained in:
parent
bf391b7462
commit
1a20d1b3c3
@ -14,7 +14,6 @@ interface nsIContent;
|
||||
interface nsINode;
|
||||
|
||||
%{C++
|
||||
class nsFrameSelection;
|
||||
struct nsTextRangeStyle;
|
||||
struct nsPoint;
|
||||
struct ScrollAxis;
|
||||
@ -22,7 +21,6 @@ struct ScrollAxis;
|
||||
#include "nsIFrame.h"
|
||||
%}
|
||||
|
||||
[ptr] native nsFrameSelection(nsFrameSelection);
|
||||
[ptr] native nsIFrame(nsIFrame);
|
||||
[ptr] native RangeArray(nsTArray<nsRange*>);
|
||||
[ref] native constTextRangeStyleRef(const nsTextRangeStyle);
|
||||
@ -30,7 +28,7 @@ struct ScrollAxis;
|
||||
native nsDirection(nsDirection);
|
||||
native ScrollAxis(nsIPresShell::ScrollAxis);
|
||||
|
||||
[scriptable, builtinclass, uuid(a6d2cedd-afbc-4d25-bffb-e725b9881e30)]
|
||||
[scriptable, builtinclass, uuid(3ede44eb-2df8-41de-ab79-6f3dbd10090b)]
|
||||
interface nsISelectionPrivate : nsISelection
|
||||
{
|
||||
const short ENDOFPRECEDINGLINE=0;
|
||||
@ -83,11 +81,6 @@ interface nsISelectionPrivate : nsISelection
|
||||
*/
|
||||
[noscript] void getCachedFrameOffset(in nsIFrame aFrame, in int32_t inOffset, in nsPointRef aPoint);
|
||||
|
||||
/* getFrameSelection
|
||||
* Returnes a reference to the frame selection associated with this selection
|
||||
*/
|
||||
[noscript] nsFrameSelection getFrameSelection();
|
||||
|
||||
[noscript] void setAncestorLimiter(in nsIContent aContent);
|
||||
|
||||
/**
|
||||
|
@ -629,14 +629,7 @@ nsEditor::GetSelection()
|
||||
nsresult res = GetSelection(getter_AddRefs(sel));
|
||||
NS_ENSURE_SUCCESS(res, nullptr);
|
||||
|
||||
nsCOMPtr<nsISelectionPrivate> selPrivate = do_QueryInterface(sel);
|
||||
NS_ENSURE_TRUE(selPrivate, nullptr);
|
||||
|
||||
nsRefPtr<nsFrameSelection> frameSel;
|
||||
res = selPrivate->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
NS_ENSURE_SUCCESS(res, nullptr);
|
||||
|
||||
return frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
return static_cast<Selection*>(sel.get());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsISelection.h"
|
||||
#include "mozilla/Selection.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsPlaintextEditor.h"
|
||||
@ -20,6 +20,8 @@
|
||||
#include "nsTextEditRules.h"
|
||||
#include "nscore.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
// Test for distance between caret and text that will be deleted
|
||||
nsresult
|
||||
nsTextEditRules::CheckBidiLevelForDeletion(nsISelection *aSelection,
|
||||
@ -45,12 +47,8 @@ nsTextEditRules::CheckBidiLevelForDeletion(nsISelection *aSelection,
|
||||
|
||||
uint8_t levelBefore;
|
||||
uint8_t levelAfter;
|
||||
|
||||
nsCOMPtr<nsISelectionPrivate> privateSelection(do_QueryInterface(aSelection));
|
||||
NS_ENSURE_TRUE(privateSelection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsRefPtr<nsFrameSelection> frameSelection;
|
||||
privateSelection->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
nsRefPtr<nsFrameSelection> frameSelection =
|
||||
static_cast<Selection*>(aSelection)->GetFrameSelection();
|
||||
NS_ENSURE_TRUE(frameSelection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsPrevNextBidiLevels levels = frameSelection->
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "nsThemeConstants.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Selection.h"
|
||||
#include <algorithm>
|
||||
|
||||
// The bidi indicator hangs off the caret to one side, to show which
|
||||
@ -1127,15 +1128,14 @@ void nsCaret::CaretBlinkCallback(nsITimer *aTimer, void *aClosure)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
already_AddRefed<nsFrameSelection>
|
||||
nsFrameSelection*
|
||||
nsCaret::GetFrameSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelectionPrivate> privateSelection(do_QueryReferent(mDomSelectionWeak));
|
||||
if (!privateSelection)
|
||||
nsCOMPtr<nsISelection> sel = do_QueryReferent(mDomSelectionWeak);
|
||||
if (!sel)
|
||||
return nullptr;
|
||||
nsFrameSelection* frameSelection = nullptr;
|
||||
privateSelection->GetFrameSelection(&frameSelection);
|
||||
return frameSelection;
|
||||
|
||||
return static_cast<Selection*>(sel.get())->GetFrameSelection();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -209,7 +209,7 @@ protected:
|
||||
}
|
||||
void ToggleDrawnStatus() { mDrawn = !mDrawn; }
|
||||
|
||||
already_AddRefed<nsFrameSelection> GetFrameSelection();
|
||||
nsFrameSelection* GetFrameSelection();
|
||||
|
||||
// Returns true if we should not draw the caret because of XUL menu popups.
|
||||
// The caret should be hidden if:
|
||||
|
@ -4763,8 +4763,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
|
||||
// selection.
|
||||
nsRefPtr<nsFrameSelection> frameSelection;
|
||||
if (aSelection) {
|
||||
nsCOMPtr<nsISelectionPrivate> selpriv = do_QueryInterface(aSelection);
|
||||
selpriv->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = static_cast<Selection*>(aSelection)->GetFrameSelection();
|
||||
}
|
||||
else {
|
||||
frameSelection = FrameSelection();
|
||||
|
@ -1074,18 +1074,10 @@ nsTextControlFrame::GetSelectionRange(int32_t* aSelectionStart,
|
||||
rv = selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsISelectionPrivate> selPriv = do_QueryInterface(selection);
|
||||
NS_ENSURE_TRUE(selPriv, NS_ERROR_FAILURE);
|
||||
nsRefPtr<nsFrameSelection> frameSel;
|
||||
rv = selPriv->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(frameSel, NS_ERROR_FAILURE);
|
||||
nsRefPtr<Selection> typedSel =
|
||||
frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
NS_ENSURE_TRUE(typedSel, NS_ERROR_FAILURE);
|
||||
|
||||
Selection* sel = static_cast<Selection*>(selection.get());
|
||||
if (aDirection) {
|
||||
nsDirection direction = typedSel->GetSelectionDirection();
|
||||
nsDirection direction = sel->GetSelectionDirection();
|
||||
if (direction == eDirNext) {
|
||||
*aDirection = eForward;
|
||||
} else if (direction == eDirPrevious) {
|
||||
@ -1101,7 +1093,7 @@ nsTextControlFrame::GetSelectionRange(int32_t* aSelectionStart,
|
||||
|
||||
mozilla::dom::Element* root = GetRootNodeAndInitializeEditor();
|
||||
NS_ENSURE_STATE(root);
|
||||
nsContentUtils::GetSelectionInTextControl(typedSel, root,
|
||||
nsContentUtils::GetSelectionInTextControl(sel, root,
|
||||
*aSelectionStart, *aSelectionEnd);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
// utility methods for scrolling the selection into view
|
||||
nsPresContext* GetPresContext() const;
|
||||
nsIPresShell* GetPresShell() const;
|
||||
nsFrameSelection* GetFrameSelection() const { return mFrameSelection; }
|
||||
// Returns a rect containing the selection region, and frame that that
|
||||
// position is relative to. For SELECTION_ANCHOR_REGION or
|
||||
// SELECTION_FOCUS_REGION the rect is a zero-width rectangle. For
|
||||
|
@ -4117,14 +4117,6 @@ Selection::GetCachedFrameOffset(nsIFrame* aFrame, int32_t inOffset,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Selection::GetFrameSelection(nsFrameSelection** aFrameSelection) {
|
||||
NS_ENSURE_ARG_POINTER(aFrameSelection);
|
||||
*aFrameSelection = mFrameSelection;
|
||||
NS_IF_ADDREF(*aFrameSelection);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Selection::SetAncestorLimiter(nsIContent* aContent)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user