1 /*
2  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3  *           (C) 2000 Antti Koivisto (koivisto@kde.org)
4  *           (C) 2000 Dirk Mueller (mueller@kde.org)
5  * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6  * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  */
24 
25 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_CURSOR_DATA_H_
26 #define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_CURSOR_DATA_H_
27 
28 #include "third_party/blink/renderer/core/style/data_equivalency.h"
29 #include "third_party/blink/renderer/core/style/style_image.h"
30 #include "third_party/blink/renderer/platform/geometry/int_point.h"
31 
32 namespace blink {
33 
34 class CursorData {
35   DISALLOW_NEW();
36 
37  public:
CursorData(StyleImage * image,bool hot_spot_specified,const IntPoint & hot_spot)38   CursorData(StyleImage* image,
39              bool hot_spot_specified,
40              const IntPoint& hot_spot)
41       : image_(image),
42         hot_spot_specified_(hot_spot_specified),
43         hot_spot_(hot_spot) {}
44 
45   bool operator==(const CursorData& o) const {
46     return hot_spot_ == o.hot_spot_ && DataEquivalent(image_, o.image_);
47   }
48 
49   bool operator!=(const CursorData& o) const { return !(*this == o); }
50 
GetImage()51   StyleImage* GetImage() const { return image_.Get(); }
SetImage(StyleImage * image)52   void SetImage(StyleImage* image) { image_ = image; }
53 
HotSpotSpecified()54   bool HotSpotSpecified() const { return hot_spot_specified_; }
55 
56   // Hot spot in the image in logical pixels.
HotSpot()57   const IntPoint& HotSpot() const { return hot_spot_; }
58 
Trace(Visitor * visitor)59   void Trace(Visitor* visitor) const { visitor->Trace(image_); }
60 
61  private:
62   Member<StyleImage> image_;
63   bool hot_spot_specified_;
64   IntPoint hot_spot_;  // for CSS3 support
65 };
66 
67 }  // namespace blink
68 
69 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::CursorData)
70 
71 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_CURSOR_DATA_H_
72