Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSCursorImageValue.h

Issue 2018923002: Fixed cursor hotspot SVG override and made CSSCursorImageValue constant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some kind of test... Not working though Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Rob Buis <buis@kde.org> 2 * Copyright (C) 2006 Rob Buis <buis@kde.org>
3 * Copyright (C) 2008 Apple Inc. All right reserved. 3 * Copyright (C) 2008 Apple Inc. All right reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #ifndef CSSCursorImageValue_h 21 #ifndef CSSCursorImageValue_h
22 #define CSSCursorImageValue_h 22 #define CSSCursorImageValue_h
23 23
24 #include "core/css/CSSImageValue.h" 24 #include "core/css/CSSImageValue.h"
25 #include "core/svg/SVGCursorElement.h"
25 #include "platform/geometry/IntPoint.h" 26 #include "platform/geometry/IntPoint.h"
26 #include "wtf/HashSet.h" 27 #include "wtf/HashSet.h"
27 28
28 namespace blink { 29 namespace blink {
29 30
30 class Element; 31 class Element;
31 class SVGElement; 32 class SVGElement;
32 33
33 class CSSCursorImageValue : public CSSValue { 34 class CSSCursorImageValue : public CSSValue {
34 public: 35 public:
35 static CSSCursorImageValue* create(CSSValue* imageValue, bool hotSpotSpecifi ed, const IntPoint& hotSpot) 36 static CSSCursorImageValue* create(CSSValue* imageValue, bool hotSpotSpecifi ed, const IntPoint& hotSpot)
36 { 37 {
37 return new CSSCursorImageValue(imageValue, hotSpotSpecified, hotSpot); 38 return new CSSCursorImageValue(imageValue, hotSpotSpecified, hotSpot);
38 } 39 }
39 40
40 ~CSSCursorImageValue(); 41 ~CSSCursorImageValue();
41 42
42 bool hotSpotSpecified() const { return m_hotSpotSpecified; } 43 bool hotSpotSpecified() const { return m_hotSpotSpecified; }
43 44
44 IntPoint hotSpot() const { return m_hotSpot; } 45 IntPoint hotSpot() const { return m_hotSpot; }
45 46
46 String customCSSText() const; 47 String customCSSText() const;
47 48
48 bool updateIfSVGCursorIsUsed(Element*); 49 SVGCursorElement* getSVGCursorElement(Element*) const;
50
51 // Invalidates the cached image if it's not the given url.
52 void clearCachedImageIfNotURL(String url) const;
53
49 bool isCachePending(float deviceScaleFactor) const; 54 bool isCachePending(float deviceScaleFactor) const;
50 StyleImage* cachedImage(float deviceScaleFactor) const; 55 StyleImage* cachedImage(float deviceScaleFactor) const;
51 StyleImage* cacheImage(Document*, float deviceScaleFactor); 56 StyleImage* cacheImage(Document*, float deviceScaleFactor);
52 57
53 bool equals(const CSSCursorImageValue&) const; 58 bool equals(const CSSCursorImageValue&) const;
54 59
55 DECLARE_TRACE_AFTER_DISPATCH(); 60 DECLARE_TRACE_AFTER_DISPATCH();
56 61
57 private: 62 private:
58 CSSCursorImageValue(CSSValue* imageValue, bool hotSpotSpecified, const IntPo int& hotSpot); 63 CSSCursorImageValue(CSSValue* imageValue, bool hotSpotSpecified, const IntPo int& hotSpot);
59 64
60 bool isSVGCursor() const; 65 // True if the URL has a fragment identifier (in which case it probably
Timothy Loh 2016/05/30 01:38:34 isn't the function name descriptive enough already
sashab 2016/05/31 04:22:37 Done
61 String cachedImageURL(); 66 // refers to an SVG).
62 void clearImageResource(); 67 bool hasFragmentInURL() const;
68 String cachedImageURL() const;
63 69
64 Member<CSSValue> m_imageValue; 70 Member<CSSValue> m_imageValue;
65 71
66 bool m_hotSpotSpecified; 72 bool m_hotSpotSpecified;
67 IntPoint m_hotSpot; 73 IntPoint m_hotSpot;
68 bool m_isCachePending; 74 mutable bool m_isCachePending;
69 Member<StyleImage> m_cachedImage; 75 mutable Member<StyleImage> m_cachedImage;
70 }; 76 };
71 77
72 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCursorImageValue, isCursorImageValue()); 78 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCursorImageValue, isCursorImageValue());
73 79
74 } // namespace blink 80 } // namespace blink
75 81
76 #endif // CSSCursorImageValue_h 82 #endif // CSSCursorImageValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698