Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / generic / MiddleCroppingBlockFrame.h
blob666b73440e2ab77e96f6056aa13cbf23fb862c97
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 #ifndef mozilla_MiddleCroppingBlockFrame_h
8 #define mozilla_MiddleCroppingBlockFrame_h
10 #include "nsBlockFrame.h"
11 #include "nsIAnonymousContentCreator.h"
12 #include "nsQueryFrame.h"
14 namespace mozilla {
16 // A block frame that implements a simplistic version of middle-cropping. Note
17 // that this is not fully l10n aware or complex-writing-system-friendly, so it's
18 // generally mostly useful for filenames / urls / etc.
19 class MiddleCroppingBlockFrame : public nsBlockFrame,
20 public nsIAnonymousContentCreator {
21 public:
22 virtual void GetUncroppedValue(nsAString&) = 0;
23 void UpdateDisplayedValueToUncroppedValue(bool aNotify);
25 NS_DECL_QUERYFRAME_TARGET(MiddleCroppingBlockFrame)
26 NS_DECL_QUERYFRAME
27 NS_DECL_ABSTRACT_FRAME(MiddleCroppingBlockFrame)
29 protected:
30 MiddleCroppingBlockFrame(ComputedStyle*, nsPresContext*, ClassID);
32 ~MiddleCroppingBlockFrame();
34 void Reflow(nsPresContext*, ReflowOutput&, const ReflowInput&,
35 nsReflowStatus&) override;
37 nscoord GetMinISize(gfxContext*) override;
38 nscoord GetPrefISize(gfxContext*) override;
40 /**
41 * Crop aText to fit inside aWidth using the styles of aFrame.
42 * @return true if aText was modified
44 bool CropTextToWidth(gfxContext& aRenderingContext, nscoord aWidth,
45 nsString& aText) const;
47 nsresult CreateAnonymousContent(nsTArray<ContentInfo>&) override;
48 void AppendAnonymousContentTo(nsTArray<nsIContent*>&,
49 uint32_t aFilter) override;
51 /**
52 * Updates the displayed value by using aValue.
54 void UpdateDisplayedValue(const nsAString& aValue, bool aIsCropped,
55 bool aNotify);
56 void Destroy(DestroyContext&) override;
58 RefPtr<dom::Text> mTextNode;
59 bool mCropped = false;
62 } // namespace mozilla
64 #endif