2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/* rendering object for HTML <br> elements */
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
#include "gfxContext.h"
|
1999-09-10 00:53:18 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2016-11-30 06:14:29 +03:00
|
|
|
#include "nsContainerFrame.h"
|
2014-10-24 19:28:14 +04:00
|
|
|
#include "nsFontMetrics.h"
|
1998-09-09 02:34:40 +04:00
|
|
|
#include "nsFrame.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"
|
2007-05-05 10:09:50 +04:00
|
|
|
#include "nsLayoutUtils.h"
|
1998-09-09 02:34:40 +04:00
|
|
|
|
1999-11-23 23:30:21 +03:00
|
|
|
// FOR SELECTION
|
|
|
|
#include "nsIContent.h"
|
|
|
|
// END INCLUDES FOR SELECTION
|
|
|
|
|
2012-09-29 01:53:44 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2016-11-30 06:14:29 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
class BRFrame final : public nsFrame {
|
1998-09-09 02:34:40 +04:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(BRFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
friend nsIFrame* ::NS_NewBRFrame(nsIPresShell* aPresShell,
|
|
|
|
ComputedStyle* aStyle);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-11-15 12:55:36 +03:00
|
|
|
ContentOffsets CalcContentOffsetsFromFramePoint(
|
|
|
|
const nsPoint& aPoint) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual FrameSearchResult PeekOffsetNoAmount(bool aForward,
|
|
|
|
int32_t* aOffset) override;
|
Bug 1375825 - part2: ContentEventHandler::ExpandToClusterBoundary() should check the return value of nsTextFrame::PeekOffsetCharacter() r=jfkthame
ContentEventHandler::ExpandToClusterBoundary() doesn't check the return value of nsTextFrame::PeekOffsetCharacter(). Therefore, it may set its result to reversed offset. (e.g., when aForward is true and offset is 6, the result may be 5. When aForward is false and offset is 5, the result may be 6.)
For avoiding that, ContentEventHandler::ExpandToClusterBoundary() should check the result and only when it returns nsIFrame::FOUND, it should compute the proper offset.
On the other hand, it's too bad for ContentEventHandler that nsTextFrame::PeekOffsetCharacter() to return nsIFrame::CONTINUE_UNSELECTABLE when the user-select style is "all" because IME doesn't expect such cases.
Therefore, this patch adds additional argument to nsIFrame::PeekOffsetCharacter(), aOptions which is a struct containing bool members. The reason why it's not a bit mask enum is, such struct doesn't cause simple mistake at checking the value and the code is shorter. When mIgnoreUserStyleAll of it is true, this patch makes nsTextFrame not return nsIFrame::CONTINUE_UNSELECTABLE.
MozReview-Commit-ID: ACNNBTP92YZ
--HG--
extra : rebase_source : bd85da902e7fb59135d15514cb20a5599a4a640b
2017-06-29 04:58:16 +03:00
|
|
|
virtual FrameSearchResult PeekOffsetCharacter(
|
|
|
|
bool aForward, int32_t* aOffset,
|
|
|
|
PeekOffsetCharacterOptions aOptions =
|
|
|
|
PeekOffsetCharacterOptions()) override;
|
2019-03-13 12:19:06 +03:00
|
|
|
virtual FrameSearchResult PeekOffsetWord(
|
|
|
|
bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
|
|
|
|
int32_t* aOffset, PeekWordState* aState, bool aTrimSpaces) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
|
2015-03-21 19:28:04 +03:00
|
|
|
InlineMinISizeData* aData) override;
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
|
2015-03-21 19:28:04 +03:00
|
|
|
InlinePrefISizeData* aData) override;
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nscoord GetLogicalBaseline(
|
|
|
|
mozilla::WritingMode aWritingMode) const override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
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
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
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:
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit BRFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
|
|
|
|
: nsFrame(aStyle, aPresContext, kClassID),
|
|
|
|
mAscent(NS_INTRINSIC_WIDTH_UNKNOWN) {}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
1998-09-09 02:34:40 +04:00
|
|
|
virtual ~BRFrame();
|
2011-11-24 06:48:23 +04:00
|
|
|
|
|
|
|
nscoord mAscent;
|
1998-09-09 02:34:40 +04:00
|
|
|
};
|
|
|
|
|
2016-11-30 06:14:29 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
nsIFrame* NS_NewBRFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) {
|
2019-02-05 19:45:54 +03:00
|
|
|
return new (aPresShell) BRFrame(aStyle, aPresShell->GetPresContext());
|
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() {}
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void BRFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput, nsReflowStatus& aStatus) {
|
2015-03-30 01:38:40 +03:00
|
|
|
MarkInReflow();
|
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");
|
2016-07-21 13:36:39 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
|
2017-09-13 13:00:25 +03:00
|
|
|
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
|
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
WritingMode wm = aReflowInput.GetWritingMode();
|
2014-07-24 12:30:07 +04:00
|
|
|
LogicalSize finalSize(wm);
|
|
|
|
finalSize.BSize(wm) = 0; // BR frames with block size 0 are ignored in quirks
|
|
|
|
// mode by nsLineLayout::VerticalAlignFrames .
|
|
|
|
// However, it's not always 0. See below.
|
|
|
|
finalSize.ISize(wm) = 0;
|
2014-06-11 13:45:31 +04:00
|
|
|
aMetrics.SetBlockStartAscent(0);
|
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
|
2015-04-23 04:32:53 +03:00
|
|
|
// behave like a BR. Additionally, we suppress breaks from BR inside
|
|
|
|
// of ruby frames. To determine if we're inside ruby, we have to rely
|
|
|
|
// on the *parent's* ShouldSuppressLineBreak() method, instead of our
|
|
|
|
// own, because we may have custom "display" value that makes our
|
|
|
|
// ShouldSuppressLineBreak() return false.
|
2016-07-21 13:36:39 +03:00
|
|
|
nsLineLayout* ll = aReflowInput.mLineLayout;
|
2018-03-22 21:20:41 +03:00
|
|
|
if (ll && !GetParent()->Style()->ShouldSuppressLineBreak()) {
|
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.
|
2016-03-17 08:55:48 +03:00
|
|
|
RefPtr<nsFontMetrics> fm =
|
|
|
|
nsLayoutUtils::GetInflatedFontMetricsForFrame(this);
|
1999-09-10 00:53:18 +04:00
|
|
|
if (fm) {
|
2016-07-21 13:36:39 +03:00
|
|
|
nscoord logicalHeight = aReflowInput.CalcLineHeight();
|
2014-07-24 12:30:07 +04:00
|
|
|
finalSize.BSize(wm) = logicalHeight;
|
2014-11-13 11:58:06 +03:00
|
|
|
aMetrics.SetBlockStartAscent(nsLayoutUtils::GetCenteredFontBaseline(
|
|
|
|
fm, logicalHeight, wm.IsLineInverted()));
|
1999-09-10 00:53:18 +04:00
|
|
|
} else {
|
2014-07-24 12:30:07 +04:00
|
|
|
aMetrics.SetBlockStartAscent(aMetrics.BSize(wm) = 0);
|
1999-09-10 00:53:18 +04:00
|
|
|
}
|
2014-05-23 02:10:20 +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.
|
2016-05-09 02:41:00 +03:00
|
|
|
// The code below in AddInlinePrefISize also adds 1 appunit to width
|
2014-07-24 12:30:07 +04:00
|
|
|
finalSize.ISize(wm) = 1;
|
1999-04-03 22:57:30 +04:00
|
|
|
}
|
1999-03-26 03:37:22 +03:00
|
|
|
|
|
|
|
// Return our reflow status
|
2018-07-16 20:01:24 +03:00
|
|
|
StyleClear breakType = aReflowInput.mStyleDisplay->mBreakType;
|
2016-09-03 21:46:58 +03:00
|
|
|
if (StyleClear::None == breakType) {
|
2016-09-07 05:20:17 +03:00
|
|
|
breakType = StyleClear::Line;
|
1999-03-26 03:37:22 +03:00
|
|
|
}
|
1998-10-03 08:28:05 +04:00
|
|
|
|
2017-02-14 06:52:53 +03:00
|
|
|
aStatus.SetInlineLineBreakAfter(breakType);
|
2011-10-17 18:59:28 +04:00
|
|
|
ll->SetLineEndsInBR(true);
|
1999-03-26 03:37:22 +03:00
|
|
|
}
|
2010-10-07 08:25:46 +04:00
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
aMetrics.SetSize(wm, finalSize);
|
2010-10-07 08:25:46 +04:00
|
|
|
aMetrics.SetOverflowAreasToDesiredBounds();
|
2002-05-29 02:50:43 +04:00
|
|
|
|
2014-06-11 13:45:31 +04:00
|
|
|
mAscent = aMetrics.BlockStartAscent();
|
2011-11-24 06:48:23 +04:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
|
1998-09-09 02:34:40 +04:00
|
|
|
}
|
1999-06-20 00:36:44 +04:00
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
void BRFrame::AddInlineMinISize(gfxContext* aRenderingContext,
|
|
|
|
nsIFrame::InlineMinISizeData* aData) {
|
2018-03-22 21:20:41 +03:00
|
|
|
if (!GetParent()->Style()->ShouldSuppressLineBreak()) {
|
2015-12-07 01:13:57 +03:00
|
|
|
aData->ForceBreak();
|
2015-02-21 14:39:33 +03: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
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
void BRFrame::AddInlinePrefISize(gfxContext* aRenderingContext,
|
|
|
|
nsIFrame::InlinePrefISizeData* aData) {
|
2018-03-22 21:20:41 +03:00
|
|
|
if (!GetParent()->Style()->ShouldSuppressLineBreak()) {
|
2016-05-09 02:41:00 +03:00
|
|
|
// Match the 1 appunit width assigned in the Reflow method above
|
|
|
|
aData->mCurrentLine += 1;
|
2015-12-07 01:13:57 +03:00
|
|
|
aData->ForceBreak();
|
2015-02-21 14:39:33 +03: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
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nscoord BRFrame::GetMinISize(gfxContext* 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;
|
2018-09-12 15:35:47 +03:00
|
|
|
DISPLAY_MIN_INLINE_SIZE(this, result);
|
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
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2019-02-26 01:09:24 +03:00
|
|
|
/* virtual */
|
|
|
|
nscoord BRFrame::GetPrefISize(gfxContext* 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;
|
2018-09-12 15:35:47 +03:00
|
|
|
DISPLAY_PREF_INLINE_SIZE(this, result);
|
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
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2014-06-17 16:19:38 +04:00
|
|
|
nscoord BRFrame::GetLogicalBaseline(mozilla::WritingMode aWritingMode) const {
|
2011-11-24 06:48:23 +04:00
|
|
|
return mAscent;
|
2010-08-31 22:54:44 +04:00
|
|
|
}
|
|
|
|
|
2017-11-15 12:55:36 +03:00
|
|
|
nsIFrame::ContentOffsets BRFrame::CalcContentOffsetsFromFramePoint(
|
|
|
|
const nsPoint& aPoint) {
|
2006-02-27 08:57:37 +03:00
|
|
|
ContentOffsets offsets;
|
|
|
|
offsets.content = mContent->GetParent();
|
|
|
|
if (offsets.content) {
|
2018-01-23 16:30:18 +03:00
|
|
|
offsets.offset = offsets.content->ComputeIndexOf(mContent);
|
2006-02-27 08:57:37 +03:00
|
|
|
offsets.secondaryOffset = offsets.offset;
|
2014-08-06 09:19:27 +04:00
|
|
|
offsets.associate = CARET_ASSOCIATE_AFTER;
|
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
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsIFrame::FrameSearchResult BRFrame::PeekOffsetNoAmount(bool aForward,
|
|
|
|
int32_t* aOffset) {
|
2006-09-12 00:43:01 +04:00
|
|
|
NS_ASSERTION(aOffset && *aOffset <= 1, "aOffset out of range");
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t startOffset = *aOffset;
|
2006-09-12 00:43:01 +04:00
|
|
|
// If we hit the end of a BR going backwards, go to its beginning and stay
|
|
|
|
// there.
|
|
|
|
if (!aForward && startOffset != 0) {
|
|
|
|
*aOffset = 0;
|
2014-03-13 18:14:37 +04:00
|
|
|
return FOUND;
|
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.
|
2014-03-13 18:14:37 +04:00
|
|
|
return (startOffset == 0) ? FOUND : CONTINUE;
|
2006-09-12 00:43:01 +04:00
|
|
|
}
|
2005-09-19 09:16:25 +04:00
|
|
|
|
2014-03-13 18:14:37 +04:00
|
|
|
nsIFrame::FrameSearchResult BRFrame::PeekOffsetCharacter(
|
2012-08-22 19:56:38 +04:00
|
|
|
bool aForward, int32_t* aOffset, PeekOffsetCharacterOptions aOptions) {
|
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.
|
2014-03-13 18:14:37 +04:00
|
|
|
return CONTINUE;
|
2006-09-12 00:43:01 +04:00
|
|
|
}
|
1999-11-23 23:30:21 +03:00
|
|
|
|
2019-03-13 12:19:06 +03:00
|
|
|
nsIFrame::FrameSearchResult BRFrame::PeekOffsetWord(
|
|
|
|
bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
|
|
|
|
int32_t* aOffset, PeekWordState* aState, bool aTrimSpaces) {
|
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.
|
2014-03-13 18:14:37 +04:00
|
|
|
return CONTINUE;
|
1999-09-30 00:04:05 +04:00
|
|
|
}
|
2006-07-12 17:51:50 +04:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-29 01:53:44 +04:00
|
|
|
a11y::AccType BRFrame::AccessibleType() {
|
2008-07-23 08:50:20 +04:00
|
|
|
nsIContent* parent = mContent->GetParent();
|
2012-09-29 01:53:44 +04:00
|
|
|
if (parent && parent->IsRootOfNativeAnonymousSubtree() &&
|
2008-07-23 08:50:20 +04:00
|
|
|
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
|
2012-12-12 14:04:12 +04:00
|
|
|
return a11y::eNoType;
|
2006-07-12 17:51:50 +04:00
|
|
|
}
|
2012-09-29 01:53:44 +04:00
|
|
|
|
2016-02-25 15:09:59 +03:00
|
|
|
// Trailing HTML br element don't play any difference. We don't need to expose
|
|
|
|
// it to AT (see bug https://bugzilla.mozilla.org/show_bug.cgi?id=899433#c16
|
|
|
|
// for details).
|
|
|
|
if (!mContent->GetNextSibling() && !GetNextSibling()) {
|
|
|
|
return a11y::eNoType;
|
|
|
|
}
|
|
|
|
|
2012-12-18 05:25:52 +04:00
|
|
|
return a11y::eHTMLBRType;
|
2006-07-12 17:51:50 +04:00
|
|
|
}
|
|
|
|
#endif
|