OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 { | 191 { |
192 state.style()->clearCursorList(); | 192 state.style()->clearCursorList(); |
193 if (value->isValueList()) { | 193 if (value->isValueList()) { |
194 CSSValueList* list = toCSSValueList(value); | 194 CSSValueList* list = toCSSValueList(value); |
195 int len = list->length(); | 195 int len = list->length(); |
196 state.style()->setCursor(CURSOR_AUTO); | 196 state.style()->setCursor(CURSOR_AUTO); |
197 for (int i = 0; i < len; i++) { | 197 for (int i = 0; i < len; i++) { |
198 CSSValue* item = list->item(i); | 198 CSSValue* item = list->item(i); |
199 if (item->isCursorImageValue()) { | 199 if (item->isCursorImageValue()) { |
200 CSSCursorImageValue* image = toCSSCursorImageValue(item); | 200 CSSCursorImageValue* image = toCSSCursorImageValue(item); |
201 if (image->updateIfSVGCursorIsUsed(state.element())) // Elements
with SVG cursors are not allowed to share style. | 201 IntPoint hotSpot = image->hotSpot(); |
| 202 bool hotSpotSpecified = image->hotSpotSpecified(); |
| 203 |
| 204 Element* element = state.element(); |
| 205 if (SVGCursorElement* cursorElement = image->getSVGCursorElement
(element)) { |
| 206 if (image->cachedImageURL() != element->document().completeU
RL(cursorElement->href()->currentValue()->value())) |
| 207 image->clearImageResource(); |
| 208 |
| 209 // Set the hot spot if it wasn't specified in the CSS but is
specified in the SVG. |
| 210 if (!hotSpotSpecified) { |
| 211 hotSpotSpecified = true; |
| 212 SVGLengthContext lengthContext(0); |
| 213 // x() and y() return 0 if they're not specified in curs
orElement. |
| 214 float svgX = roundf(cursorElement->x()->currentValue()->
value(lengthContext)); |
| 215 hotSpot.setX(static_cast<int>(svgX)); |
| 216 float svgY = roundf(cursorElement->y()->currentValue()->
value(lengthContext)); |
| 217 hotSpot.setY(static_cast<int>(svgY)); |
| 218 } |
| 219 |
| 220 SVGElement* svgElement = toSVGElement(element); |
| 221 svgElement->setCursorImageValue(image); |
| 222 cursorElement->addClient(svgElement); |
| 223 |
| 224 // Elements with SVG cursors are not allowed to share style. |
202 state.style()->setUnique(); | 225 state.style()->setUnique(); |
203 state.style()->addCursor(state.styleImage(CSSPropertyCursor, *im
age), image->hotSpotSpecified(), image->hotSpot()); | 226 } |
| 227 |
| 228 state.style()->addCursor(state.styleImage(CSSPropertyCursor, *im
age), hotSpotSpecified, hotSpot); |
204 } else { | 229 } else { |
205 state.style()->setCursor(toCSSPrimitiveValue(item)->convertTo<EC
ursor>()); | 230 state.style()->setCursor(toCSSPrimitiveValue(item)->convertTo<EC
ursor>()); |
206 } | 231 } |
207 } | 232 } |
208 } else { | 233 } else { |
209 state.style()->setCursor(toCSSPrimitiveValue(value)->convertTo<ECursor>(
)); | 234 state.style()->setCursor(toCSSPrimitiveValue(value)->convertTo<ECursor>(
)); |
210 } | 235 } |
211 } | 236 } |
212 | 237 |
213 void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolverState& s
tate, CSSValue* value) | 238 void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolverState& s
tate, CSSValue* value) |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 } | 871 } |
847 } | 872 } |
848 | 873 |
849 void StyleBuilderFunctions::applyInheritCSSPropertyPosition(StyleResolverState&
state) | 874 void StyleBuilderFunctions::applyInheritCSSPropertyPosition(StyleResolverState&
state) |
850 { | 875 { |
851 if (!state.parentNode()->isDocumentNode()) | 876 if (!state.parentNode()->isDocumentNode()) |
852 state.style()->setPosition(state.parentStyle()->position()); | 877 state.style()->setPosition(state.parentStyle()->position()); |
853 } | 878 } |
854 | 879 |
855 } // namespace blink | 880 } // namespace blink |
OLD | NEW |