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

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

Issue 1885453002: Rename Node::treeScope() to Node::treeScopeOrDocument() Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/ElementRuleCollector.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) 2006 Rob Buis <buis@kde.org> 2 * Copyright (C) 2006 Rob Buis <buis@kde.org>
3 * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 { 55 {
56 // The below teardown is all handled by weak pointer processing in oilpan. 56 // The below teardown is all handled by weak pointer processing in oilpan.
57 #if !ENABLE(OILPAN) 57 #if !ENABLE(OILPAN)
58 if (!isSVGCursor()) 58 if (!isSVGCursor())
59 return; 59 return;
60 60
61 String url = toCSSImageValue(m_imageValue.get())->url(); 61 String url = toCSSImageValue(m_imageValue.get())->url();
62 62
63 for (SVGElement* referencedElement : m_referencedElements) { 63 for (SVGElement* referencedElement : m_referencedElements) {
64 referencedElement->cursorImageValueRemoved(); 64 referencedElement->cursorImageValueRemoved();
65 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement( url, referencedElement->treeScope())) 65 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement( url, referencedElement->treeScopeOrDocument()))
66 cursorElement->removeClient(referencedElement); 66 cursorElement->removeClient(referencedElement);
67 } 67 }
68 #endif 68 #endif
69 } 69 }
70 70
71 String CSSCursorImageValue::customCSSText() const 71 String CSSCursorImageValue::customCSSText() const
72 { 72 {
73 StringBuilder result; 73 StringBuilder result;
74 result.append(m_imageValue->cssText()); 74 result.append(m_imageValue->cssText());
75 if (m_hotSpotSpecified) { 75 if (m_hotSpotSpecified) {
76 result.append(' '); 76 result.append(' ');
77 result.appendNumber(m_hotSpot.x()); 77 result.appendNumber(m_hotSpot.x());
78 result.append(' '); 78 result.append(' ');
79 result.appendNumber(m_hotSpot.y()); 79 result.appendNumber(m_hotSpot.y());
80 } 80 }
81 return result.toString(); 81 return result.toString();
82 } 82 }
83 83
84 bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element) 84 bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element)
85 { 85 {
86 if (!element || !element->isSVGElement()) 86 if (!element || !element->isSVGElement())
87 return false; 87 return false;
88 88
89 if (!isSVGCursor()) 89 if (!isSVGCursor())
90 return false; 90 return false;
91 91
92 String url = toCSSImageValue(m_imageValue.get())->url(); 92 String url = toCSSImageValue(m_imageValue.get())->url();
93 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->treeScope())) { 93 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->treeScopeOrDocument())) {
94 // FIXME: This will override hot spot specified in CSS, which is probabl y incorrect. 94 // FIXME: This will override hot spot specified in CSS, which is probabl y incorrect.
95 SVGLengthContext lengthContext(0); 95 SVGLengthContext lengthContext(0);
96 m_hotSpotSpecified = true; 96 m_hotSpotSpecified = true;
97 float x = roundf(cursorElement->x()->currentValue()->value(lengthContext )); 97 float x = roundf(cursorElement->x()->currentValue()->value(lengthContext ));
98 m_hotSpot.setX(static_cast<int>(x)); 98 m_hotSpot.setX(static_cast<int>(x));
99 99
100 float y = roundf(cursorElement->y()->currentValue()->value(lengthContext )); 100 float y = roundf(cursorElement->y()->currentValue()->value(lengthContext ));
101 m_hotSpot.setY(static_cast<int>(y)); 101 m_hotSpot.setY(static_cast<int>(y));
102 102
103 if (cachedImageURL() != element->document().completeURL(cursorElement->h ref()->currentValue()->value())) 103 if (cachedImageURL() != element->document().completeURL(cursorElement->h ref()->currentValue()->value()))
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 DEFINE_TRACE_AFTER_DISPATCH(CSSCursorImageValue) 201 DEFINE_TRACE_AFTER_DISPATCH(CSSCursorImageValue)
202 { 202 {
203 visitor->trace(m_imageValue); 203 visitor->trace(m_imageValue);
204 visitor->trace(m_cachedImage); 204 visitor->trace(m_cachedImage);
205 CSSValue::traceAfterDispatch(visitor); 205 CSSValue::traceAfterDispatch(visitor);
206 } 206 }
207 207
208 } // namespace blink 208 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/ElementRuleCollector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698