2007-05-06 12:16:51 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2007-03-22 10:30:00 -07:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla MathML Project.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* The University Of Queensland.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1999
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Roger B. Sidje <rbs@maths.uq.edu.au>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsFrame.h"
|
|
|
|
#include "nsPresContext.h"
|
|
|
|
#include "nsStyleContext.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "prprf.h" // For PR_snprintf()
|
|
|
|
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#include "nsIWebBrowserChrome.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
|
2007-05-14 02:11:38 -07:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsMathMLmactionFrame.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsStyleSet.h"
|
|
|
|
#include "nsDisplayList.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
|
|
|
|
//
|
|
|
|
// <maction> -- bind actions to a subexpression - implementation
|
|
|
|
//
|
|
|
|
|
|
|
|
#define NS_MATHML_ACTION_TYPE_NONE 0
|
|
|
|
#define NS_MATHML_ACTION_TYPE_TOGGLE 1
|
|
|
|
#define NS_MATHML_ACTION_TYPE_STATUSLINE 2
|
|
|
|
#define NS_MATHML_ACTION_TYPE_TOOLTIP 3 // unsupported
|
|
|
|
|
|
|
|
|
|
|
|
nsIFrame*
|
|
|
|
NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|
|
|
{
|
|
|
|
return new (aPresShell) nsMathMLmactionFrame(aContext);
|
|
|
|
}
|
|
|
|
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmactionFrame)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMathMLmactionFrame::~nsMathMLmactionFrame()
|
|
|
|
{
|
|
|
|
// unregister us as a mouse event listener ...
|
2007-05-14 02:11:38 -07:00
|
|
|
// printf("maction:%p unregistering as mouse event listener ...\n", this);
|
2011-06-28 10:59:14 -07:00
|
|
|
if (mListener) {
|
2011-11-30 23:40:51 -08:00
|
|
|
mContent->RemoveSystemEventListener(NS_LITERAL_STRING("click"), mListener,
|
|
|
|
false);
|
|
|
|
mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mouseover"), mListener,
|
|
|
|
false);
|
|
|
|
mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mouseout"), mListener,
|
|
|
|
false);
|
2011-06-28 10:59:14 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMathMLmactionFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
nsAutoString value, prefix;
|
|
|
|
|
|
|
|
// Init our local attributes
|
|
|
|
|
|
|
|
mChildCount = -1; // these will be updated in GetSelectedFrame()
|
|
|
|
mSelection = 0;
|
|
|
|
mSelectedFrame = nsnull;
|
|
|
|
nsRefPtr<nsStyleContext> newStyleContext;
|
|
|
|
|
|
|
|
mActionType = NS_MATHML_ACTION_TYPE_NONE;
|
|
|
|
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::actiontype_, value);
|
|
|
|
if (!value.IsEmpty()) {
|
|
|
|
if (value.EqualsLiteral("toggle"))
|
|
|
|
mActionType = NS_MATHML_ACTION_TYPE_TOGGLE;
|
|
|
|
|
|
|
|
// XXX use goto to jump out of these if?
|
|
|
|
|
|
|
|
if (NS_MATHML_ACTION_TYPE_NONE == mActionType) {
|
|
|
|
// expected tooltip prefix (8ch)...
|
|
|
|
if (8 < value.Length() && 0 == value.Find("tooltip#"))
|
|
|
|
mActionType = NS_MATHML_ACTION_TYPE_TOOLTIP;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NS_MATHML_ACTION_TYPE_NONE == mActionType) {
|
2012-03-29 02:50:02 -07:00
|
|
|
if (value.EqualsLiteral("statusline"))
|
2007-03-22 10:30:00 -07:00
|
|
|
mActionType = NS_MATHML_ACTION_TYPE_STATUSLINE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Let the base class do the rest
|
|
|
|
return nsMathMLContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
|
|
|
}
|
|
|
|
|
2011-03-24 20:38:59 -07:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMathMLmactionFrame::TransmitAutomaticData() {
|
|
|
|
// The REC defines the following element to be space-like:
|
|
|
|
// * an maction element whose selected sub-expression exists and is
|
|
|
|
// space-like;
|
|
|
|
nsIMathMLFrame* mathMLFrame = do_QueryFrame(mSelectedFrame);
|
|
|
|
if (mathMLFrame && mathMLFrame->IsSpaceLike()) {
|
|
|
|
mPresentationData.flags |= NS_MATHML_SPACE_LIKE;
|
|
|
|
} else {
|
|
|
|
mPresentationData.flags &= ~NS_MATHML_SPACE_LIKE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The REC defines the following element to be an embellished operator:
|
|
|
|
// * an maction element whose selected sub-expression exists and is an
|
|
|
|
// embellished operator;
|
|
|
|
mPresentationData.baseFrame = mSelectedFrame;
|
|
|
|
GetEmbellishDataFrom(mSelectedFrame, mEmbellishData);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
|
|
|
nsMathMLmactionFrame::ChildListChanged(PRInt32 aModType)
|
|
|
|
{
|
|
|
|
// update cached values
|
|
|
|
mChildCount = -1;
|
|
|
|
mSelection = 0;
|
|
|
|
mSelectedFrame = nsnull;
|
|
|
|
GetSelectedFrame();
|
|
|
|
|
|
|
|
return nsMathMLContainerFrame::ChildListChanged(aModType);
|
|
|
|
}
|
|
|
|
|
|
|
|
// return the frame whose number is given by the attribute selection="number"
|
|
|
|
nsIFrame*
|
|
|
|
nsMathMLmactionFrame::GetSelectedFrame()
|
|
|
|
{
|
|
|
|
nsAutoString value;
|
|
|
|
PRInt32 selection;
|
|
|
|
|
2011-05-12 01:18:13 -07:00
|
|
|
GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::selection_,
|
|
|
|
value);
|
2007-03-22 10:30:00 -07:00
|
|
|
if (!value.IsEmpty()) {
|
|
|
|
PRInt32 errorCode;
|
|
|
|
selection = value.ToInteger(&errorCode);
|
|
|
|
if (NS_FAILED(errorCode))
|
|
|
|
selection = 1;
|
|
|
|
}
|
|
|
|
else selection = 1; // default is first frame
|
|
|
|
|
|
|
|
if (-1 != mChildCount) { // we have been in this function before...
|
|
|
|
// cater for invalid user-supplied selection
|
|
|
|
if (selection > mChildCount || selection < 1)
|
|
|
|
selection = 1;
|
|
|
|
// quick return if it is identical with our cache
|
|
|
|
if (selection == mSelection)
|
|
|
|
return mSelectedFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get the selected child and cache new values...
|
|
|
|
PRInt32 count = 0;
|
|
|
|
nsIFrame* childFrame = mFrames.FirstChild();
|
|
|
|
while (childFrame) {
|
|
|
|
if (!mSelectedFrame)
|
|
|
|
mSelectedFrame = childFrame; // default is first child
|
|
|
|
if (++count == selection)
|
|
|
|
mSelectedFrame = childFrame;
|
|
|
|
|
|
|
|
childFrame = childFrame->GetNextSibling();
|
|
|
|
}
|
|
|
|
// cater for invalid user-supplied selection
|
|
|
|
if (selection > count || selection < 1)
|
|
|
|
selection = 1;
|
|
|
|
|
|
|
|
mChildCount = count;
|
|
|
|
mSelection = selection;
|
|
|
|
|
|
|
|
return mSelectedFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 13:54:30 -07:00
|
|
|
nsMathMLmactionFrame::SetInitialChildList(ChildListID aListID,
|
2009-07-28 05:53:20 -07:00
|
|
|
nsFrameList& aChildList)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-08-24 13:54:30 -07:00
|
|
|
nsresult rv = nsMathMLContainerFrame::SetInitialChildList(aListID, aChildList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// This very first call to GetSelectedFrame() will cause us to be marked as an
|
|
|
|
// embellished operator if the selected child is an embellished operator
|
|
|
|
if (!GetSelectedFrame()) {
|
|
|
|
mActionType = NS_MATHML_ACTION_TYPE_NONE;
|
|
|
|
}
|
|
|
|
else {
|
2009-11-03 14:43:39 -08:00
|
|
|
// create mouse event listener and register it
|
|
|
|
mListener = new nsMathMLmactionFrame::MouseListener(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
// printf("maction:%p registering as mouse event listener ...\n", this);
|
2011-11-30 23:40:51 -08:00
|
|
|
mContent->AddSystemEventListener(NS_LITERAL_STRING("click"), mListener,
|
|
|
|
false, false);
|
|
|
|
mContent->AddSystemEventListener(NS_LITERAL_STRING("mouseover"), mListener,
|
|
|
|
false, false);
|
|
|
|
mContent->AddSystemEventListener(NS_LITERAL_STRING("mouseout"), mListener,
|
|
|
|
false, false);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only paint the selected child...
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMathMLmactionFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
|
|
|
nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
nsIFrame* childFrame = GetSelectedFrame();
|
|
|
|
if (childFrame) {
|
|
|
|
// Put the child's background directly onto the content list
|
|
|
|
nsDisplayListSet set(aLists, aLists.Content());
|
|
|
|
// The children should be in content order
|
|
|
|
rv = BuildDisplayListForChild(aBuilder, childFrame, aDirtyRect, set);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
|
|
|
// visual debug
|
|
|
|
rv = DisplayBoundingMetrics(aBuilder, this, mReference, mBoundingMetrics, aLists);
|
|
|
|
#endif
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only reflow the selected child ...
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMathMLmactionFrame::Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
aDesiredSize.width = aDesiredSize.height = 0;
|
|
|
|
aDesiredSize.ascent = 0;
|
2011-04-07 18:04:40 -07:00
|
|
|
mBoundingMetrics = nsBoundingMetrics();
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* childFrame = GetSelectedFrame();
|
|
|
|
if (childFrame) {
|
2008-01-14 17:28:42 -08:00
|
|
|
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
|
|
|
childFrame, availSize);
|
|
|
|
rv = ReflowChild(childFrame, aPresContext, aDesiredSize,
|
|
|
|
childReflowState, aStatus);
|
2008-02-25 20:19:36 -08:00
|
|
|
SaveReflowAndBoundingMetricsFor(childFrame, aDesiredSize,
|
|
|
|
aDesiredSize.mBoundingMetrics);
|
2007-03-22 10:30:00 -07:00
|
|
|
mBoundingMetrics = aDesiredSize.mBoundingMetrics;
|
|
|
|
}
|
|
|
|
FinalizeReflow(*aReflowState.rendContext, aDesiredSize);
|
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only place the selected child ...
|
2008-03-17 21:52:48 -07:00
|
|
|
/* virtual */ nsresult
|
2011-04-07 18:04:40 -07:00
|
|
|
nsMathMLmactionFrame::Place(nsRenderingContext& aRenderingContext,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aPlaceOrigin,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize)
|
|
|
|
{
|
|
|
|
aDesiredSize.width = aDesiredSize.height = 0;
|
|
|
|
aDesiredSize.ascent = 0;
|
2011-04-07 18:04:40 -07:00
|
|
|
mBoundingMetrics = nsBoundingMetrics();
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* childFrame = GetSelectedFrame();
|
|
|
|
if (childFrame) {
|
|
|
|
GetReflowAndBoundingMetricsFor(childFrame, aDesiredSize, mBoundingMetrics);
|
|
|
|
if (aPlaceOrigin) {
|
2007-03-30 14:11:41 -07:00
|
|
|
FinishReflowChild(childFrame, PresContext(), nsnull, aDesiredSize, 0, 0, 0);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
mReference.x = 0;
|
|
|
|
mReference.y = aDesiredSize.ascent;
|
|
|
|
}
|
|
|
|
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ################################################################
|
|
|
|
// Event handlers
|
|
|
|
// ################################################################
|
|
|
|
|
2011-06-28 10:59:14 -07:00
|
|
|
NS_IMPL_ISUPPORTS1(nsMathMLmactionFrame::MouseListener,
|
|
|
|
nsIDOMEventListener)
|
2009-11-03 14:43:39 -08:00
|
|
|
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// helper to show a msg on the status bar
|
|
|
|
// curled from nsObjectFrame.cpp ...
|
2009-11-03 14:43:39 -08:00
|
|
|
void
|
|
|
|
ShowStatus(nsPresContext* aPresContext, nsString& aStatusMsg)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsISupports> cont = aPresContext->GetContainer();
|
|
|
|
if (cont) {
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(cont));
|
|
|
|
if (docShellItem) {
|
|
|
|
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
|
|
|
docShellItem->GetTreeOwner(getter_AddRefs(treeOwner));
|
|
|
|
if (treeOwner) {
|
|
|
|
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(treeOwner));
|
|
|
|
if (browserChrome) {
|
|
|
|
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_LINK, aStatusMsg.get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-06-28 10:59:14 -07:00
|
|
|
nsMathMLmactionFrame::MouseListener::HandleEvent(nsIDOMEvent* aEvent)
|
2009-11-03 14:43:39 -08:00
|
|
|
{
|
2011-06-28 10:59:14 -07:00
|
|
|
nsAutoString eventType;
|
|
|
|
aEvent->GetType(eventType);
|
|
|
|
if (eventType.EqualsLiteral("mouseover")) {
|
|
|
|
mOwner->MouseOver();
|
|
|
|
}
|
2011-08-31 05:16:13 -07:00
|
|
|
else if (eventType.EqualsLiteral("click")) {
|
2011-06-28 10:59:14 -07:00
|
|
|
mOwner->MouseClick();
|
|
|
|
}
|
|
|
|
else if (eventType.EqualsLiteral("mouseout")) {
|
|
|
|
mOwner->MouseOut();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
NS_ABORT();
|
|
|
|
}
|
|
|
|
|
2009-11-03 14:43:39 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsMathMLmactionFrame::MouseOver()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
// see if we should display a status message
|
|
|
|
if (NS_MATHML_ACTION_TYPE_STATUSLINE == mActionType) {
|
2012-03-29 02:50:02 -07:00
|
|
|
// retrieve content from a second child if it exists
|
|
|
|
nsIFrame* childFrame = mFrames.FrameAt(1);
|
|
|
|
if (!childFrame) return;
|
|
|
|
|
|
|
|
nsIContent* content = childFrame->GetContent();
|
|
|
|
if (!content) return;
|
|
|
|
|
|
|
|
// check whether the content is mtext or not
|
|
|
|
if (content->GetNameSpaceID() == kNameSpaceID_MathML &&
|
|
|
|
content->Tag() == nsGkAtoms::mtext_) {
|
|
|
|
// get the text to be displayed
|
|
|
|
content = content->GetFirstChild();
|
|
|
|
if (!content) return;
|
|
|
|
|
|
|
|
const nsTextFragment* textFrg = content->GetText();
|
|
|
|
if (!textFrg) return;
|
|
|
|
|
|
|
|
nsAutoString text;
|
|
|
|
textFrg->AppendTo(text);
|
|
|
|
// collapse whitespaces as listed in REC, section 3.2.6.1
|
|
|
|
text.CompressWhitespace();
|
|
|
|
ShowStatus(PresContext(), text);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-03 14:43:39 -08:00
|
|
|
void
|
|
|
|
nsMathMLmactionFrame::MouseOut()
|
|
|
|
{
|
2007-03-22 10:30:00 -07:00
|
|
|
// see if we should remove the status message
|
|
|
|
if (NS_MATHML_ACTION_TYPE_STATUSLINE == mActionType) {
|
|
|
|
nsAutoString value;
|
|
|
|
value.SetLength(0);
|
2007-03-30 14:11:41 -07:00
|
|
|
ShowStatus(PresContext(), value);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-03 14:43:39 -08:00
|
|
|
void
|
|
|
|
nsMathMLmactionFrame::MouseClick()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (NS_MATHML_ACTION_TYPE_TOGGLE == mActionType) {
|
|
|
|
if (mChildCount > 1) {
|
|
|
|
PRInt32 selection = (mSelection == mChildCount)? 1 : mSelection + 1;
|
|
|
|
nsAutoString value;
|
|
|
|
char cbuf[10];
|
|
|
|
PR_snprintf(cbuf, sizeof(cbuf), "%d", selection);
|
|
|
|
value.AssignASCII(cbuf);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool notify = false; // don't yet notify the document
|
2007-03-22 10:30:00 -07:00
|
|
|
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::selection_, value, notify);
|
|
|
|
|
|
|
|
// Now trigger a content-changed reflow...
|
2007-03-30 14:11:41 -07:00
|
|
|
PresContext()->PresShell()->
|
2007-05-06 12:16:51 -07:00
|
|
|
FrameNeedsReflow(mSelectedFrame, nsIPresShell::eTreeChange,
|
|
|
|
NS_FRAME_IS_DIRTY);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|