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 nsSearchControlFrame_h__
8 #define nsSearchControlFrame_h__
10 #include "mozilla/Attributes.h"
11 #include "nsTextControlFrame.h"
12 #include "nsIAnonymousContentCreator.h"
13 #include "mozilla/RefPtr.h"
15 class nsITextControlFrame
;
19 enum class PseudoStyleType
: uint8_t;
24 } // namespace mozilla
27 * This frame type is used for <input type=search>.
29 class nsSearchControlFrame final
: public nsTextControlFrame
{
30 friend nsIFrame
* NS_NewSearchControlFrame(mozilla::PresShell
* aPresShell
,
31 ComputedStyle
* aStyle
);
33 using PseudoStyleType
= mozilla::PseudoStyleType
;
34 using Element
= mozilla::dom::Element
;
36 explicit nsSearchControlFrame(ComputedStyle
* aStyle
,
37 nsPresContext
* aPresContext
);
41 NS_DECL_FRAMEARENA_HELPERS(nsSearchControlFrame
)
43 void Destroy(DestroyContext
&) override
;
45 // nsIAnonymousContentCreator
46 nsresult
CreateAnonymousContent(nsTArray
<ContentInfo
>& aElements
) override
;
47 void AppendAnonymousContentTo(nsTArray
<nsIContent
*>& aElements
,
48 uint32_t aFilter
) override
;
50 #ifdef DEBUG_FRAME_DUMP
51 nsresult
GetFrameName(nsAString
& aResult
) const override
{
52 return MakeFrameName(u
"SearchControl"_ns
, aResult
);
56 Element
* GetAnonClearButton() const { return mClearButton
; }
59 * Update visbility of the clear button depending on the value
61 void UpdateClearButtonState();
64 // See nsSearchControlFrame::CreateAnonymousContent of a description of these
65 RefPtr
<Element
> mClearButton
;
68 #endif // nsSearchControlFrame_h__