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

Side by Side Diff: Source/core/css/CSSGradientValue.h

Issue 778723002: Refactor CSSGradientValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for review Created 6 years 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
« no previous file with comments | « no previous file | Source/core/css/CSSGradientValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // When allocated on the stack its members are found by conservative 51 // When allocated on the stack its members are found by conservative
52 // stack scanning. When allocated as part of Vectors in heap-allocated 52 // stack scanning. When allocated as part of Vectors in heap-allocated
53 // objects its members are visited via the containing object's 53 // objects its members are visited via the containing object's
54 // (CSSGradientValue) traceAfterDispatch method. 54 // (CSSGradientValue) traceAfterDispatch method.
55 struct CSSGradientColorStop { 55 struct CSSGradientColorStop {
56 ALLOW_ONLY_INLINE_ALLOCATION(); 56 ALLOW_ONLY_INLINE_ALLOCATION();
57 public: 57 public:
58 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { }; 58 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { };
59 RefPtrWillBeMember<CSSPrimitiveValue> m_position; // percentage or length 59 RefPtrWillBeMember<CSSPrimitiveValue> m_position; // percentage or length
60 RefPtrWillBeMember<CSSPrimitiveValue> m_color; 60 RefPtrWillBeMember<CSSPrimitiveValue> m_color;
61 Color m_resolvedColor;
62 bool m_colorIsDerivedFromElement; 61 bool m_colorIsDerivedFromElement;
Timothy Loh 2014/12/05 00:07:07 You'd probably want to update usage of this too?
63 bool operator==(const CSSGradientColorStop& other) const 62 bool operator==(const CSSGradientColorStop& other) const
64 { 63 {
65 return compareCSSValuePtr(m_color, other.m_color) 64 return compareCSSValuePtr(m_color, other.m_color)
66 && compareCSSValuePtr(m_position, other.m_position); 65 && compareCSSValuePtr(m_position, other.m_position);
67 } 66 }
68 bool isHint() const 67 bool isHint() const
69 { 68 {
70 ASSERT(m_color || m_position); 69 ASSERT(m_color || m_position);
71 return !m_color; 70 return !m_color;
72 } 71 }
(...skipping 29 matching lines...) Expand all
102 101
103 CSSGradientType gradientType() const { return m_gradientType; } 102 CSSGradientType gradientType() const { return m_gradientType; }
104 103
105 bool isFixedSize() const { return false; } 104 bool isFixedSize() const { return false; }
106 IntSize fixedSize(const RenderObject*) const { return IntSize(); } 105 IntSize fixedSize(const RenderObject*) const { return IntSize(); }
107 106
108 bool isPending() const { return false; } 107 bool isPending() const { return false; }
109 bool knownToBeOpaque(const RenderObject*) const; 108 bool knownToBeOpaque(const RenderObject*) const;
110 109
111 void loadSubimages(ResourceFetcher*) { } 110 void loadSubimages(ResourceFetcher*) { }
112 PassRefPtrWillBeRawPtr<CSSGradientValue> gradientWithStylesResolved(const Te xtLinkColors&, Color currentColor);
113 111
114 void traceAfterDispatch(Visitor*); 112 void traceAfterDispatch(Visitor*);
115 113
116 protected: 114 protected:
117 CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, CSSGradientT ype gradientType) 115 CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, CSSGradientT ype gradientType)
118 : CSSImageGeneratorValue(classType) 116 : CSSImageGeneratorValue(classType)
119 , m_stopsSorted(false) 117 , m_stopsSorted(false)
120 , m_gradientType(gradientType) 118 , m_gradientType(gradientType)
121 , m_repeating(repeat == Repeating) 119 , m_repeating(repeat == Repeating)
122 { 120 {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 258
261 RefPtrWillBeMember<CSSPrimitiveValue> m_endHorizontalSize; 259 RefPtrWillBeMember<CSSPrimitiveValue> m_endHorizontalSize;
262 RefPtrWillBeMember<CSSPrimitiveValue> m_endVerticalSize; 260 RefPtrWillBeMember<CSSPrimitiveValue> m_endVerticalSize;
263 }; 261 };
264 262
265 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); 263 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue());
266 264
267 } // namespace blink 265 } // namespace blink
268 266
269 #endif // CSSGradientValue_h 267 #endif // CSSGradientValue_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSGradientValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698