Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / layout / LayoutScrollbarPart.h
blob970cefe1af5a87c883c229e6e983d9e839e3f0e6
1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef LayoutScrollbarPart_h
27 #define LayoutScrollbarPart_h
29 #include "core/layout/LayoutBlock.h"
30 #include "platform/scroll/ScrollTypes.h"
32 namespace blink {
34 class LayoutScrollbar;
36 class LayoutScrollbarPart final : public LayoutBlock {
37 public:
38 static LayoutScrollbarPart* createAnonymous(Document*, LayoutScrollbar* = nullptr, ScrollbarPart = NoPart);
39 ~LayoutScrollbarPart() override;
41 const char* name() const override { return "LayoutScrollbarPart"; }
43 DeprecatedPaintLayerType layerTypeRequired() const override { return NoDeprecatedPaintLayer; }
45 void layout() override;
47 // Scrollbar parts needs to be rendered at device pixel boundaries.
48 LayoutRectOutsets marginBoxOutsets() const override
50 ASSERT(isIntegerValue(LayoutBlock::marginBoxOutsets().top()));
51 return LayoutBlock::marginBoxOutsets();
53 LayoutUnit marginTop() const override
55 ASSERT(isIntegerValue(LayoutBlock::marginTop()));
56 return LayoutBlock::marginTop();
58 LayoutUnit marginBottom() const override
60 ASSERT(isIntegerValue(LayoutBlock::marginBottom()));
61 return LayoutBlock::marginBottom();
63 LayoutUnit marginLeft() const override
65 ASSERT(isIntegerValue(LayoutBlock::marginLeft()));
66 return LayoutBlock::marginLeft();
68 LayoutUnit marginRight() const override
70 ASSERT(isIntegerValue(LayoutBlock::marginRight()));
71 return LayoutBlock::marginRight();
74 bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutScrollbarPart || LayoutBlock::isOfType(type); }
75 LayoutObject* layoutObjectOwningScrollbar() const;
77 protected:
78 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override;
79 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
80 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
82 private:
83 LayoutScrollbarPart(LayoutScrollbar*, ScrollbarPart);
85 void computePreferredLogicalWidths() override;
87 // Have all padding getters return 0. The important point here is to avoid resolving percents
88 // against the containing block, since scroll bar corners don't always have one (so it would
89 // crash). Scroll bar corners are not actually laid out, and they don't have child content, so
90 // what we return here doesn't really matter.
91 LayoutUnit paddingTop() const override { return LayoutUnit(); }
92 LayoutUnit paddingBottom() const override { return LayoutUnit(); }
93 LayoutUnit paddingLeft() const override { return LayoutUnit(); }
94 LayoutUnit paddingRight() const override { return LayoutUnit(); }
95 LayoutUnit paddingBefore() const override { return LayoutUnit(); }
96 LayoutUnit paddingAfter() const override { return LayoutUnit(); }
97 LayoutUnit paddingStart() const override { return LayoutUnit(); }
98 LayoutUnit paddingEnd() const override { return LayoutUnit(); }
100 void layoutHorizontalPart();
101 void layoutVerticalPart();
103 void computeScrollbarWidth();
104 void computeScrollbarHeight();
106 GC_PLUGIN_IGNORE("http://crbug.com/509911")
107 LayoutScrollbar* m_scrollbar;
108 ScrollbarPart m_part;
111 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutScrollbarPart, isLayoutScrollbarPart());
113 } // namespace blink
115 #endif // LayoutScrollbarPart_h