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

Unified Diff: Source/core/css/CSSCursorImageValue.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/CSSCursorImageValue.h ('k') | Source/core/css/CSSFontFaceSrcValue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSCursorImageValue.cpp
diff --git a/Source/core/css/CSSCursorImageValue.cpp b/Source/core/css/CSSCursorImageValue.cpp
index fb81043fb58497fd0177571aa9f553ebdb00d8ca..f5c025b7f7ae7364aea343c9f4b414465d51277f 100644
--- a/Source/core/css/CSSCursorImageValue.cpp
+++ b/Source/core/css/CSSCursorImageValue.cpp
@@ -44,8 +44,8 @@ static inline SVGCursorElement* resourceReferencedByCursorElement(const String&
return isSVGCursorElement(element) ? toSVGCursorElement(element) : 0;
}
-CSSCursorImageValue::CSSCursorImageValue(PassRefPtrWillBeRawPtr<CSSValue> imageValue, bool hotSpotSpecified, const IntPoint& hotSpot)
- : CSSValue(CursorImageClass)
+CSSCursorImageValue::CSSCursorImageValue(CSSValue imageValue, bool hotSpotSpecified, const IntPoint& hotSpot)
+ : CSSValueObject(CursorImageClass)
, m_imageValue(imageValue)
, m_hotSpotSpecified(hotSpotSpecified)
, m_hotSpot(hotSpot)
@@ -62,7 +62,7 @@ CSSCursorImageValue::~CSSCursorImageValue()
HashSet<SVGElement*>::const_iterator it = m_referencedElements.begin();
HashSet<SVGElement*>::const_iterator end = m_referencedElements.end();
- String url = toCSSImageValue(m_imageValue.get())->url();
+ String url = toCSSImageValue(m_imageValue).url();
for (; it != end; ++it) {
SVGElement* referencedElement = *it;
@@ -76,7 +76,7 @@ CSSCursorImageValue::~CSSCursorImageValue()
String CSSCursorImageValue::customCSSText() const
{
StringBuilder result;
- result.append(m_imageValue->cssText());
+ result.append(m_imageValue.cssText());
if (m_hotSpotSpecified) {
result.append(' ');
result.appendNumber(m_hotSpot.x());
@@ -94,7 +94,7 @@ bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element)
if (!isSVGCursor())
return false;
- String url = toCSSImageValue(m_imageValue.get())->url();
+ String url = toCSSImageValue(m_imageValue).url();
if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->treeScope())) {
// FIXME: This will override hot spot specified in CSS, which is probably incorrect.
SVGLengthContext lengthContext(0);
@@ -122,8 +122,8 @@ bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element)
StyleImage* CSSCursorImageValue::cachedImage(Document* document, float deviceScaleFactor)
{
- if (m_imageValue->isImageSetValue())
- return toCSSImageSetValue(m_imageValue.get())->cachedImageSet(document, deviceScaleFactor);
+ if (m_imageValue.isImageSetValue())
+ return toCSSImageSetValue(m_imageValue).cachedImageSet(document, deviceScaleFactor);
if (!m_accessedImage) {
m_accessedImage = true;
@@ -132,19 +132,19 @@ StyleImage* CSSCursorImageValue::cachedImage(Document* document, float deviceSca
// to change the URL of the CSSImageValue (which would then change behavior like cssText),
// we create an alternate CSSImageValue to use.
if (isSVGCursor() && document) {
- RefPtrWillBeRawPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get());
+ CSSImageValue& imageValue = toCSSImageValue(m_imageValue);
// FIXME: This will fail if the <cursor> element is in a shadow DOM (bug 59827)
- if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(imageValue->url(), *document)) {
+ if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(imageValue.url(), *document)) {
RefPtrWillBeRawPtr<CSSImageValue> svgImageValue = CSSImageValue::create(document->completeURL(cursorElement->href()->currentValue()->value()));
- svgImageValue->setReferrer(imageValue->referrer());
+ svgImageValue->setReferrer(imageValue.referrer());
StyleFetchedImage* cachedImage = svgImageValue->cachedImage(document);
m_image = cachedImage;
return cachedImage;
}
}
- if (m_imageValue->isImageValue())
- m_image = toCSSImageValue(m_imageValue.get())->cachedImage(document);
+ if (m_imageValue.isImageValue())
+ m_image = toCSSImageValue(m_imageValue).cachedImage(document);
}
if (m_image && m_image->isImageResource())
@@ -155,8 +155,8 @@ StyleImage* CSSCursorImageValue::cachedImage(Document* document, float deviceSca
StyleImage* CSSCursorImageValue::cachedOrPendingImage(float deviceScaleFactor)
{
// Need to delegate completely so that changes in device scale factor can be handled appropriately.
- if (m_imageValue->isImageSetValue())
- return toCSSImageSetValue(m_imageValue.get())->cachedOrPendingImageSet(deviceScaleFactor);
+ if (m_imageValue.isImageSetValue())
+ return toCSSImageSetValue(m_imageValue).cachedOrPendingImageSet(deviceScaleFactor);
if (!m_image)
m_image = StylePendingImage::create(this);
@@ -166,9 +166,9 @@ StyleImage* CSSCursorImageValue::cachedOrPendingImage(float deviceScaleFactor)
bool CSSCursorImageValue::isSVGCursor() const
{
- if (m_imageValue->isImageValue()) {
- RefPtrWillBeRawPtr<CSSImageValue> imageValue = toCSSImageValue(m_imageValue.get());
- KURL kurl(ParsedURLString, imageValue->url());
+ if (m_imageValue.isImageValue()) {
+ CSSImageValue& imageValue = toCSSImageValue(m_imageValue);
+ KURL kurl(ParsedURLString, imageValue.url());
return kurl.hasFragmentIdentifier();
}
return false;
@@ -197,13 +197,13 @@ void CSSCursorImageValue::removeReferencedElement(SVGElement* element)
bool CSSCursorImageValue::equals(const CSSCursorImageValue& other) const
{
return m_hotSpotSpecified ? other.m_hotSpotSpecified && m_hotSpot == other.m_hotSpot : !other.m_hotSpotSpecified
- && compareCSSValuePtr(m_imageValue, other.m_imageValue);
+ && m_imageValue.equals(other.m_imageValue);
}
DEFINE_TRACE_AFTER_DISPATCH(CSSCursorImageValue)
{
visitor->trace(m_imageValue);
- CSSValue::traceAfterDispatch(visitor);
+ CSSValueObject::traceAfterDispatch(visitor);
}
} // namespace blink
« no previous file with comments | « Source/core/css/CSSCursorImageValue.h ('k') | Source/core/css/CSSFontFaceSrcValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698