Bug 1692937 [wpt PR 27636] - new parameter --include-file for wptrunner, a=testonly
[gecko.git] / layout / generic / WBRFrame.cpp
blob8ff59820b0fbb3ad921668cdb0a2dd1702304246
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* rendering object for HTML <wbr> elements */
9 #include "nsIFrame.h"
11 using namespace mozilla;
13 namespace mozilla {
15 class WBRFrame final : public nsIFrame {
16 public:
17 NS_DECL_FRAMEARENA_HELPERS(WBRFrame)
19 friend nsIFrame* ::NS_NewWBRFrame(mozilla::PresShell* aPresShell,
20 ComputedStyle* aStyle);
22 virtual FrameSearchResult PeekOffsetNoAmount(bool aForward,
23 int32_t* aOffset) override;
24 virtual FrameSearchResult PeekOffsetCharacter(
25 bool aForward, int32_t* aOffset,
26 PeekOffsetCharacterOptions aOptions =
27 PeekOffsetCharacterOptions()) override;
28 virtual FrameSearchResult PeekOffsetWord(
29 bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
30 int32_t* aOffset, PeekWordState* aState, bool aTrimSpaces) override;
32 protected:
33 explicit WBRFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
34 : nsIFrame(aStyle, aPresContext, kClassID) {}
37 } // namespace mozilla
39 nsIFrame* NS_NewWBRFrame(mozilla::PresShell* aPresShell,
40 ComputedStyle* aStyle) {
41 return new (aPresShell) WBRFrame(aStyle, aPresShell->GetPresContext());
44 NS_IMPL_FRAMEARENA_HELPERS(WBRFrame)
46 nsIFrame::FrameSearchResult WBRFrame::PeekOffsetNoAmount(bool aForward,
47 int32_t* aOffset) {
48 NS_ASSERTION(aOffset && *aOffset <= 1, "aOffset out of range");
49 // WBR frames can not contain text or non-rendered whitespace
50 return CONTINUE;
53 nsIFrame::FrameSearchResult WBRFrame::PeekOffsetCharacter(
54 bool aForward, int32_t* aOffset, PeekOffsetCharacterOptions aOptions) {
55 NS_ASSERTION(aOffset && *aOffset <= 1, "aOffset out of range");
56 // WBR frames can not contain characters
57 return CONTINUE;
60 nsIFrame::FrameSearchResult WBRFrame::PeekOffsetWord(
61 bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
62 int32_t* aOffset, PeekWordState* aState, bool aTrimSpaces) {
63 NS_ASSERTION(aOffset && *aOffset <= 1, "aOffset out of range");
64 // WBR frames can never contain text so we'll never find a word inside them
65 return CONTINUE;