OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef AXSpinButton_h | 26 #ifndef AXSpinButton_h |
27 #define AXSpinButton_h | 27 #define AXSpinButton_h |
28 | 28 |
29 #include "core/html/shadow/SpinButtonElement.h" | 29 #include "core/html/shadow/SpinButtonElement.h" |
30 #include "modules/accessibility/AXMockObject.h" | 30 #include "modules/accessibility/AXMockObject.h" |
31 | 31 |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
| 35 class AXObjectCache; |
| 36 |
35 class AXSpinButton final : public AXMockObject { | 37 class AXSpinButton final : public AXMockObject { |
36 public: | 38 public: |
37 static PassRefPtr<AXSpinButton> create(); | 39 static PassRefPtr<AXSpinButton> create(AXObjectCache*); |
38 virtual ~AXSpinButton(); | 40 virtual ~AXSpinButton(); |
39 | 41 |
40 void setSpinButtonElement(SpinButtonElement* spinButton) { m_spinButtonEleme
nt = spinButton; } | 42 void setSpinButtonElement(SpinButtonElement* spinButton) { m_spinButtonEleme
nt = spinButton; } |
41 void step(int amount); | 43 void step(int amount); |
42 | 44 |
43 private: | 45 private: |
44 AXSpinButton(); | 46 explicit AXSpinButton(AXObjectCache*); |
45 | 47 |
46 virtual AccessibilityRole roleValue() const override { return SpinButtonRole
; } | 48 virtual AccessibilityRole roleValue() const override { return SpinButtonRole
; } |
47 virtual bool isSpinButton() const override { return true; } | 49 virtual bool isSpinButton() const override { return true; } |
48 virtual bool isNativeSpinButton() const override { return true; } | 50 virtual bool isNativeSpinButton() const override { return true; } |
49 virtual void addChildren() override; | 51 virtual void addChildren() override; |
50 virtual LayoutRect elementRect() const override; | 52 virtual LayoutRect elementRect() const override; |
51 | 53 |
52 SpinButtonElement* m_spinButtonElement; | 54 SpinButtonElement* m_spinButtonElement; |
53 }; | 55 }; |
54 | 56 |
55 class AXSpinButtonPart final : public AXMockObject { | 57 class AXSpinButtonPart final : public AXMockObject { |
56 public: | 58 public: |
57 static PassRefPtr<AXSpinButtonPart> create(); | 59 static PassRefPtr<AXSpinButtonPart> create(AXObjectCache*); |
58 virtual ~AXSpinButtonPart() { } | 60 virtual ~AXSpinButtonPart() { } |
59 | 61 |
60 bool isIncrementor() const { return m_isIncrementor; } | 62 bool isIncrementor() const { return m_isIncrementor; } |
61 void setIsIncrementor(bool value) { m_isIncrementor = value; } | 63 void setIsIncrementor(bool value) { m_isIncrementor = value; } |
62 | 64 |
63 private: | 65 private: |
64 AXSpinButtonPart(); | 66 AXSpinButtonPart(AXObjectCache*); |
65 bool m_isIncrementor : 1; | 67 bool m_isIncrementor : 1; |
66 | 68 |
67 virtual bool press() const override; | 69 virtual bool press() const override; |
68 virtual AccessibilityRole roleValue() const override { return ButtonRole; } | 70 virtual AccessibilityRole roleValue() const override { return ButtonRole; } |
69 virtual bool isSpinButtonPart() const override { return true; } | 71 virtual bool isSpinButtonPart() const override { return true; } |
70 virtual LayoutRect elementRect() const override; | 72 virtual LayoutRect elementRect() const override; |
71 }; | 73 }; |
72 | 74 |
73 DEFINE_AX_OBJECT_TYPE_CASTS(AXSpinButton, isNativeSpinButton()); | 75 DEFINE_AX_OBJECT_TYPE_CASTS(AXSpinButton, isNativeSpinButton()); |
74 DEFINE_AX_OBJECT_TYPE_CASTS(AXSpinButtonPart, isSpinButtonPart()); | 76 DEFINE_AX_OBJECT_TYPE_CASTS(AXSpinButtonPart, isSpinButtonPart()); |
75 | 77 |
76 } // namespace blink | 78 } // namespace blink |
77 | 79 |
78 #endif // AXSpinButton_h | 80 #endif // AXSpinButton_h |
OLD | NEW |