OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "core/layout/LayoutBlock.h" | 29 #include "core/layout/LayoutBlock.h" |
30 #include "platform/scroll/ScrollTypes.h" | 30 #include "platform/scroll/ScrollTypes.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class LayoutScrollbar; | 34 class LayoutScrollbar; |
35 | 35 |
36 class LayoutScrollbarPart final : public LayoutBlock { | 36 class LayoutScrollbarPart final : public LayoutBlock { |
37 public: | 37 public: |
38 static LayoutScrollbarPart* createAnonymous(Document*, LayoutScrollbar* = nu
llptr, ScrollbarPart = NoPart); | 38 static LayoutScrollbarPart* createAnonymous(Document*, LayoutScrollbar* = nu
llptr, ScrollbarPart = NoPart); |
| 39 ~LayoutScrollbarPart() override; |
39 | 40 |
40 virtual ~LayoutScrollbarPart(); | 41 const char* name() const override { return "LayoutScrollbarPart"; } |
41 | 42 |
42 virtual const char* name() const override { return "LayoutScrollbarPart"; } | 43 DeprecatedPaintLayerType layerTypeRequired() const override { return NoDepre
catedPaintLayer; } |
43 | 44 |
44 virtual DeprecatedPaintLayerType layerTypeRequired() const override { return
NoDeprecatedPaintLayer; } | 45 void layout() override; |
45 | |
46 virtual void layout() override; | |
47 | 46 |
48 // Scrollbar parts needs to be rendered at device pixel boundaries. | 47 // Scrollbar parts needs to be rendered at device pixel boundaries. |
49 virtual LayoutRectOutsets marginBoxOutsets() const override | 48 LayoutRectOutsets marginBoxOutsets() const override |
50 { | 49 { |
51 ASSERT(isIntegerValue(LayoutBlock::marginBoxOutsets().top())); | 50 ASSERT(isIntegerValue(LayoutBlock::marginBoxOutsets().top())); |
52 return LayoutBlock::marginBoxOutsets(); | 51 return LayoutBlock::marginBoxOutsets(); |
53 } | 52 } |
54 virtual LayoutUnit marginTop() const override | 53 LayoutUnit marginTop() const override |
55 { | 54 { |
56 ASSERT(isIntegerValue(LayoutBlock::marginTop())); | 55 ASSERT(isIntegerValue(LayoutBlock::marginTop())); |
57 return LayoutBlock::marginTop(); | 56 return LayoutBlock::marginTop(); |
58 } | 57 } |
59 virtual LayoutUnit marginBottom() const override | 58 LayoutUnit marginBottom() const override |
60 { | 59 { |
61 ASSERT(isIntegerValue(LayoutBlock::marginBottom())); | 60 ASSERT(isIntegerValue(LayoutBlock::marginBottom())); |
62 return LayoutBlock::marginBottom(); | 61 return LayoutBlock::marginBottom(); |
63 } | 62 } |
64 virtual LayoutUnit marginLeft() const override | 63 LayoutUnit marginLeft() const override |
65 { | 64 { |
66 ASSERT(isIntegerValue(LayoutBlock::marginLeft())); | 65 ASSERT(isIntegerValue(LayoutBlock::marginLeft())); |
67 return LayoutBlock::marginLeft(); | 66 return LayoutBlock::marginLeft(); |
68 } | 67 } |
69 virtual LayoutUnit marginRight() const override | 68 LayoutUnit marginRight() const override |
70 { | 69 { |
71 ASSERT(isIntegerValue(LayoutBlock::marginRight())); | 70 ASSERT(isIntegerValue(LayoutBlock::marginRight())); |
72 return LayoutBlock::marginRight(); | 71 return LayoutBlock::marginRight(); |
73 } | 72 } |
74 | 73 |
75 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectLayoutScrollbarPart || LayoutBlock::isOfType(type); } | 74 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectLayoutScrollbarPart || LayoutBlock::isOfType(type); } |
76 LayoutObject* layoutObjectOwningScrollbar() const; | 75 LayoutObject* layoutObjectOwningScrollbar() const; |
77 | 76 |
78 protected: | 77 protected: |
79 virtual void styleWillChange(StyleDifference, const ComputedStyle& newStyle)
override; | 78 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid
e; |
80 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle)
override; | 79 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; |
81 virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) overrid
e; | 80 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override; |
82 | 81 |
83 private: | 82 private: |
84 LayoutScrollbarPart(LayoutScrollbar*, ScrollbarPart); | 83 LayoutScrollbarPart(LayoutScrollbar*, ScrollbarPart); |
85 | 84 |
86 virtual void computePreferredLogicalWidths() override; | 85 void computePreferredLogicalWidths() override; |
87 | 86 |
88 // Have all padding getters return 0. The important point here is to avoid r
esolving percents | 87 // Have all padding getters return 0. The important point here is to avoid r
esolving percents |
89 // against the containing block, since scroll bar corners don't always have
one (so it would | 88 // against the containing block, since scroll bar corners don't always have
one (so it would |
90 // crash). Scroll bar corners are not actually laid out, and they don't have
child content, so | 89 // crash). Scroll bar corners are not actually laid out, and they don't have
child content, so |
91 // what we return here doesn't really matter. | 90 // what we return here doesn't really matter. |
92 virtual LayoutUnit paddingTop() const override { return LayoutUnit(); } | 91 LayoutUnit paddingTop() const override { return LayoutUnit(); } |
93 virtual LayoutUnit paddingBottom() const override { return LayoutUnit(); } | 92 LayoutUnit paddingBottom() const override { return LayoutUnit(); } |
94 virtual LayoutUnit paddingLeft() const override { return LayoutUnit(); } | 93 LayoutUnit paddingLeft() const override { return LayoutUnit(); } |
95 virtual LayoutUnit paddingRight() const override { return LayoutUnit(); } | 94 LayoutUnit paddingRight() const override { return LayoutUnit(); } |
96 virtual LayoutUnit paddingBefore() const override { return LayoutUnit(); } | 95 LayoutUnit paddingBefore() const override { return LayoutUnit(); } |
97 virtual LayoutUnit paddingAfter() const override { return LayoutUnit(); } | 96 LayoutUnit paddingAfter() const override { return LayoutUnit(); } |
98 virtual LayoutUnit paddingStart() const override { return LayoutUnit(); } | 97 LayoutUnit paddingStart() const override { return LayoutUnit(); } |
99 virtual LayoutUnit paddingEnd() const override { return LayoutUnit(); } | 98 LayoutUnit paddingEnd() const override { return LayoutUnit(); } |
100 | 99 |
101 void layoutHorizontalPart(); | 100 void layoutHorizontalPart(); |
102 void layoutVerticalPart(); | 101 void layoutVerticalPart(); |
103 | 102 |
104 void computeScrollbarWidth(); | 103 void computeScrollbarWidth(); |
105 void computeScrollbarHeight(); | 104 void computeScrollbarHeight(); |
106 | 105 |
107 LayoutScrollbar* m_scrollbar; | 106 LayoutScrollbar* m_scrollbar; |
108 ScrollbarPart m_part; | 107 ScrollbarPart m_part; |
109 }; | 108 }; |
110 | 109 |
111 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutScrollbarPart, isLayoutScrollbarPart()); | 110 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutScrollbarPart, isLayoutScrollbarPart()); |
112 | 111 |
113 } // namespace blink | 112 } // namespace blink |
114 | 113 |
115 #endif // LayoutScrollbarPart_h | 114 #endif // LayoutScrollbarPart_h |
OLD | NEW |