More nsIPresShell deCOMtamination:
- Made Get/SetAuthorStyleDisabled and ReconstructStyleData non-virtual when called internally. - Inlined GetFrameSelection and renamed it to FrameSelection. - Removed non-inline version of GetViewManager. - Removed unused EnablePrefStyleRules and ArePrefStyleRulesEnabled. Bug 253889, r+sr=roc.
This commit is contained in:
Родитель
694e5e4fef
Коммит
a8153addf4
|
@ -2368,8 +2368,7 @@ NS_IMETHODIMP
|
|||
DocumentViewerImpl::SetAuthorStyleDisabled(PRBool aStyleDisabled)
|
||||
{
|
||||
if (mPresShell) {
|
||||
nsresult rv = mPresShell->SetAuthorStyleDisabled(aStyleDisabled);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mPresShell->SetAuthorStyleDisabled(aStyleDisabled);
|
||||
}
|
||||
return CallChildren(SetChildAuthorStyleDisabled, &aStyleDisabled);
|
||||
}
|
||||
|
@ -2377,9 +2376,10 @@ DocumentViewerImpl::SetAuthorStyleDisabled(PRBool aStyleDisabled)
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::GetAuthorStyleDisabled(PRBool* aStyleDisabled)
|
||||
{
|
||||
*aStyleDisabled = PR_FALSE;
|
||||
if (mPresShell) {
|
||||
return mPresShell->GetAuthorStyleDisabled(aStyleDisabled);
|
||||
*aStyleDisabled = mPresShell->GetAuthorStyleDisabled();
|
||||
} else {
|
||||
*aStyleDisabled = PR_FALSE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -2019,16 +2019,6 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct,
|
|||
// then we use the document fonts anyway
|
||||
useDocumentFonts =
|
||||
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentFonts);
|
||||
if (!useDocumentFonts) {
|
||||
// check if the prefs have been disabled for this shell
|
||||
// - if prefs are disabled then we use the document fonts anyway (yet another override)
|
||||
PRBool prefsEnabled = PR_TRUE;
|
||||
nsIPresShell *shell = mPresContext->GetPresShell();
|
||||
if (shell)
|
||||
shell->ArePrefStyleRulesEnabled(prefsEnabled);
|
||||
if (!prefsEnabled)
|
||||
useDocumentFonts = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// See if we are in the chrome
|
||||
|
|
|
@ -827,10 +827,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
// disable selection mousedown state on activation
|
||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
if (frameSel)
|
||||
frameSel->SetMouseDownState(PR_FALSE);
|
||||
shell->FrameSelection()->SetMouseDownState(PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1419,7 +1416,7 @@ nsEventStateManager::GetSelection(nsIFrame* inFrame,
|
|||
if (! frameSel) {
|
||||
nsIPresShell *shell = inPresContext->GetPresShell();
|
||||
if (shell)
|
||||
shell->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
frameSel = shell->FrameSelection();
|
||||
}
|
||||
|
||||
*outSelection = frameSel.get();
|
||||
|
@ -1950,11 +1947,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
ret = CheckForAndDispatchClick(aPresContext, (nsMouseEvent*)aEvent, aStatus);
|
||||
nsIPresShell *shell = aPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||
nsresult rv = shell->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
if (NS_SUCCEEDED(rv) && frameSel){
|
||||
frameSel->SetMouseDownState(PR_FALSE);
|
||||
}
|
||||
shell->FrameSelection()->SetMouseDownState(PR_FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -4414,9 +4407,9 @@ nsEventStateManager::GetDocSelectionLocation(nsIContent **aStartContent,
|
|||
if (mPresContext)
|
||||
shell = mPresContext->GetPresShell();
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
nsIFrameSelection *frameSelection = nsnull;
|
||||
if (shell)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
|
||||
nsCOMPtr<nsISelection> domSelection;
|
||||
if (frameSelection)
|
||||
|
@ -4755,15 +4748,14 @@ nsEventStateManager::MoveCaretToFocus()
|
|||
if (shell) {
|
||||
// rangeDoc is a document interface we can create a range with
|
||||
nsCOMPtr<nsIDOMDocumentRange> rangeDoc(do_QueryInterface(mDocument));
|
||||
nsCOMPtr<nsIDOMNode> currentFocusNode(do_QueryInterface(mCurrentFocus));
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
|
||||
if (frameSelection && rangeDoc) {
|
||||
if (rangeDoc) {
|
||||
nsCOMPtr<nsISelection> domSelection;
|
||||
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL,
|
||||
shell->FrameSelection()->
|
||||
GetSelection(nsISelectionController::SELECTION_NORMAL,
|
||||
getter_AddRefs(domSelection));
|
||||
if (domSelection) {
|
||||
nsCOMPtr<nsIDOMNode> currentFocusNode(do_QueryInterface(mCurrentFocus));
|
||||
// First clear the selection
|
||||
domSelection->RemoveAllRanges();
|
||||
if (currentFocusNode) {
|
||||
|
@ -4826,14 +4818,15 @@ nsEventStateManager::SetContentCaretVisible(nsIPresShell* aPresShell,
|
|||
nsCOMPtr<nsICaret> caret;
|
||||
aPresShell->GetCaret(getter_AddRefs(caret));
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection, docFrameSelection;
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
if (aFocusedContent) {
|
||||
nsIFrame *focusFrame = nsnull;
|
||||
aPresShell->GetPrimaryFrameFor(aFocusedContent, &focusFrame);
|
||||
|
||||
GetSelection(focusFrame, mPresContext, getter_AddRefs(frameSelection));
|
||||
}
|
||||
aPresShell->GetFrameSelection(getter_AddRefs(docFrameSelection));
|
||||
|
||||
nsIFrameSelection *docFrameSelection = aPresShell->FrameSelection();
|
||||
|
||||
if (docFrameSelection && caret &&
|
||||
(frameSelection == docFrameSelection || !aFocusedContent)) {
|
||||
|
|
|
@ -3788,14 +3788,8 @@ GlobalWindowImpl::GetSelection(nsISelection** aSelection)
|
|||
if (!presShell)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> selection;
|
||||
presShell->GetFrameSelection(getter_AddRefs(selection));
|
||||
|
||||
if (!selection)
|
||||
return NS_OK;
|
||||
|
||||
return selection->GetSelection(nsISelectionController::SELECTION_NORMAL,
|
||||
aSelection);
|
||||
return presShell->FrameSelection()->
|
||||
GetSelection(nsISelectionController::SELECTION_NORMAL, aSelection);
|
||||
}
|
||||
|
||||
// Non-scriptable version of window.find(), part of nsIDOMWindowInternal
|
||||
|
|
|
@ -148,12 +148,8 @@ NS_IMETHODIMP nsAccessProxy::HandleEvent(nsIDOMEvent* aEvent)
|
|||
//return NS_OK;
|
||||
/*
|
||||
if (presShell && eventNameStr.EqualsLiteral("click")) {
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
presShell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (!frameSelection)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsISelection> domSelection;
|
||||
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL,
|
||||
presShell->FrameSelection()->GetSelection(nsISelectionController::SELECTION_NORMAL,
|
||||
getter_AddRefs(domSelection));
|
||||
if (!domSelection)
|
||||
return NS_OK;
|
||||
|
|
|
@ -303,16 +303,6 @@ NS_IMETHODIMP nsCaret::GetCaretCoordinates(EViewCoordinates aRelativeToType, nsI
|
|||
if (!contentNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
//get frame selection and find out what frame to use...
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
if (presShell)
|
||||
err = presShell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(err) || !frameSelection)
|
||||
return err?err : NS_ERROR_FAILURE;
|
||||
|
||||
// find the frame that contains the content node that has focus
|
||||
nsIFrame* theFrame = nsnull;
|
||||
PRInt32 theFrameOffset = 0;
|
||||
|
@ -323,7 +313,12 @@ NS_IMETHODIMP nsCaret::GetCaretCoordinates(EViewCoordinates aRelativeToType, nsI
|
|||
hint = nsIFrameSelection::HINTRIGHT;
|
||||
else
|
||||
hint = nsIFrameSelection::HINTLEFT;
|
||||
err = frameSelection->GetFrameForNodeOffset(contentNode, focusOffset, hint, &theFrame, &theFrameOffset);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
err = presShell->FrameSelection()->GetFrameForNodeOffset(contentNode,
|
||||
focusOffset, hint,
|
||||
&theFrame,
|
||||
&theFrameOffset);
|
||||
if (NS_FAILED(err) || !theFrame)
|
||||
return err;
|
||||
|
||||
|
@ -532,12 +527,7 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
|
|||
if (!presShell)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
presShell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (!frameSelection)
|
||||
return PR_FALSE;
|
||||
|
||||
|
||||
nsIFrameSelection *frameSelection = presShell->FrameSelection();
|
||||
nsIFrame* theFrame = nsnull;
|
||||
PRInt32 theFrameOffset = 0;
|
||||
|
||||
|
|
|
@ -2368,8 +2368,7 @@ NS_IMETHODIMP
|
|||
DocumentViewerImpl::SetAuthorStyleDisabled(PRBool aStyleDisabled)
|
||||
{
|
||||
if (mPresShell) {
|
||||
nsresult rv = mPresShell->SetAuthorStyleDisabled(aStyleDisabled);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mPresShell->SetAuthorStyleDisabled(aStyleDisabled);
|
||||
}
|
||||
return CallChildren(SetChildAuthorStyleDisabled, &aStyleDisabled);
|
||||
}
|
||||
|
@ -2377,9 +2376,10 @@ DocumentViewerImpl::SetAuthorStyleDisabled(PRBool aStyleDisabled)
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::GetAuthorStyleDisabled(PRBool* aStyleDisabled)
|
||||
{
|
||||
*aStyleDisabled = PR_FALSE;
|
||||
if (mPresShell) {
|
||||
return mPresShell->GetAuthorStyleDisabled(aStyleDisabled);
|
||||
*aStyleDisabled = mPresShell->GetAuthorStyleDisabled();
|
||||
} else {
|
||||
*aStyleDisabled = PR_FALSE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -90,8 +90,8 @@ class nsIStyleSheet;
|
|||
class nsCSSFrameConstructor;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x16c9c6ee, 0xd9c0, 0x463d, \
|
||||
{0xbc, 0x5e, 0x4d, 0xdf, 0x60, 0xdd, 0x73, 0xfc} }
|
||||
{ 0x3b864134, 0x4e25, 0x4cd0, \
|
||||
{0xa6, 0x9e, 0x34, 0x14, 0x13, 0x18, 0x39, 0x58} }
|
||||
|
||||
// Constants uses for ScrollFrameIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
|
@ -167,7 +167,6 @@ public:
|
|||
|
||||
nsPresContext* GetPresContext() { return mPresContext; }
|
||||
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
|
||||
nsIViewManager* GetViewManager() { return mViewManager; }
|
||||
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
|
@ -185,6 +184,7 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
// These two methods are used only by viewer
|
||||
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle) = 0;
|
||||
|
||||
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle) = 0;
|
||||
|
@ -193,15 +193,23 @@ public:
|
|||
/* Enable/disable author style level. Disabling author style disables the entire
|
||||
* author level of the cascade, including the HTML preshint level.
|
||||
*/
|
||||
NS_IMETHOD SetAuthorStyleDisabled(PRBool aStyleDisabled) = 0;
|
||||
NS_IMETHOD GetAuthorStyleDisabled(PRBool* aStyleDisabled) = 0;
|
||||
// XXX these could easily be inlined, but there is a circular #include
|
||||
// problem with nsStyleSet.
|
||||
NS_HIDDEN_(void) SetAuthorStyleDisabled(PRBool aDisabled);
|
||||
NS_HIDDEN_(PRBool) GetAuthorStyleDisabled();
|
||||
|
||||
/*
|
||||
* Called when stylesheets are added/removed/enabled/disabled to rebuild
|
||||
* all style data for a given pres shell without necessarily reconstructing
|
||||
* all of the frames.
|
||||
*/
|
||||
NS_IMETHOD ReconstructStyleData() = 0;
|
||||
virtual NS_HIDDEN_(void) ReconstructStyleDataExternal();
|
||||
NS_HIDDEN_(void) ReconstructStyleDataInternal();
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
void ReconstructStyleData() { ReconstructStyleDataInternal(); }
|
||||
#else
|
||||
void ReconstructStyleData() { ReconstructStyleDataExternal(); }
|
||||
#endif
|
||||
|
||||
/** Setup all style rules required to implement preferences
|
||||
* - used for background/text/link colors and link underlining
|
||||
|
@ -213,16 +221,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD SetPreferenceStyleRules(PRBool aForceReflow) = 0;
|
||||
|
||||
/** Allow client to enable and disable the use of the preference style rules,
|
||||
* by type.
|
||||
* NOTE: type argument is currently ignored, but is in the API for
|
||||
* future refinement
|
||||
*
|
||||
* - initially created for bugs 31816, 20760, 22963
|
||||
*/
|
||||
NS_IMETHOD EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType=0xFF) = 0;
|
||||
NS_IMETHOD ArePrefStyleRulesEnabled(PRBool& aEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gather titles of all selectable (alternate and preferred) style sheets
|
||||
* fills void array with nsString* caller must free strings
|
||||
|
@ -230,10 +228,11 @@ public:
|
|||
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList) = 0;
|
||||
|
||||
/**
|
||||
* GetFrameSelection will return the Frame based selection API you
|
||||
* cannot go back and forth anymore with QI with nsIDOM sel and nsIFrame sel.
|
||||
* FrameSelection will return the Frame based selection API.
|
||||
* You cannot go back and forth anymore with QI between nsIDOM sel and
|
||||
* nsIFrame sel.
|
||||
*/
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
||||
nsIFrameSelection* FrameSelection() { return mSelection; }
|
||||
|
||||
// Make shell be a document observer
|
||||
NS_IMETHOD BeginObservingDocument() = 0;
|
||||
|
@ -676,7 +675,10 @@ protected:
|
|||
nsStyleSet* mStyleSet; // [OWNS]
|
||||
nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
|
||||
nsIViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
|
||||
nsIFrameSelection* mSelection;
|
||||
nsFrameManagerBase mFrameManager; // [OWNS]
|
||||
|
||||
PRPackedBool mStylesHaveChanged;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -185,7 +185,7 @@ public:
|
|||
* Access the image animation mode for this context
|
||||
*/
|
||||
PRUint16 ImageAnimationMode() const { return mImageAnimationMode; }
|
||||
virtual void SetImageAnimationModeExternal(PRUint16 aMode);
|
||||
virtual NS_HIDDEN_(void) SetImageAnimationModeExternal(PRUint16 aMode);
|
||||
NS_HIDDEN_(void) SetImageAnimationModeInternal(PRUint16 aMode);
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
void SetImageAnimationMode(PRUint16 aMode)
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
/**
|
||||
* Get the font metrics for a given font.
|
||||
*/
|
||||
virtual already_AddRefed<nsIFontMetrics>
|
||||
virtual NS_HIDDEN_(already_AddRefed<nsIFontMetrics>)
|
||||
GetMetricsForExternal(const nsFont& aFont);
|
||||
NS_HIDDEN_(already_AddRefed<nsIFontMetrics>)
|
||||
GetMetricsForInternal(const nsFont& aFont);
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
* Get the default font correponding to the given ID. This object is
|
||||
* read-only, you must copy the font to modify it.
|
||||
*/
|
||||
virtual const nsFont* GetDefaultFontExternal(PRUint8 aFontID) const;
|
||||
virtual NS_HIDDEN_(const nsFont*) GetDefaultFontExternal(PRUint8 aFontID) const;
|
||||
NS_HIDDEN_(const nsFont*) GetDefaultFontInternal(PRUint8 aFontID) const;
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
const nsFont* GetDefaultFont(PRUint8 aFontID) const
|
||||
|
@ -328,7 +328,7 @@ public:
|
|||
|
||||
NS_HIDDEN_(void) SetContainer(nsISupports* aContainer);
|
||||
|
||||
virtual already_AddRefed<nsISupports> GetContainerExternal();
|
||||
virtual NS_HIDDEN_(already_AddRefed<nsISupports>) GetContainerExternal();
|
||||
NS_HIDDEN_(already_AddRefed<nsISupports>) GetContainerInternal();
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
already_AddRefed<nsISupports> GetContainer()
|
||||
|
@ -462,7 +462,7 @@ public:
|
|||
*
|
||||
* @lina 07/12/2000
|
||||
*/
|
||||
virtual PRBool BidiEnabledExternal() const;
|
||||
virtual NS_HIDDEN_(PRBool) BidiEnabledExternal() const;
|
||||
NS_HIDDEN_(PRBool) BidiEnabledInternal() const;
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
PRBool BidiEnabled() const { return BidiEnabledInternal(); }
|
||||
|
|
|
@ -1085,17 +1085,10 @@ public:
|
|||
NS_IMETHOD AllocateStackMemory(size_t aSize, void** aResult);
|
||||
|
||||
NS_IMETHOD GetPresContext(nsPresContext** aResult);
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult);
|
||||
nsIViewManager* GetViewManager() { return mViewManager; }
|
||||
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle);
|
||||
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle);
|
||||
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList);
|
||||
NS_IMETHOD GetAuthorStyleDisabled(PRBool* aStyleDisabled);
|
||||
NS_IMETHOD SetAuthorStyleDisabled(PRBool aStyleDisabled);
|
||||
NS_IMETHOD ReconstructStyleData();
|
||||
NS_IMETHOD SetPreferenceStyleRules(PRBool aForceReflow);
|
||||
NS_IMETHOD EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType=0xFF);
|
||||
NS_IMETHOD ArePrefStyleRulesEnabled(PRBool& aEnabled);
|
||||
|
||||
NS_IMETHOD GetSelection(SelectionType aType, nsISelection** aSelection);
|
||||
|
||||
|
@ -1103,7 +1096,6 @@ public:
|
|||
NS_IMETHOD GetDisplaySelection(PRInt16 *aToggle);
|
||||
NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion, PRBool aIsSynchronous);
|
||||
NS_IMETHOD RepaintSelection(SelectionType aType);
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection);
|
||||
|
||||
NS_IMETHOD BeginObservingDocument();
|
||||
NS_IMETHOD EndObservingDocument();
|
||||
|
@ -1395,14 +1387,12 @@ protected:
|
|||
nsVoidArray mReflowCommands;
|
||||
PLDHashTable mReflowCommandTable;
|
||||
|
||||
PRPackedBool mEnablePrefStyleSheet;
|
||||
PRPackedBool mDocumentLoading;
|
||||
PRPackedBool mIsReflowing;
|
||||
PRPackedBool mIsDestroying;
|
||||
|
||||
PRPackedBool mDidInitialReflow;
|
||||
PRPackedBool mIgnoreFrameDestruction;
|
||||
PRPackedBool mStylesHaveChanged;
|
||||
PRPackedBool mHaveShutDown;
|
||||
|
||||
nsIFrame* mCurrentEventFrame;
|
||||
|
@ -1416,7 +1406,6 @@ protected:
|
|||
nsIView* mCurrentTargetView;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> mSelection;
|
||||
nsCOMPtr<nsICaret> mCaret;
|
||||
PRInt16 mSelectionFlags;
|
||||
PRPackedBool mBatchReflows; // When set to true, the pres shell batches reflow commands.
|
||||
|
@ -1607,12 +1596,12 @@ NS_NewPresShell(nsIPresShell** aInstancePtrResult)
|
|||
(void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
PresShell::PresShell():
|
||||
PresShell::PresShell()
|
||||
#ifdef IBMBIDI
|
||||
mBidiLevel(BIDI_LEVEL_UNDEFINED),
|
||||
: mBidiLevel(BIDI_LEVEL_UNDEFINED)
|
||||
#endif
|
||||
mEnablePrefStyleSheet(PR_TRUE)
|
||||
{
|
||||
mSelection = nsnull;
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
mReflowCountMgr = new ReflowCountMgr();
|
||||
mReflowCountMgr->SetPresContext(mPresContext);
|
||||
|
@ -1662,6 +1651,7 @@ PresShell::~PresShell()
|
|||
|
||||
NS_IF_RELEASE(mPresContext);
|
||||
NS_IF_RELEASE(mDocument);
|
||||
NS_IF_RELEASE(mSelection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1740,7 +1730,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
// before creating any frames.
|
||||
SetPreferenceStyleRules(PR_FALSE);
|
||||
|
||||
mSelection = do_CreateInstance(kFrameSelectionCID, &result);
|
||||
result = CallCreateInstance(kFrameSelectionCID, &mSelection);
|
||||
if (NS_FAILED(result)) {
|
||||
mStyleSet = nsnull;
|
||||
return result;
|
||||
|
@ -2026,18 +2016,6 @@ PresShell::GetPresContext(nsPresContext** aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetViewManager(nsIViewManager** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aResult = mViewManager;
|
||||
NS_IF_ADDREF(mViewManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
|
||||
{ // first non-html sheet in style set that has title
|
||||
|
@ -2096,7 +2074,7 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
|
|||
}
|
||||
|
||||
mStyleSet->EndUpdate();
|
||||
return ReconstructStyleData();
|
||||
ReconstructStyleData();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2129,61 +2107,19 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::SetAuthorStyleDisabled(PRBool aStyleDisabled)
|
||||
void
|
||||
nsIPresShell::SetAuthorStyleDisabled(PRBool aStyleDisabled)
|
||||
{
|
||||
if (aStyleDisabled != mStyleSet->GetAuthorStyleDisabled()) {
|
||||
nsresult rv = mStyleSet->SetAuthorStyleDisabled(aStyleDisabled);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return ReconstructStyleData();
|
||||
mStyleSet->SetAuthorStyleDisabled(aStyleDisabled);
|
||||
ReconstructStyleData();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetAuthorStyleDisabled(PRBool* aStyleDisabled)
|
||||
PRBool
|
||||
nsIPresShell::GetAuthorStyleDisabled()
|
||||
{
|
||||
*aStyleDisabled = mStyleSet->GetAuthorStyleDisabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType/*=0xFF*/)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// capture change in state
|
||||
PRBool bChanging = (mEnablePrefStyleSheet != aEnable) ? PR_TRUE : PR_FALSE;
|
||||
// set to desired state
|
||||
mEnablePrefStyleSheet = aEnable;
|
||||
|
||||
#ifdef DEBUG_attinasi
|
||||
printf("PrefStyleSheet %s %s\n",
|
||||
mEnablePrefStyleSheet ? "ENABLED" : "DISABLED",
|
||||
bChanging ? "(state toggled)" : "(state unchanged)");
|
||||
#endif
|
||||
|
||||
// deal with changing state
|
||||
if(bChanging){
|
||||
switch (mEnablePrefStyleSheet){
|
||||
case PR_TRUE:
|
||||
// was off, now on, so create the rules
|
||||
result = SetPreferenceStyleRules(PR_TRUE);
|
||||
break;
|
||||
default :
|
||||
// was on, now off, so clear the rules
|
||||
result = ClearPreferenceStyleRules();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::ArePrefStyleRulesEnabled(PRBool& aEnabled)
|
||||
{
|
||||
aEnabled = mEnablePrefStyleSheet;
|
||||
return NS_OK;
|
||||
return mStyleSet->GetAuthorStyleDisabled();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2208,16 +2144,6 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
|
|||
if (mPresContext) {
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// zeroth, make sure this feature is enabled
|
||||
// XXX: may get more granularity later
|
||||
// (i.e. each pref may be controlled independently)
|
||||
if (!mEnablePrefStyleSheet) {
|
||||
#ifdef DEBUG_attinasi
|
||||
printf("PrefStyleSheet disabled\n");
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// first, make sure this is not a chrome shell
|
||||
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
|
||||
if (container) {
|
||||
|
@ -2615,17 +2541,6 @@ PresShell::RepaintSelection(SelectionType aType)
|
|||
return mSelection->RepaintSelection(mPresContext, aType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetFrameSelection(nsIFrameSelection** aSelection)
|
||||
{
|
||||
if (!aSelection || !mSelection)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aSelection = mSelection;
|
||||
(*aSelection)->AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Make shell be a document observer
|
||||
NS_IMETHODIMP
|
||||
PresShell::BeginObservingDocument()
|
||||
|
@ -5269,14 +5184,14 @@ PresShell::ReconstructFrames(void)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::ReconstructStyleData()
|
||||
void
|
||||
nsIPresShell::ReconstructStyleDataInternal()
|
||||
{
|
||||
mStylesHaveChanged = PR_FALSE;
|
||||
|
||||
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
|
||||
if (!rootFrame)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
nsStyleChangeList changeList;
|
||||
FrameManager()->ComputeStyleChangeFor(rootFrame, &changeList,
|
||||
|
@ -5285,8 +5200,12 @@ PresShell::ReconstructStyleData()
|
|||
mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
|
||||
|
||||
VERIFY_STYLE_TREE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
void
|
||||
nsIPresShell::ReconstructStyleDataExternal()
|
||||
{
|
||||
ReconstructStyleDataInternal();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -90,8 +90,8 @@ class nsIStyleSheet;
|
|||
class nsCSSFrameConstructor;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x16c9c6ee, 0xd9c0, 0x463d, \
|
||||
{0xbc, 0x5e, 0x4d, 0xdf, 0x60, 0xdd, 0x73, 0xfc} }
|
||||
{ 0x3b864134, 0x4e25, 0x4cd0, \
|
||||
{0xa6, 0x9e, 0x34, 0x14, 0x13, 0x18, 0x39, 0x58} }
|
||||
|
||||
// Constants uses for ScrollFrameIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
|
@ -167,7 +167,6 @@ public:
|
|||
|
||||
nsPresContext* GetPresContext() { return mPresContext; }
|
||||
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
|
||||
nsIViewManager* GetViewManager() { return mViewManager; }
|
||||
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
|
@ -185,6 +184,7 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
// These two methods are used only by viewer
|
||||
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle) = 0;
|
||||
|
||||
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle) = 0;
|
||||
|
@ -193,15 +193,23 @@ public:
|
|||
/* Enable/disable author style level. Disabling author style disables the entire
|
||||
* author level of the cascade, including the HTML preshint level.
|
||||
*/
|
||||
NS_IMETHOD SetAuthorStyleDisabled(PRBool aStyleDisabled) = 0;
|
||||
NS_IMETHOD GetAuthorStyleDisabled(PRBool* aStyleDisabled) = 0;
|
||||
// XXX these could easily be inlined, but there is a circular #include
|
||||
// problem with nsStyleSet.
|
||||
NS_HIDDEN_(void) SetAuthorStyleDisabled(PRBool aDisabled);
|
||||
NS_HIDDEN_(PRBool) GetAuthorStyleDisabled();
|
||||
|
||||
/*
|
||||
* Called when stylesheets are added/removed/enabled/disabled to rebuild
|
||||
* all style data for a given pres shell without necessarily reconstructing
|
||||
* all of the frames.
|
||||
*/
|
||||
NS_IMETHOD ReconstructStyleData() = 0;
|
||||
virtual NS_HIDDEN_(void) ReconstructStyleDataExternal();
|
||||
NS_HIDDEN_(void) ReconstructStyleDataInternal();
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
void ReconstructStyleData() { ReconstructStyleDataInternal(); }
|
||||
#else
|
||||
void ReconstructStyleData() { ReconstructStyleDataExternal(); }
|
||||
#endif
|
||||
|
||||
/** Setup all style rules required to implement preferences
|
||||
* - used for background/text/link colors and link underlining
|
||||
|
@ -213,16 +221,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD SetPreferenceStyleRules(PRBool aForceReflow) = 0;
|
||||
|
||||
/** Allow client to enable and disable the use of the preference style rules,
|
||||
* by type.
|
||||
* NOTE: type argument is currently ignored, but is in the API for
|
||||
* future refinement
|
||||
*
|
||||
* - initially created for bugs 31816, 20760, 22963
|
||||
*/
|
||||
NS_IMETHOD EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType=0xFF) = 0;
|
||||
NS_IMETHOD ArePrefStyleRulesEnabled(PRBool& aEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gather titles of all selectable (alternate and preferred) style sheets
|
||||
* fills void array with nsString* caller must free strings
|
||||
|
@ -230,10 +228,11 @@ public:
|
|||
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList) = 0;
|
||||
|
||||
/**
|
||||
* GetFrameSelection will return the Frame based selection API you
|
||||
* cannot go back and forth anymore with QI with nsIDOM sel and nsIFrame sel.
|
||||
* FrameSelection will return the Frame based selection API.
|
||||
* You cannot go back and forth anymore with QI between nsIDOM sel and
|
||||
* nsIFrame sel.
|
||||
*/
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
||||
nsIFrameSelection* FrameSelection() { return mSelection; }
|
||||
|
||||
// Make shell be a document observer
|
||||
NS_IMETHOD BeginObservingDocument() = 0;
|
||||
|
@ -676,7 +675,10 @@ protected:
|
|||
nsStyleSet* mStyleSet; // [OWNS]
|
||||
nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
|
||||
nsIViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
|
||||
nsIFrameSelection* mSelection;
|
||||
nsFrameManagerBase mFrameManager; // [OWNS]
|
||||
|
||||
PRPackedBool mStylesHaveChanged;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -185,7 +185,7 @@ public:
|
|||
* Access the image animation mode for this context
|
||||
*/
|
||||
PRUint16 ImageAnimationMode() const { return mImageAnimationMode; }
|
||||
virtual void SetImageAnimationModeExternal(PRUint16 aMode);
|
||||
virtual NS_HIDDEN_(void) SetImageAnimationModeExternal(PRUint16 aMode);
|
||||
NS_HIDDEN_(void) SetImageAnimationModeInternal(PRUint16 aMode);
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
void SetImageAnimationMode(PRUint16 aMode)
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
/**
|
||||
* Get the font metrics for a given font.
|
||||
*/
|
||||
virtual already_AddRefed<nsIFontMetrics>
|
||||
virtual NS_HIDDEN_(already_AddRefed<nsIFontMetrics>)
|
||||
GetMetricsForExternal(const nsFont& aFont);
|
||||
NS_HIDDEN_(already_AddRefed<nsIFontMetrics>)
|
||||
GetMetricsForInternal(const nsFont& aFont);
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
* Get the default font correponding to the given ID. This object is
|
||||
* read-only, you must copy the font to modify it.
|
||||
*/
|
||||
virtual const nsFont* GetDefaultFontExternal(PRUint8 aFontID) const;
|
||||
virtual NS_HIDDEN_(const nsFont*) GetDefaultFontExternal(PRUint8 aFontID) const;
|
||||
NS_HIDDEN_(const nsFont*) GetDefaultFontInternal(PRUint8 aFontID) const;
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
const nsFont* GetDefaultFont(PRUint8 aFontID) const
|
||||
|
@ -328,7 +328,7 @@ public:
|
|||
|
||||
NS_HIDDEN_(void) SetContainer(nsISupports* aContainer);
|
||||
|
||||
virtual already_AddRefed<nsISupports> GetContainerExternal();
|
||||
virtual NS_HIDDEN_(already_AddRefed<nsISupports>) GetContainerExternal();
|
||||
NS_HIDDEN_(already_AddRefed<nsISupports>) GetContainerInternal();
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
already_AddRefed<nsISupports> GetContainer()
|
||||
|
@ -462,7 +462,7 @@ public:
|
|||
*
|
||||
* @lina 07/12/2000
|
||||
*/
|
||||
virtual PRBool BidiEnabledExternal() const;
|
||||
virtual NS_HIDDEN_(PRBool) BidiEnabledExternal() const;
|
||||
NS_HIDDEN_(PRBool) BidiEnabledInternal() const;
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
PRBool BidiEnabled() const { return BidiEnabledInternal(); }
|
||||
|
|
|
@ -303,16 +303,6 @@ NS_IMETHODIMP nsCaret::GetCaretCoordinates(EViewCoordinates aRelativeToType, nsI
|
|||
if (!contentNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
//get frame selection and find out what frame to use...
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
if (presShell)
|
||||
err = presShell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(err) || !frameSelection)
|
||||
return err?err : NS_ERROR_FAILURE;
|
||||
|
||||
// find the frame that contains the content node that has focus
|
||||
nsIFrame* theFrame = nsnull;
|
||||
PRInt32 theFrameOffset = 0;
|
||||
|
@ -323,7 +313,12 @@ NS_IMETHODIMP nsCaret::GetCaretCoordinates(EViewCoordinates aRelativeToType, nsI
|
|||
hint = nsIFrameSelection::HINTRIGHT;
|
||||
else
|
||||
hint = nsIFrameSelection::HINTLEFT;
|
||||
err = frameSelection->GetFrameForNodeOffset(contentNode, focusOffset, hint, &theFrame, &theFrameOffset);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
err = presShell->FrameSelection()->GetFrameForNodeOffset(contentNode,
|
||||
focusOffset, hint,
|
||||
&theFrame,
|
||||
&theFrameOffset);
|
||||
if (NS_FAILED(err) || !theFrame)
|
||||
return err;
|
||||
|
||||
|
@ -532,12 +527,7 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
|
|||
if (!presShell)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
presShell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (!frameSelection)
|
||||
return PR_FALSE;
|
||||
|
||||
|
||||
nsIFrameSelection *frameSelection = presShell->FrameSelection();
|
||||
nsIFrame* theFrame = nsnull;
|
||||
PRInt32 theFrameOffset = 0;
|
||||
|
||||
|
|
|
@ -5657,7 +5657,7 @@ nsBlockFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
frameSelection = do_QueryInterface(selCon);
|
||||
}
|
||||
else
|
||||
shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
if (!frameSelection || NS_FAILED(frameSelection->GetMouseDownState(&mouseDown)) || !mouseDown)
|
||||
return NS_OK;//do not handle
|
||||
}
|
||||
|
@ -5733,14 +5733,13 @@ nsBlockFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
if (displayresult == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;//nothing to do we cannot affect selection from here
|
||||
}
|
||||
nsCOMPtr<nsIFrameSelection> frameselection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
PRBool mouseDown = aEvent->message == NS_MOUSE_MOVE;
|
||||
if (frameselection)
|
||||
{
|
||||
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
|
||||
pos.mContentOffsetEnd, mouseDown || me->isShift, PR_FALSE, pos.mPreferLeft);
|
||||
}
|
||||
result = shell->FrameSelection()->HandleClick(pos.mResultContent,
|
||||
pos.mContentOffset,
|
||||
pos.mContentOffsetEnd,
|
||||
mouseDown || me->isShift,
|
||||
PR_FALSE,
|
||||
pos.mPreferLeft);
|
||||
}
|
||||
else
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs
|
||||
|
|
|
@ -829,12 +829,10 @@ nsFrame::Paint(nsPresContext* aPresContext,
|
|||
frameSelection = do_QueryInterface(selCon); //this MAY implement
|
||||
}
|
||||
if (!frameSelection)
|
||||
result = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(result) && frameSelection){
|
||||
frameSelection = shell->FrameSelection();
|
||||
result = frameSelection->LookUpSelection(newContent, offset,
|
||||
1, &details, PR_FALSE);//look up to see what selection(s) are on this frame
|
||||
}
|
||||
}
|
||||
|
||||
if (details)
|
||||
{
|
||||
|
@ -1327,7 +1325,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
|||
frameselection = do_QueryInterface(selCon); //this MAY implement
|
||||
|
||||
if (!frameselection)//if we must get it from the pres shell's
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
frameselection = shell->FrameSelection();
|
||||
|
||||
if (!frameselection)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1667,11 +1665,7 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
|
|||
// maintain selection
|
||||
nsCOMPtr<nsIFrameSelection> frameselection = do_QueryInterface(selcon); //this MAY implement
|
||||
if (!frameselection)
|
||||
{
|
||||
rv = aPresContext->PresShell()->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
if (NS_FAILED(rv) || !frameselection)
|
||||
return NS_OK; // return NS_OK; we don't care if this fails
|
||||
}
|
||||
frameselection = aPresContext->PresShell()->FrameSelection();
|
||||
|
||||
return frameselection->MaintainSelection();
|
||||
}
|
||||
|
@ -1695,7 +1689,8 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
PRBool selectable;
|
||||
IsSelectable(&selectable, nsnull);
|
||||
PRUint8 selectStyle;
|
||||
IsSelectable(&selectable, &selectStyle);
|
||||
if (!selectable)
|
||||
return NS_OK;
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
|
@ -1713,32 +1708,21 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
frameselection = do_QueryInterface(selCon); //this MAY implement
|
||||
}
|
||||
if (!frameselection)
|
||||
result = presShell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
frameselection = presShell->FrameSelection();
|
||||
|
||||
if (NS_SUCCEEDED(result) && frameselection)
|
||||
{
|
||||
PRBool mouseDown = PR_FALSE;
|
||||
if (NS_SUCCEEDED(frameselection->GetMouseDownState(&mouseDown)) && !mouseDown)
|
||||
return NS_OK;
|
||||
|
||||
// check whether style allows selection
|
||||
// if not, don't tell selection the mouse event even occurred.
|
||||
PRBool selectable;
|
||||
PRUint8 selectStyle;
|
||||
result = IsSelectable(&selectable, &selectStyle);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
// check for select: none
|
||||
if (selectable)
|
||||
{
|
||||
frameselection->StopAutoScrollTimer();
|
||||
// Check if we are dragging in a table cell
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
PRInt32 contentOffset;
|
||||
PRInt32 target;
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
result = GetDataForTableSelection(frameselection, presShell, me, getter_AddRefs(parentContent), &contentOffset, &target);
|
||||
result = GetDataForTableSelection(frameselection, presShell, me,
|
||||
getter_AddRefs(parentContent),
|
||||
&contentOffset, &target);
|
||||
|
||||
if (NS_SUCCEEDED(result) && parentContent)
|
||||
frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
|
||||
|
@ -1766,8 +1750,6 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
}
|
||||
frameselection->StartAutoScrollTimer(aPresContext, captureView, pt, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1796,13 +1778,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(result) && selCon)
|
||||
frameselection = do_QueryInterface(selCon); //this MAY implement
|
||||
if (!frameselection)
|
||||
result = presShell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
if (!frameselection)
|
||||
return NS_ERROR_FAILURE;
|
||||
frameselection = presShell->FrameSelection();
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
if (nsEventStatus_eConsumeNoDefault != *aEventStatus) {
|
||||
|
|
|
@ -2128,18 +2128,19 @@ nsTextFrame::IsTextInSelection(nsPresContext* aPresContext,
|
|||
nsresult rv = NS_OK;
|
||||
//if that failed get it from the pres shell
|
||||
if (!frameSelection)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (NS_SUCCEEDED(rv) && frameSelection){
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,getter_AddRefs(content),&offset,&length);
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv) && content) {
|
||||
rv = frameSelection->LookUpSelection(content, mContentOffset,
|
||||
mContentLength , &details, PR_FALSE);
|
||||
}
|
||||
mContentLength, &details,
|
||||
PR_FALSE);
|
||||
}
|
||||
|
||||
//where are the selection points "really"
|
||||
|
@ -2314,19 +2315,19 @@ nsTextFrame::PaintUnicodeText(nsPresContext* aPresContext,
|
|||
//if that failed get it from the pres shell
|
||||
nsresult rv = NS_OK;
|
||||
if (!frameSelection)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (NS_SUCCEEDED(rv) && frameSelection){
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,getter_AddRefs(content),&offset,&length);
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv) && content) {
|
||||
rv = frameSelection->LookUpSelection(content, mContentOffset,
|
||||
mContentLength , &details, PR_FALSE);
|
||||
mContentLength, &details,
|
||||
PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//where are the selection points "really"
|
||||
SelectionDetails *sdptr = details;
|
||||
|
@ -2992,19 +2993,18 @@ nsTextFrame::PaintTextSlowly(nsPresContext* aPresContext,
|
|||
nsresult rv = NS_OK;
|
||||
frameSelection = do_QueryInterface(selCon); //this MAY implement
|
||||
if (!frameSelection)//if that failed get it from the presshell
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (NS_SUCCEEDED(rv) && frameSelection)
|
||||
{
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,getter_AddRefs(content),&offset,&length);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = frameSelection->LookUpSelection(content, mContentOffset,
|
||||
mContentLength , &details, PR_FALSE);
|
||||
}
|
||||
mContentLength, &details,
|
||||
PR_FALSE);
|
||||
}
|
||||
|
||||
//where are the selection points "really"
|
||||
|
@ -3218,17 +3218,18 @@ nsTextFrame::PaintAsciiText(nsPresContext* aPresContext,
|
|||
frameSelection = do_QueryInterface(selCon); //this MAY implement
|
||||
nsresult rv = NS_OK;
|
||||
if (!frameSelection)//if that failed get it from the presshell
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (NS_SUCCEEDED(rv) && frameSelection){
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext, getter_AddRefs(content),&offset,&length);
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = frameSelection->LookUpSelection(content, mContentOffset,
|
||||
mContentLength , &details, PR_FALSE);
|
||||
}
|
||||
mContentLength, &details,
|
||||
PR_FALSE);
|
||||
}
|
||||
|
||||
//where are the selection points "really"
|
||||
|
@ -3650,19 +3651,19 @@ nsTextFrame::SetSelected(nsPresContext* aPresContext,
|
|||
frameSelection = do_QueryInterface(selCon); //this MAY implement
|
||||
}
|
||||
if (!frameSelection)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(rv) && frameSelection){
|
||||
frameSelection = shell->FrameSelection();
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext, getter_AddRefs(content),&offset,&length);
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv) && content) {
|
||||
rv = frameSelection->LookUpSelection(content, offset,
|
||||
length, &details, PR_TRUE);
|
||||
// PR_TRUE last param used here! we need to see if we are still selected. so no shortcut
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!details)
|
||||
|
|
|
@ -5657,7 +5657,7 @@ nsBlockFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
frameSelection = do_QueryInterface(selCon);
|
||||
}
|
||||
else
|
||||
shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
if (!frameSelection || NS_FAILED(frameSelection->GetMouseDownState(&mouseDown)) || !mouseDown)
|
||||
return NS_OK;//do not handle
|
||||
}
|
||||
|
@ -5733,14 +5733,13 @@ nsBlockFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
if (displayresult == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;//nothing to do we cannot affect selection from here
|
||||
}
|
||||
nsCOMPtr<nsIFrameSelection> frameselection;
|
||||
shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
PRBool mouseDown = aEvent->message == NS_MOUSE_MOVE;
|
||||
if (frameselection)
|
||||
{
|
||||
result = frameselection->HandleClick(pos.mResultContent, pos.mContentOffset,
|
||||
pos.mContentOffsetEnd, mouseDown || me->isShift, PR_FALSE, pos.mPreferLeft);
|
||||
}
|
||||
result = shell->FrameSelection()->HandleClick(pos.mResultContent,
|
||||
pos.mContentOffset,
|
||||
pos.mContentOffsetEnd,
|
||||
mouseDown || me->isShift,
|
||||
PR_FALSE,
|
||||
pos.mPreferLeft);
|
||||
}
|
||||
else
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);//else let the frame/container do what it needs
|
||||
|
|
|
@ -829,12 +829,10 @@ nsFrame::Paint(nsPresContext* aPresContext,
|
|||
frameSelection = do_QueryInterface(selCon); //this MAY implement
|
||||
}
|
||||
if (!frameSelection)
|
||||
result = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(result) && frameSelection){
|
||||
frameSelection = shell->FrameSelection();
|
||||
result = frameSelection->LookUpSelection(newContent, offset,
|
||||
1, &details, PR_FALSE);//look up to see what selection(s) are on this frame
|
||||
}
|
||||
}
|
||||
|
||||
if (details)
|
||||
{
|
||||
|
@ -1327,7 +1325,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
|||
frameselection = do_QueryInterface(selCon); //this MAY implement
|
||||
|
||||
if (!frameselection)//if we must get it from the pres shell's
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
frameselection = shell->FrameSelection();
|
||||
|
||||
if (!frameselection)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1667,11 +1665,7 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
|
|||
// maintain selection
|
||||
nsCOMPtr<nsIFrameSelection> frameselection = do_QueryInterface(selcon); //this MAY implement
|
||||
if (!frameselection)
|
||||
{
|
||||
rv = aPresContext->PresShell()->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
if (NS_FAILED(rv) || !frameselection)
|
||||
return NS_OK; // return NS_OK; we don't care if this fails
|
||||
}
|
||||
frameselection = aPresContext->PresShell()->FrameSelection();
|
||||
|
||||
return frameselection->MaintainSelection();
|
||||
}
|
||||
|
@ -1695,7 +1689,8 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
PRBool selectable;
|
||||
IsSelectable(&selectable, nsnull);
|
||||
PRUint8 selectStyle;
|
||||
IsSelectable(&selectable, &selectStyle);
|
||||
if (!selectable)
|
||||
return NS_OK;
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
|
@ -1713,32 +1708,21 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
frameselection = do_QueryInterface(selCon); //this MAY implement
|
||||
}
|
||||
if (!frameselection)
|
||||
result = presShell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
frameselection = presShell->FrameSelection();
|
||||
|
||||
if (NS_SUCCEEDED(result) && frameselection)
|
||||
{
|
||||
PRBool mouseDown = PR_FALSE;
|
||||
if (NS_SUCCEEDED(frameselection->GetMouseDownState(&mouseDown)) && !mouseDown)
|
||||
return NS_OK;
|
||||
|
||||
// check whether style allows selection
|
||||
// if not, don't tell selection the mouse event even occurred.
|
||||
PRBool selectable;
|
||||
PRUint8 selectStyle;
|
||||
result = IsSelectable(&selectable, &selectStyle);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
// check for select: none
|
||||
if (selectable)
|
||||
{
|
||||
frameselection->StopAutoScrollTimer();
|
||||
// Check if we are dragging in a table cell
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
PRInt32 contentOffset;
|
||||
PRInt32 target;
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
result = GetDataForTableSelection(frameselection, presShell, me, getter_AddRefs(parentContent), &contentOffset, &target);
|
||||
result = GetDataForTableSelection(frameselection, presShell, me,
|
||||
getter_AddRefs(parentContent),
|
||||
&contentOffset, &target);
|
||||
|
||||
if (NS_SUCCEEDED(result) && parentContent)
|
||||
frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
|
||||
|
@ -1766,8 +1750,6 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
}
|
||||
frameselection->StartAutoScrollTimer(aPresContext, captureView, pt, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1796,13 +1778,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(result) && selCon)
|
||||
frameselection = do_QueryInterface(selCon); //this MAY implement
|
||||
if (!frameselection)
|
||||
result = presShell->GetFrameSelection(getter_AddRefs(frameselection));
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
if (!frameselection)
|
||||
return NS_ERROR_FAILURE;
|
||||
frameselection = presShell->FrameSelection();
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
if (nsEventStatus_eConsumeNoDefault != *aEventStatus) {
|
||||
|
|
|
@ -1085,17 +1085,10 @@ public:
|
|||
NS_IMETHOD AllocateStackMemory(size_t aSize, void** aResult);
|
||||
|
||||
NS_IMETHOD GetPresContext(nsPresContext** aResult);
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult);
|
||||
nsIViewManager* GetViewManager() { return mViewManager; }
|
||||
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle);
|
||||
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle);
|
||||
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList);
|
||||
NS_IMETHOD GetAuthorStyleDisabled(PRBool* aStyleDisabled);
|
||||
NS_IMETHOD SetAuthorStyleDisabled(PRBool aStyleDisabled);
|
||||
NS_IMETHOD ReconstructStyleData();
|
||||
NS_IMETHOD SetPreferenceStyleRules(PRBool aForceReflow);
|
||||
NS_IMETHOD EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType=0xFF);
|
||||
NS_IMETHOD ArePrefStyleRulesEnabled(PRBool& aEnabled);
|
||||
|
||||
NS_IMETHOD GetSelection(SelectionType aType, nsISelection** aSelection);
|
||||
|
||||
|
@ -1103,7 +1096,6 @@ public:
|
|||
NS_IMETHOD GetDisplaySelection(PRInt16 *aToggle);
|
||||
NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion, PRBool aIsSynchronous);
|
||||
NS_IMETHOD RepaintSelection(SelectionType aType);
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection);
|
||||
|
||||
NS_IMETHOD BeginObservingDocument();
|
||||
NS_IMETHOD EndObservingDocument();
|
||||
|
@ -1395,14 +1387,12 @@ protected:
|
|||
nsVoidArray mReflowCommands;
|
||||
PLDHashTable mReflowCommandTable;
|
||||
|
||||
PRPackedBool mEnablePrefStyleSheet;
|
||||
PRPackedBool mDocumentLoading;
|
||||
PRPackedBool mIsReflowing;
|
||||
PRPackedBool mIsDestroying;
|
||||
|
||||
PRPackedBool mDidInitialReflow;
|
||||
PRPackedBool mIgnoreFrameDestruction;
|
||||
PRPackedBool mStylesHaveChanged;
|
||||
PRPackedBool mHaveShutDown;
|
||||
|
||||
nsIFrame* mCurrentEventFrame;
|
||||
|
@ -1416,7 +1406,6 @@ protected:
|
|||
nsIView* mCurrentTargetView;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> mSelection;
|
||||
nsCOMPtr<nsICaret> mCaret;
|
||||
PRInt16 mSelectionFlags;
|
||||
PRPackedBool mBatchReflows; // When set to true, the pres shell batches reflow commands.
|
||||
|
@ -1607,12 +1596,12 @@ NS_NewPresShell(nsIPresShell** aInstancePtrResult)
|
|||
(void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
PresShell::PresShell():
|
||||
PresShell::PresShell()
|
||||
#ifdef IBMBIDI
|
||||
mBidiLevel(BIDI_LEVEL_UNDEFINED),
|
||||
: mBidiLevel(BIDI_LEVEL_UNDEFINED)
|
||||
#endif
|
||||
mEnablePrefStyleSheet(PR_TRUE)
|
||||
{
|
||||
mSelection = nsnull;
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
mReflowCountMgr = new ReflowCountMgr();
|
||||
mReflowCountMgr->SetPresContext(mPresContext);
|
||||
|
@ -1662,6 +1651,7 @@ PresShell::~PresShell()
|
|||
|
||||
NS_IF_RELEASE(mPresContext);
|
||||
NS_IF_RELEASE(mDocument);
|
||||
NS_IF_RELEASE(mSelection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1740,7 +1730,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
// before creating any frames.
|
||||
SetPreferenceStyleRules(PR_FALSE);
|
||||
|
||||
mSelection = do_CreateInstance(kFrameSelectionCID, &result);
|
||||
result = CallCreateInstance(kFrameSelectionCID, &mSelection);
|
||||
if (NS_FAILED(result)) {
|
||||
mStyleSet = nsnull;
|
||||
return result;
|
||||
|
@ -2026,18 +2016,6 @@ PresShell::GetPresContext(nsPresContext** aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetViewManager(nsIViewManager** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aResult = mViewManager;
|
||||
NS_IF_ADDREF(mViewManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
|
||||
{ // first non-html sheet in style set that has title
|
||||
|
@ -2096,7 +2074,7 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
|
|||
}
|
||||
|
||||
mStyleSet->EndUpdate();
|
||||
return ReconstructStyleData();
|
||||
ReconstructStyleData();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2129,61 +2107,19 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::SetAuthorStyleDisabled(PRBool aStyleDisabled)
|
||||
void
|
||||
nsIPresShell::SetAuthorStyleDisabled(PRBool aStyleDisabled)
|
||||
{
|
||||
if (aStyleDisabled != mStyleSet->GetAuthorStyleDisabled()) {
|
||||
nsresult rv = mStyleSet->SetAuthorStyleDisabled(aStyleDisabled);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return ReconstructStyleData();
|
||||
mStyleSet->SetAuthorStyleDisabled(aStyleDisabled);
|
||||
ReconstructStyleData();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetAuthorStyleDisabled(PRBool* aStyleDisabled)
|
||||
PRBool
|
||||
nsIPresShell::GetAuthorStyleDisabled()
|
||||
{
|
||||
*aStyleDisabled = mStyleSet->GetAuthorStyleDisabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType/*=0xFF*/)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// capture change in state
|
||||
PRBool bChanging = (mEnablePrefStyleSheet != aEnable) ? PR_TRUE : PR_FALSE;
|
||||
// set to desired state
|
||||
mEnablePrefStyleSheet = aEnable;
|
||||
|
||||
#ifdef DEBUG_attinasi
|
||||
printf("PrefStyleSheet %s %s\n",
|
||||
mEnablePrefStyleSheet ? "ENABLED" : "DISABLED",
|
||||
bChanging ? "(state toggled)" : "(state unchanged)");
|
||||
#endif
|
||||
|
||||
// deal with changing state
|
||||
if(bChanging){
|
||||
switch (mEnablePrefStyleSheet){
|
||||
case PR_TRUE:
|
||||
// was off, now on, so create the rules
|
||||
result = SetPreferenceStyleRules(PR_TRUE);
|
||||
break;
|
||||
default :
|
||||
// was on, now off, so clear the rules
|
||||
result = ClearPreferenceStyleRules();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::ArePrefStyleRulesEnabled(PRBool& aEnabled)
|
||||
{
|
||||
aEnabled = mEnablePrefStyleSheet;
|
||||
return NS_OK;
|
||||
return mStyleSet->GetAuthorStyleDisabled();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2208,16 +2144,6 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
|
|||
if (mPresContext) {
|
||||
nsresult result = NS_OK;
|
||||
|
||||
// zeroth, make sure this feature is enabled
|
||||
// XXX: may get more granularity later
|
||||
// (i.e. each pref may be controlled independently)
|
||||
if (!mEnablePrefStyleSheet) {
|
||||
#ifdef DEBUG_attinasi
|
||||
printf("PrefStyleSheet disabled\n");
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// first, make sure this is not a chrome shell
|
||||
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
|
||||
if (container) {
|
||||
|
@ -2615,17 +2541,6 @@ PresShell::RepaintSelection(SelectionType aType)
|
|||
return mSelection->RepaintSelection(mPresContext, aType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetFrameSelection(nsIFrameSelection** aSelection)
|
||||
{
|
||||
if (!aSelection || !mSelection)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aSelection = mSelection;
|
||||
(*aSelection)->AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Make shell be a document observer
|
||||
NS_IMETHODIMP
|
||||
PresShell::BeginObservingDocument()
|
||||
|
@ -5269,14 +5184,14 @@ PresShell::ReconstructFrames(void)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::ReconstructStyleData()
|
||||
void
|
||||
nsIPresShell::ReconstructStyleDataInternal()
|
||||
{
|
||||
mStylesHaveChanged = PR_FALSE;
|
||||
|
||||
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
|
||||
if (!rootFrame)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
nsStyleChangeList changeList;
|
||||
FrameManager()->ComputeStyleChangeFor(rootFrame, &changeList,
|
||||
|
@ -5285,8 +5200,12 @@ PresShell::ReconstructStyleData()
|
|||
mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
|
||||
|
||||
VERIFY_STYLE_TREE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
void
|
||||
nsIPresShell::ReconstructStyleDataExternal()
|
||||
{
|
||||
ReconstructStyleDataInternal();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -2128,18 +2128,19 @@ nsTextFrame::IsTextInSelection(nsPresContext* aPresContext,
|
|||
nsresult rv = NS_OK;
|
||||
//if that failed get it from the pres shell
|
||||
if (!frameSelection)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (NS_SUCCEEDED(rv) && frameSelection){
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,getter_AddRefs(content),&offset,&length);
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv) && content) {
|
||||
rv = frameSelection->LookUpSelection(content, mContentOffset,
|
||||
mContentLength , &details, PR_FALSE);
|
||||
}
|
||||
mContentLength, &details,
|
||||
PR_FALSE);
|
||||
}
|
||||
|
||||
//where are the selection points "really"
|
||||
|
@ -2314,19 +2315,19 @@ nsTextFrame::PaintUnicodeText(nsPresContext* aPresContext,
|
|||
//if that failed get it from the pres shell
|
||||
nsresult rv = NS_OK;
|
||||
if (!frameSelection)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (NS_SUCCEEDED(rv) && frameSelection){
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,getter_AddRefs(content),&offset,&length);
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv) && content) {
|
||||
rv = frameSelection->LookUpSelection(content, mContentOffset,
|
||||
mContentLength , &details, PR_FALSE);
|
||||
mContentLength, &details,
|
||||
PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//where are the selection points "really"
|
||||
SelectionDetails *sdptr = details;
|
||||
|
@ -2992,19 +2993,18 @@ nsTextFrame::PaintTextSlowly(nsPresContext* aPresContext,
|
|||
nsresult rv = NS_OK;
|
||||
frameSelection = do_QueryInterface(selCon); //this MAY implement
|
||||
if (!frameSelection)//if that failed get it from the presshell
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (NS_SUCCEEDED(rv) && frameSelection)
|
||||
{
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,getter_AddRefs(content),&offset,&length);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = frameSelection->LookUpSelection(content, mContentOffset,
|
||||
mContentLength , &details, PR_FALSE);
|
||||
}
|
||||
mContentLength, &details,
|
||||
PR_FALSE);
|
||||
}
|
||||
|
||||
//where are the selection points "really"
|
||||
|
@ -3218,17 +3218,18 @@ nsTextFrame::PaintAsciiText(nsPresContext* aPresContext,
|
|||
frameSelection = do_QueryInterface(selCon); //this MAY implement
|
||||
nsresult rv = NS_OK;
|
||||
if (!frameSelection)//if that failed get it from the presshell
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = shell->FrameSelection();
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (NS_SUCCEEDED(rv) && frameSelection){
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext, getter_AddRefs(content),&offset,&length);
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = frameSelection->LookUpSelection(content, mContentOffset,
|
||||
mContentLength , &details, PR_FALSE);
|
||||
}
|
||||
mContentLength, &details,
|
||||
PR_FALSE);
|
||||
}
|
||||
|
||||
//where are the selection points "really"
|
||||
|
@ -3650,19 +3651,19 @@ nsTextFrame::SetSelected(nsPresContext* aPresContext,
|
|||
frameSelection = do_QueryInterface(selCon); //this MAY implement
|
||||
}
|
||||
if (!frameSelection)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(rv) && frameSelection){
|
||||
frameSelection = shell->FrameSelection();
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
PRInt32 offset;
|
||||
PRInt32 length;
|
||||
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext, getter_AddRefs(content),&offset,&length);
|
||||
rv = GetContentAndOffsetsForSelection(aPresContext,
|
||||
getter_AddRefs(content),
|
||||
&offset, &length);
|
||||
if (NS_SUCCEEDED(rv) && content) {
|
||||
rv = frameSelection->LookUpSelection(content, offset,
|
||||
length, &details, PR_TRUE);
|
||||
// PR_TRUE last param used here! we need to see if we are still selected. so no shortcut
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!details)
|
||||
|
|
|
@ -305,12 +305,12 @@ nsTableCellFrame::DecorateForSelection(nsPresContext* aPresContext,
|
|||
PRBool isSelected =
|
||||
(GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
|
||||
if (isSelected) {
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
nsresult result = aPresContext->PresShell()->
|
||||
GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsIFrameSelection *frameSelection =
|
||||
aPresContext->PresShell()->FrameSelection();
|
||||
|
||||
PRBool tableCellSelectionMode;
|
||||
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
nsresult result =
|
||||
frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
if (NS_SUCCEEDED(result) && tableCellSelectionMode) {
|
||||
nscolor bordercolor;
|
||||
if (displaySelection == nsISelectionController::SELECTION_DISABLED) {
|
||||
|
@ -341,7 +341,6 @@ nsTableCellFrame::DecorateForSelection(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -491,17 +490,12 @@ nsTableCellFrame::SetSelected(nsPresContext* aPresContext,
|
|||
// only this frame is considered
|
||||
nsFrame::SetSelected(aPresContext, aRange, aSelected, aSpread);
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
nsresult result = aPresContext->PresShell()->
|
||||
GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(result) && frameSelection) {
|
||||
PRBool tableCellSelectionMode;
|
||||
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
nsresult result = aPresContext->PresShell()->FrameSelection()->GetTableCellSelection(&tableCellSelectionMode);
|
||||
if (NS_SUCCEEDED(result) && tableCellSelectionMode) {
|
||||
// Selection can affect content, border and outline
|
||||
Invalidate(GetOverflowRect(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,12 +134,11 @@ nsMathMLmoFrame::IsFrameInSelection(nsPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv) && selCon)
|
||||
frameSelection = do_QueryInterface(selCon);
|
||||
if (!frameSelection)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(rv) && frameSelection) {
|
||||
frameSelection = shell->FrameSelection();
|
||||
|
||||
frameSelection->LookUpSelection(aFrame->GetContent(),
|
||||
0, 1, &details, PR_TRUE);
|
||||
}
|
||||
}
|
||||
if (!details)
|
||||
return PR_FALSE;
|
||||
|
||||
|
|
|
@ -2019,16 +2019,6 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct,
|
|||
// then we use the document fonts anyway
|
||||
useDocumentFonts =
|
||||
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentFonts);
|
||||
if (!useDocumentFonts) {
|
||||
// check if the prefs have been disabled for this shell
|
||||
// - if prefs are disabled then we use the document fonts anyway (yet another override)
|
||||
PRBool prefsEnabled = PR_TRUE;
|
||||
nsIPresShell *shell = mPresContext->GetPresShell();
|
||||
if (shell)
|
||||
shell->ArePrefStyleRulesEnabled(prefsEnabled);
|
||||
if (!prefsEnabled)
|
||||
useDocumentFonts = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// See if we are in the chrome
|
||||
|
|
|
@ -766,7 +766,7 @@ nsSVGGlyphFrame::GetHighlight(PRUint32 *charnum, PRUint32 *nchars, nscolor *fore
|
|||
frameSelection = do_QueryInterface(controller);
|
||||
}
|
||||
if (!frameSelection) {
|
||||
presContext->PresShell()->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
frameSelection = presContext->PresShell()->FrameSelection();
|
||||
}
|
||||
if (!frameSelection) {
|
||||
NS_ERROR("no frameselection interface");
|
||||
|
|
|
@ -305,12 +305,12 @@ nsTableCellFrame::DecorateForSelection(nsPresContext* aPresContext,
|
|||
PRBool isSelected =
|
||||
(GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
|
||||
if (isSelected) {
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
nsresult result = aPresContext->PresShell()->
|
||||
GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsIFrameSelection *frameSelection =
|
||||
aPresContext->PresShell()->FrameSelection();
|
||||
|
||||
PRBool tableCellSelectionMode;
|
||||
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
nsresult result =
|
||||
frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
if (NS_SUCCEEDED(result) && tableCellSelectionMode) {
|
||||
nscolor bordercolor;
|
||||
if (displaySelection == nsISelectionController::SELECTION_DISABLED) {
|
||||
|
@ -341,7 +341,6 @@ nsTableCellFrame::DecorateForSelection(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -491,17 +490,12 @@ nsTableCellFrame::SetSelected(nsPresContext* aPresContext,
|
|||
// only this frame is considered
|
||||
nsFrame::SetSelected(aPresContext, aRange, aSelected, aSpread);
|
||||
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
nsresult result = aPresContext->PresShell()->
|
||||
GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(result) && frameSelection) {
|
||||
PRBool tableCellSelectionMode;
|
||||
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
nsresult result = aPresContext->PresShell()->FrameSelection()->GetTableCellSelection(&tableCellSelectionMode);
|
||||
if (NS_SUCCEEDED(result) && tableCellSelectionMode) {
|
||||
// Selection can affect content, border and outline
|
||||
Invalidate(GetOverflowRect(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1154,8 +1154,7 @@ NS_IMETHODIMP nsBrowserWindow::ForceRefresh()
|
|||
{
|
||||
nsIPresShell* shell = GetPresShell();
|
||||
if (nsnull != shell) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
nsIViewManager *vm = shell->GetViewManager();
|
||||
if (vm) {
|
||||
nsIView* root;
|
||||
vm->GetRootView(root);
|
||||
|
@ -2479,8 +2478,7 @@ DumpViewsRecurse(nsIDocShell* aDocShell, FILE* out)
|
|||
fprintf(out, "docshell=%p \n", aDocShell);
|
||||
nsIPresShell* shell = GetPresShellFor(aDocShell);
|
||||
if (nsnull != shell) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
nsIViewManager *vm = shell->GetViewManager();
|
||||
if (vm) {
|
||||
nsIView* root;
|
||||
vm->GetRootView(root);
|
||||
|
|
|
@ -258,8 +258,7 @@ void nsXPBaseWindow::ForceRefresh()
|
|||
nsIPresShell* shell;
|
||||
GetPresShell(shell);
|
||||
if (nsnull != shell) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
nsIViewManager *vm = shell->GetViewManager();
|
||||
if (vm) {
|
||||
nsIView* root;
|
||||
vm->GetRootView(root);
|
||||
|
|
Загрузка…
Ссылка в новой задаче