Bug 1866894 - Update failing subtest for content-visibility-auto-resize.html. r=fredw
[gecko.git] / dom / xul / XULResizerElement.h
blobf7c9e4d75d4707e673cc217bd67d26347718c3ea
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_dom_XULResizerElement_h
8 #define mozilla_dom_XULResizerElement_h
10 #include "nsXULElement.h"
11 #include "Units.h"
13 namespace mozilla::dom {
15 nsXULElement* NS_NewXULResizerElement(
16 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
18 class XULResizerElement final : public nsXULElement {
19 public:
20 explicit XULResizerElement(already_AddRefed<dom::NodeInfo>&& aNodeInfo)
21 : nsXULElement(std::move(aNodeInfo)) {}
23 MOZ_CAN_RUN_SCRIPT
24 nsresult PostHandleEvent(EventChainPostVisitor&) override;
26 private:
27 virtual ~XULResizerElement() = default;
28 JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
30 MOZ_CAN_RUN_SCRIPT
31 void PostHandleEventInternal(EventChainPostVisitor&);
33 struct Direction {
34 int8_t mHorizontal;
35 int8_t mVertical;
37 Direction GetDirection();
39 nsIContent* GetContentToResize() const;
40 // The current size of the content to resize (if available).
41 Maybe<nsSize> GetCurrentSize() const;
43 struct SizeInfo {
44 nsCString width, height;
46 static void SizeInfoDtorFunc(void* aObject, nsAtom* aPropertyName,
47 void* aPropertyValue, void* aData);
48 static void ResizeContent(nsIContent* aContent, const Direction& aDirection,
49 const SizeInfo& aSizeInfo,
50 SizeInfo* aOriginalSizeInfo);
51 static void MaybePersistOriginalSize(nsIContent* aContent,
52 const SizeInfo& aSizeInfo);
53 static void RestoreOriginalSize(nsIContent* aContent);
55 nsSize mMouseDownSize;
56 LayoutDeviceIntPoint mMouseDownPoint;
57 bool mTrackingMouseMove = false;
60 } // namespace mozilla::dom
62 #endif // XULResizerElement_h