| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |