2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-09-09 02:34:40 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* 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/
|
1998-09-09 02:34:40 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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.
|
1998-09-09 02:34:40 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* 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"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/* rendering object for HTML <br> elements */
|
|
|
|
|
1999-09-10 00:53:18 +04:00
|
|
|
#include "nsCOMPtr.h"
|
1998-09-09 02:34:40 +04:00
|
|
|
#include "nsFrame.h"
|
|
|
|
#include "nsHTMLParts.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
1998-09-15 04:19:49 +04:00
|
|
|
#include "nsLineLayout.h"
|
1998-09-09 02:34:40 +04:00
|
|
|
#include "nsStyleConsts.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2011-04-08 05:04:40 +04:00
|
|
|
#include "nsRenderingContext.h"
|
2007-05-05 10:09:50 +04:00
|
|
|
#include "nsLayoutUtils.h"
|
1998-09-09 02:34:40 +04:00
|
|
|
|
2006-07-12 17:51:50 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
#include "nsIServiceManager.h"
|
2011-01-28 07:38:14 +03:00
|
|
|
#include "nsAccessibilityService.h"
|
2006-07-12 17:51:50 +04:00
|
|
|
#endif
|
|
|
|
|
1999-11-23 23:30:21 +03:00
|
|
|
//FOR SELECTION
|
|
|
|
#include "nsIContent.h"
|
2006-04-26 06:01:07 +04:00
|
|
|
#include "nsFrameSelection.h"
|
1999-11-23 23:30:21 +03:00
|
|
|
//END INCLUDES FOR SELECTION
|
|
|
|
|
2010-08-31 22:54:44 +04:00
|
|
|
#define BR_USING_CENTERED_FONT_BASELINE NS_FRAME_STATE_BIT(63)
|
|
|
|
|
1998-10-03 08:28:05 +04:00
|
|
|
class BRFrame : public nsFrame {
|
1998-09-09 02:34:40 +04:00
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
friend nsIFrame* NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
|
2006-02-27 08:57:37 +03:00
|
|
|
virtual ContentOffsets CalcContentOffsetsFromFramePoint(nsPoint aPoint);
|
2005-12-08 02:08:39 +03:00
|
|
|
|
2006-09-12 00:43:01 +04:00
|
|
|
virtual PRBool PeekOffsetNoAmount(PRBool aForward, PRInt32* aOffset);
|
2010-12-17 01:17:41 +03:00
|
|
|
virtual PRBool PeekOffsetCharacter(PRBool aForward, PRInt32* aOffset,
|
|
|
|
PRBool aRespectClusters = PR_TRUE);
|
2006-09-12 00:43:01 +04:00
|
|
|
virtual PRBool PeekOffsetWord(PRBool aForward, PRBool aWordSelectEatSpace, PRBool aIsKeyboardSelect,
|
2007-08-30 07:10:19 +04:00
|
|
|
PRInt32* aOffset, PeekWordState* aState);
|
1998-09-09 02:34:40 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1999-11-23 23:30:21 +03:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
InlineMinWidthData *aData);
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
InlinePrefWidthData *aData);
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
2003-10-31 23:19:18 +03:00
|
|
|
virtual nsIAtom* GetType() const;
|
2010-08-31 22:54:44 +04:00
|
|
|
virtual nscoord GetBaseline() const;
|
2007-02-24 21:33:33 +03:00
|
|
|
|
|
|
|
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
|
|
|
|
{
|
2007-05-18 10:04:04 +04:00
|
|
|
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced |
|
|
|
|
nsIFrame::eLineParticipant));
|
2007-02-24 21:33:33 +03:00
|
|
|
}
|
2006-07-12 18:35:43 +04:00
|
|
|
|
2010-06-28 16:02:03 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
2006-07-12 18:35:43 +04:00
|
|
|
#endif
|
2006-07-12 17:51:50 +04:00
|
|
|
|
1998-09-09 02:34:40 +04:00
|
|
|
protected:
|
2006-03-27 01:30:36 +04:00
|
|
|
BRFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
|
1998-09-09 02:34:40 +04:00
|
|
|
virtual ~BRFrame();
|
|
|
|
};
|
|
|
|
|
2005-11-01 23:40:54 +03:00
|
|
|
nsIFrame*
|
2006-03-27 01:30:36 +04:00
|
|
|
NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1998-09-09 02:34:40 +04:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) BRFrame(aContext);
|
1998-09-09 02:34:40 +04:00
|
|
|
}
|
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(BRFrame)
|
|
|
|
|
1998-09-09 02:34:40 +04:00
|
|
|
BRFrame::~BRFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-08-01 03:15:21 +04:00
|
|
|
BRFrame::Reflow(nsPresContext* aPresContext,
|
1998-10-03 08:28:05 +04:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-09-09 02:34:40 +04:00
|
|
|
{
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("BRFrame");
|
2001-11-14 16:40:03 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
|
2000-02-15 07:26:44 +03:00
|
|
|
aMetrics.height = 0; // BR frames with height 0 are ignored in quirks
|
|
|
|
// mode by nsLineLayout::VerticalAlignFrames .
|
|
|
|
// However, it's not always 0. See below.
|
1998-09-09 02:34:40 +04:00
|
|
|
aMetrics.width = 0;
|
1998-10-03 01:49:47 +04:00
|
|
|
aMetrics.ascent = 0;
|
2010-08-31 22:54:44 +04:00
|
|
|
RemoveStateBits(BR_USING_CENTERED_FONT_BASELINE);
|
1998-09-09 02:34:40 +04:00
|
|
|
|
1999-03-26 03:37:22 +03:00
|
|
|
// Only when the BR is operating in a line-layout situation will it
|
|
|
|
// behave like a BR.
|
1999-10-29 18:32:11 +04:00
|
|
|
nsLineLayout* ll = aReflowState.mLineLayout;
|
|
|
|
if (ll) {
|
2002-08-11 22:00:07 +04:00
|
|
|
// Note that the compatibility mode check excludes AlmostStandards
|
|
|
|
// mode, since this is the inline box model. See bug 161691.
|
2008-06-14 12:28:07 +04:00
|
|
|
if ( ll->LineIsEmpty() ||
|
2007-10-02 06:36:26 +04:00
|
|
|
aPresContext->CompatibilityMode() == eCompatibility_FullStandards ) {
|
2008-06-14 12:28:07 +04:00
|
|
|
// The line is logically empty; any whitespace is trimmed away.
|
1999-04-03 22:57:30 +04:00
|
|
|
//
|
2000-02-15 07:26:44 +03:00
|
|
|
// If this frame is going to terminate the line we know
|
1999-04-03 22:57:30 +04:00
|
|
|
// that nothing else will go on the line. Therefore, in this
|
2000-02-15 07:26:44 +03:00
|
|
|
// case, we provide some height for the BR frame so that it
|
|
|
|
// creates some vertical whitespace. It's necessary to use the
|
|
|
|
// line-height rather than the font size because the
|
|
|
|
// quirks-mode fix that doesn't apply the block's min
|
|
|
|
// line-height makes this necessary to make BR cause a line
|
|
|
|
// of the full line-height
|
|
|
|
|
|
|
|
// We also do this in strict mode because BR should act like a
|
|
|
|
// normal inline frame. That line-height is used is important
|
2009-04-22 21:13:48 +04:00
|
|
|
// here for cases where the line-height is less than 1.
|
2007-05-05 10:09:50 +04:00
|
|
|
nsLayoutUtils::SetFontFromStyle(aReflowState.rendContext, mStyleContext);
|
2011-04-08 05:05:49 +04:00
|
|
|
nsFontMetrics *fm = aReflowState.rendContext->FontMetrics();
|
1999-09-10 00:53:18 +04:00
|
|
|
if (fm) {
|
2009-05-19 02:13:12 +04:00
|
|
|
nscoord logicalHeight = aReflowState.CalcLineHeight();
|
2000-02-15 07:26:44 +03:00
|
|
|
aMetrics.height = logicalHeight;
|
2009-05-19 02:13:12 +04:00
|
|
|
aMetrics.ascent =
|
|
|
|
nsLayoutUtils::GetCenteredFontBaseline(fm, logicalHeight);
|
2010-08-31 22:54:44 +04:00
|
|
|
AddStateBits(BR_USING_CENTERED_FONT_BASELINE);
|
1999-09-10 00:53:18 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
aMetrics.ascent = aMetrics.height = 0;
|
|
|
|
}
|
2008-06-17 02:39:30 +04:00
|
|
|
|
|
|
|
// XXX temporary until I figure out a better solution; see the
|
|
|
|
// code in nsLineLayout::VerticalAlignFrames that zaps minY/maxY
|
|
|
|
// if the width is zero.
|
|
|
|
// XXX This also fixes bug 10036!
|
|
|
|
// Warning: nsTextControlFrame::CalculateSizeStandard depends on
|
|
|
|
// the following line, see bug 228752.
|
|
|
|
aMetrics.width = 1;
|
1999-04-03 22:57:30 +04:00
|
|
|
}
|
1999-03-26 03:37:22 +03:00
|
|
|
|
|
|
|
// Return our reflow status
|
|
|
|
PRUint32 breakType = aReflowState.mStyleDisplay->mBreakType;
|
|
|
|
if (NS_STYLE_CLEAR_NONE == breakType) {
|
|
|
|
breakType = NS_STYLE_CLEAR_LINE;
|
|
|
|
}
|
1998-10-03 08:28:05 +04:00
|
|
|
|
1999-03-26 03:37:22 +03:00
|
|
|
aStatus = NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
|
|
|
|
NS_INLINE_MAKE_BREAK_TYPE(breakType);
|
1999-10-29 18:32:11 +04:00
|
|
|
ll->SetLineEndsInBR(PR_TRUE);
|
1999-03-26 03:37:22 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
}
|
2010-10-07 08:25:46 +04:00
|
|
|
|
|
|
|
aMetrics.SetOverflowAreasToDesiredBounds();
|
2002-05-29 02:50:43 +04:00
|
|
|
|
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
|
1998-10-03 08:28:05 +04:00
|
|
|
return NS_OK;
|
1998-09-09 02:34:40 +04:00
|
|
|
}
|
1999-06-20 00:36:44 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
/* virtual */ void
|
2011-04-08 05:04:40 +04:00
|
|
|
BRFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsIFrame::InlineMinWidthData *aData)
|
|
|
|
{
|
2007-06-22 02:32:47 +04:00
|
|
|
aData->ForceBreak(aRenderingContext);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* virtual */ void
|
2011-04-08 05:04:40 +04:00
|
|
|
BRFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsIFrame::InlinePrefWidthData *aData)
|
|
|
|
{
|
2007-06-22 02:32:47 +04:00
|
|
|
aData->ForceBreak(aRenderingContext);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* virtual */ nscoord
|
2011-04-08 05:04:40 +04:00
|
|
|
BRFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
{
|
|
|
|
nscoord result = 0;
|
|
|
|
DISPLAY_MIN_WIDTH(this, result);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* virtual */ nscoord
|
2011-04-08 05:04:40 +04:00
|
|
|
BRFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
{
|
|
|
|
nscoord result = 0;
|
|
|
|
DISPLAY_PREF_WIDTH(this, result);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2003-10-31 23:19:18 +03:00
|
|
|
nsIAtom*
|
|
|
|
BRFrame::GetType() const
|
2000-02-15 07:26:44 +03:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
return nsGkAtoms::brFrame;
|
2000-02-15 07:26:44 +03:00
|
|
|
}
|
1999-06-20 00:36:44 +04:00
|
|
|
|
2010-08-31 22:54:44 +04:00
|
|
|
nscoord
|
|
|
|
BRFrame::GetBaseline() const
|
|
|
|
{
|
|
|
|
nscoord ascent = 0;
|
2011-04-08 05:05:49 +04:00
|
|
|
nsRefPtr<nsFontMetrics> fm;
|
2010-08-31 22:54:44 +04:00
|
|
|
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
|
|
|
if (fm) {
|
|
|
|
nscoord logicalHeight = GetRect().height;
|
|
|
|
if (GetStateBits() & BR_USING_CENTERED_FONT_BASELINE) {
|
|
|
|
ascent = nsLayoutUtils::GetCenteredFontBaseline(fm, logicalHeight);
|
|
|
|
} else {
|
2011-04-08 08:18:43 +04:00
|
|
|
ascent = fm->MaxAscent() + GetUsedBorderAndPadding().top;
|
2010-08-31 22:54:44 +04:00
|
|
|
}
|
|
|
|
}
|
2011-04-08 11:35:49 +04:00
|
|
|
return NS_MIN(mRect.height, ascent);
|
2010-08-31 22:54:44 +04:00
|
|
|
}
|
|
|
|
|
2006-02-27 08:57:37 +03:00
|
|
|
nsIFrame::ContentOffsets BRFrame::CalcContentOffsetsFromFramePoint(nsPoint aPoint)
|
1999-09-30 00:04:05 +04:00
|
|
|
{
|
2006-02-27 08:57:37 +03:00
|
|
|
ContentOffsets offsets;
|
|
|
|
offsets.content = mContent->GetParent();
|
|
|
|
if (offsets.content) {
|
|
|
|
offsets.offset = offsets.content->IndexOf(mContent);
|
|
|
|
offsets.secondaryOffset = offsets.offset;
|
|
|
|
offsets.associateWithNext = PR_TRUE;
|
2005-12-08 02:08:39 +03:00
|
|
|
}
|
2006-02-27 08:57:37 +03:00
|
|
|
return offsets;
|
1999-11-23 23:30:21 +03:00
|
|
|
}
|
|
|
|
|
2006-09-12 00:43:01 +04:00
|
|
|
PRBool
|
|
|
|
BRFrame::PeekOffsetNoAmount(PRBool aForward, PRInt32* aOffset)
|
1999-11-23 23:30:21 +03:00
|
|
|
{
|
2006-09-12 00:43:01 +04:00
|
|
|
NS_ASSERTION (aOffset && *aOffset <= 1, "aOffset out of range");
|
|
|
|
PRInt32 startOffset = *aOffset;
|
|
|
|
// If we hit the end of a BR going backwards, go to its beginning and stay there.
|
|
|
|
if (!aForward && startOffset != 0) {
|
|
|
|
*aOffset = 0;
|
|
|
|
return PR_TRUE;
|
2006-07-12 02:11:02 +04:00
|
|
|
}
|
2006-09-12 00:43:01 +04:00
|
|
|
// Otherwise, stop if we hit the beginning, continue (forward) if we hit the end.
|
|
|
|
return (startOffset == 0);
|
|
|
|
}
|
2005-09-19 09:16:25 +04:00
|
|
|
|
2006-09-12 00:43:01 +04:00
|
|
|
PRBool
|
2010-12-17 01:17:41 +03:00
|
|
|
BRFrame::PeekOffsetCharacter(PRBool aForward, PRInt32* aOffset,
|
|
|
|
PRBool aRespectClusters)
|
2006-09-12 00:43:01 +04:00
|
|
|
{
|
|
|
|
NS_ASSERTION (aOffset && *aOffset <= 1, "aOffset out of range");
|
|
|
|
// Keep going. The actual line jumping will stop us.
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
1999-11-23 23:30:21 +03:00
|
|
|
|
2006-09-12 00:43:01 +04:00
|
|
|
PRBool
|
|
|
|
BRFrame::PeekOffsetWord(PRBool aForward, PRBool aWordSelectEatSpace, PRBool aIsKeyboardSelect,
|
2007-08-30 07:10:19 +04:00
|
|
|
PRInt32* aOffset, PeekWordState* aState)
|
2006-09-12 00:43:01 +04:00
|
|
|
{
|
|
|
|
NS_ASSERTION (aOffset && *aOffset <= 1, "aOffset out of range");
|
|
|
|
// Keep going. The actual line jumping will stop us.
|
|
|
|
return PR_FALSE;
|
1999-09-30 00:04:05 +04:00
|
|
|
}
|
2006-07-12 17:51:50 +04:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2010-06-28 16:02:03 +04:00
|
|
|
already_AddRefed<nsAccessible>
|
|
|
|
BRFrame::CreateAccessible()
|
2006-07-12 17:51:50 +04:00
|
|
|
{
|
2011-01-28 07:38:14 +03:00
|
|
|
nsAccessibilityService* accService = nsIPresShell::AccService();
|
2010-06-28 16:02:03 +04:00
|
|
|
if (!accService) {
|
|
|
|
return nsnull;
|
|
|
|
}
|
2008-07-23 08:50:20 +04:00
|
|
|
nsIContent *parent = mContent->GetParent();
|
|
|
|
if (parent &&
|
|
|
|
parent->IsRootOfNativeAnonymousSubtree() &&
|
|
|
|
parent->GetChildCount() == 1) {
|
2008-01-14 17:34:40 +03:00
|
|
|
// This <br> is the only node in a text control, therefore it is the hacky
|
|
|
|
// "bogus node" used when there is no text in the control
|
2010-06-28 16:02:03 +04:00
|
|
|
return nsnull;
|
2006-07-12 17:51:50 +04:00
|
|
|
}
|
2010-06-28 16:02:03 +04:00
|
|
|
return accService->CreateHTMLBRAccessible(mContent,
|
|
|
|
PresContext()->PresShell());
|
2006-07-12 17:51:50 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|