1a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)/*
2a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
3a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) *
4a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without
5a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * modification, are permitted provided that the following conditions
6a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * are met:
7a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) *
8a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * 1. Redistributions of source code must retain the above
9a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) *    copyright notice, this list of conditions and the following
10a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) *    disclaimer.
11a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * 2. Redistributions in binary form must reproduce the above
12a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) *    copyright notice, this list of conditions and the following
13a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) *    disclaimer in the documentation and/or other materials
14a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) *    provided with the distribution.
15a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) *
16a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) * OF THE POSSIBILITY OF SUCH DAMAGE.
28a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) */
29a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
30a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#ifndef BoxShape_h
31a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#define BoxShape_h
32a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
33a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#include "core/rendering/shapes/Shape.h"
34a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#include "platform/geometry/FloatRoundedRect.h"
35a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
36c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
37a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
3809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)class BoxShape FINAL : public Shape {
39a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)public:
4009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    BoxShape(const FloatRoundedRect& bounds)
4109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        : Shape()
4209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        , m_bounds(bounds)
4309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    {
4409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
4509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
4609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual LayoutRect shapeMarginLogicalBoundingBox() const OVERRIDE;
47a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    virtual bool isEmpty() const OVERRIDE { return m_bounds.isEmpty(); }
48e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual LineSegment getExcludedInterval(LayoutUnit logicalTop, LayoutUnit logicalHeight) const OVERRIDE;
49323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    virtual void buildDisplayPaths(DisplayPaths&) const OVERRIDE;
50a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
51a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)private:
5209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    FloatRoundedRect shapeMarginBounds() const;
5309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
54a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    FloatRoundedRect m_bounds;
55a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)};
56a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
57c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink
58a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
59a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#endif // BoxShape_h
60a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
61