зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1387143 part 24. Remove nsISelection::ContainsNode. r=mats
This commit is contained in:
Родитель
b47b72dae9
Коммит
30e5cc5d8b
|
@ -2978,23 +2978,6 @@ Selection::SelectAllChildren(nsINode& aNode, ErrorResult& aRv)
|
|||
Extend(aNode, aNode.GetChildCount(), aRv);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Selection::ContainsNode(nsIDOMNode* aNode, bool aAllowPartial, bool* aYes)
|
||||
{
|
||||
if (!aYes) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aYes = false;
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
if (!node) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
ErrorResult result;
|
||||
*aYes = ContainsNode(*node, aAllowPartial, result);
|
||||
return result.StealNSResult();
|
||||
}
|
||||
|
||||
bool
|
||||
Selection::ContainsNode(nsINode& aNode, bool aAllowPartial, ErrorResult& aRv)
|
||||
{
|
||||
|
|
|
@ -283,6 +283,12 @@ public:
|
|||
|
||||
void Stringify(nsAString& aResult);
|
||||
|
||||
/**
|
||||
* Indicates whether the node is part of the selection. If partlyContained
|
||||
* is true, the function returns true when some part of the node
|
||||
* is part of the selection. If partlyContained is false, the
|
||||
* function only returns true when the entire node is part of the selection.
|
||||
*/
|
||||
bool ContainsNode(nsINode& aNode, bool aPartlyContained, mozilla::ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
|
|
|
@ -614,10 +614,7 @@ DragDataProducer::Produce(DataTransfer* aDataTransfer,
|
|||
|
||||
if (isChromeShell && textControl) {
|
||||
// Only use the selection if the target node is in the selection.
|
||||
bool selectionContainsTarget = false;
|
||||
nsCOMPtr<nsIDOMNode> targetNode = do_QueryInterface(mSelectionTargetNode);
|
||||
selection->ContainsNode(targetNode, false, &selectionContainsTarget);
|
||||
if (!selectionContainsTarget)
|
||||
if (!selection->ContainsNode(*mSelectionTargetNode, false, IgnoreErrors()))
|
||||
return NS_OK;
|
||||
|
||||
selection.swap(*aSelection);
|
||||
|
@ -956,14 +953,8 @@ DragDataProducer::GetDraggableSelectionData(Selection* inSelection,
|
|||
*outImageOrLinkNode = nullptr;
|
||||
*outDragSelectedText = false;
|
||||
|
||||
bool selectionContainsTarget = false;
|
||||
|
||||
if (!inSelection->IsCollapsed()) {
|
||||
nsCOMPtr<nsIDOMNode> realTargetNode = do_QueryInterface(inRealTargetNode);
|
||||
inSelection->ContainsNode(realTargetNode, false,
|
||||
&selectionContainsTarget);
|
||||
|
||||
if (selectionContainsTarget) {
|
||||
if (inSelection->ContainsNode(*inRealTargetNode, false, IgnoreErrors())) {
|
||||
// track down the anchor node, if any, for the url
|
||||
nsINode* selectionStart = inSelection->GetAnchorNode();
|
||||
nsINode* selectionEnd = inSelection->GetFocusNode();
|
||||
|
|
|
@ -39,14 +39,6 @@ interface nsISelection : nsISupports
|
|||
void extend(in nsIDOMNode parentNode, in long offset);
|
||||
[noscript] void extendNative(in nsINode parentNode, in long offset);
|
||||
|
||||
/**
|
||||
* Indicates whether the node is part of the selection. If partlyContained
|
||||
* is set to PR_TRUE, the function returns true when some part of the node
|
||||
* is part of the selection. If partlyContained is set to PR_FALSE, the
|
||||
* function only returns true when the entire node is part of the selection.
|
||||
*/
|
||||
boolean containsNode(in nsIDOMNode node, in boolean partlyContained);
|
||||
|
||||
/**
|
||||
* Adds all children of the specified node to the selection.
|
||||
* @param parentNode the parent of the children to be added to the selection.
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
#include "TextOverflow.h"
|
||||
#include "nsIFrameInlines.h"
|
||||
#include "CounterStyleManager.h"
|
||||
#include "nsISelection.h"
|
||||
#include "mozilla/dom/HTMLDetailsElement.h"
|
||||
#include "mozilla/dom/HTMLSummaryElement.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
@ -6577,15 +6577,14 @@ static void ComputeVisualOverflowArea(nsLineList& aLines,
|
|||
#endif
|
||||
|
||||
bool
|
||||
nsBlockFrame::IsVisibleInSelection(nsISelection* aSelection)
|
||||
nsBlockFrame::IsVisibleInSelection(Selection* aSelection)
|
||||
{
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::html, nsGkAtoms::body))
|
||||
return true;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mContent));
|
||||
bool visible;
|
||||
nsresult rv = aSelection->ContainsNode(node, true, &visible);
|
||||
return NS_SUCCEEDED(rv) && visible;
|
||||
IgnoredErrorResult rv;
|
||||
bool visible = aSelection->ContainsNode(*mContent, true, rv);
|
||||
return !rv.Failed() && visible;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -225,7 +225,7 @@ public:
|
|||
};
|
||||
|
||||
void ChildIsDirty(nsIFrame* aChild) override;
|
||||
bool IsVisibleInSelection(nsISelection* aSelection) override;
|
||||
bool IsVisibleInSelection(mozilla::dom::Selection* aSelection) override;
|
||||
|
||||
bool IsEmpty() override;
|
||||
bool CachedIsEmpty() override;
|
||||
|
|
|
@ -7911,7 +7911,7 @@ bool
|
|||
nsIFrame::IsVisibleForPainting(nsDisplayListBuilder* aBuilder) {
|
||||
if (!StyleVisibility()->IsVisible())
|
||||
return false;
|
||||
nsISelection* sel = aBuilder->GetBoundingSelection();
|
||||
Selection* sel = aBuilder->GetBoundingSelection();
|
||||
return !sel || IsVisibleInSelection(sel);
|
||||
}
|
||||
|
||||
|
@ -7937,7 +7937,7 @@ nsIFrame::IsVisibleForPainting() {
|
|||
|
||||
bool
|
||||
nsIFrame::IsVisibleInSelection(nsDisplayListBuilder* aBuilder) {
|
||||
nsISelection* sel = aBuilder->GetBoundingSelection();
|
||||
Selection* sel = aBuilder->GetBoundingSelection();
|
||||
return !sel || IsVisibleInSelection(sel);
|
||||
}
|
||||
|
||||
|
@ -7945,21 +7945,20 @@ bool
|
|||
nsIFrame::IsVisibleOrCollapsedForPainting(nsDisplayListBuilder* aBuilder) {
|
||||
if (!StyleVisibility()->IsVisibleOrCollapsed())
|
||||
return false;
|
||||
nsISelection* sel = aBuilder->GetBoundingSelection();
|
||||
Selection* sel = aBuilder->GetBoundingSelection();
|
||||
return !sel || IsVisibleInSelection(sel);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFrame::IsVisibleInSelection(nsISelection* aSelection)
|
||||
nsIFrame::IsVisibleInSelection(Selection* aSelection)
|
||||
{
|
||||
if (!GetContent() || !GetContent()->IsSelectionDescendant()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mContent));
|
||||
bool vis;
|
||||
nsresult rv = aSelection->ContainsNode(node, true, &vis);
|
||||
return NS_FAILED(rv) || vis;
|
||||
ErrorResult rv;
|
||||
bool vis = aSelection->ContainsNode(*mContent, true, rv);
|
||||
return rv.Failed() || vis;
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
|
|
|
@ -114,6 +114,10 @@ class Layer;
|
|||
class LayerManager;
|
||||
} // namespace layers
|
||||
|
||||
namespace dom {
|
||||
class Selection;
|
||||
} // namespace dom
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
|
@ -3491,7 +3495,7 @@ public:
|
|||
* Overridable function to determine whether this frame should be considered
|
||||
* "in" the given non-null aSelection for visibility purposes.
|
||||
*/
|
||||
virtual bool IsVisibleInSelection(nsISelection* aSelection);
|
||||
virtual bool IsVisibleInSelection(mozilla::dom::Selection* aSelection);
|
||||
|
||||
/**
|
||||
* Determines if this frame has a container effect that requires
|
||||
|
|
|
@ -7401,7 +7401,7 @@ nsTextFrame::GetSelectionStatus(int16_t* aSelectionFlags)
|
|||
}
|
||||
|
||||
bool
|
||||
nsTextFrame::IsVisibleInSelection(nsISelection* aSelection)
|
||||
nsTextFrame::IsVisibleInSelection(Selection* aSelection)
|
||||
{
|
||||
// Check the quick way first
|
||||
if (!GetContent()->IsSelectionDescendant())
|
||||
|
|
|
@ -235,7 +235,7 @@ public:
|
|||
int32_t* outFrameContentOffset,
|
||||
nsIFrame** outChildFrame) override;
|
||||
|
||||
bool IsVisibleInSelection(nsISelection* aSelection) override;
|
||||
bool IsVisibleInSelection(mozilla::dom::Selection* aSelection) override;
|
||||
|
||||
bool IsEmpty() override;
|
||||
bool IsSelfEmpty() override { return IsEmpty(); }
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/EnumSet.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TemplateLib.h" // mozilla::tl::Max
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContainerFrame.h"
|
||||
|
@ -57,7 +58,6 @@ class gfxContext;
|
|||
class nsIContent;
|
||||
class nsDisplayList;
|
||||
class nsDisplayTableItem;
|
||||
class nsISelection;
|
||||
class nsIScrollableFrame;
|
||||
class nsSubDocumentFrame;
|
||||
class nsDisplayCompositorHitTestInfo;
|
||||
|
@ -80,6 +80,9 @@ class WebRenderLayerScrollData;
|
|||
namespace wr {
|
||||
class DisplayListBuilder;
|
||||
} // namespace wr
|
||||
namespace dom {
|
||||
class Selection;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
// A set of blend modes, that never includes OP_OVER (since it's
|
||||
|
@ -560,7 +563,7 @@ public:
|
|||
* @return the selection that painting should be restricted to (or nullptr
|
||||
* in the normal unrestricted case)
|
||||
*/
|
||||
nsISelection* GetBoundingSelection() { return mBoundingSelection; }
|
||||
mozilla::dom::Selection* GetBoundingSelection() { return mBoundingSelection; }
|
||||
|
||||
/**
|
||||
* @return the root of given frame's (sub)tree, whose origin
|
||||
|
@ -1903,7 +1906,7 @@ private:
|
|||
|
||||
nsPresArena mPool;
|
||||
|
||||
nsCOMPtr<nsISelection> mBoundingSelection;
|
||||
RefPtr<mozilla::dom::Selection> mBoundingSelection;
|
||||
AutoTArray<PresShellState,8> mPresShellStates;
|
||||
AutoTArray<nsIFrame*,400> mFramesMarkedForDisplay;
|
||||
AutoTArray<nsIFrame*,40> mFramesMarkedForDisplayIfVisible;
|
||||
|
|
Загрузка…
Ссылка в новой задаче