OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #include "platform/Cursor.h" | 26 #include "platform/Cursor.h" |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 IntPoint determineHotSpot(Image* image, bool hotSpotSpecified, const IntPoint& s
pecifiedHotSpot) | 30 IntPoint determineHotSpot(Image* image, bool hotSpotSpecified, const IntPoint& s
pecifiedHotSpot) |
31 { | 31 { |
32 if (image->isNull()) | 32 if (image->isNull()) |
33 return IntPoint(); | 33 return IntPoint(); |
34 | 34 |
35 IntRect imageRect = image->rect(); | 35 IntRect imageRect = image->defaultConcreteObjectSizeRect(); |
36 | 36 |
37 // Hot spot must be inside cursor rectangle. | 37 // Hot spot must be inside cursor rectangle. |
38 if (hotSpotSpecified) { | 38 if (hotSpotSpecified) { |
39 if (imageRect.contains(specifiedHotSpot)) { | 39 if (imageRect.contains(specifiedHotSpot)) { |
40 return specifiedHotSpot; | 40 return specifiedHotSpot; |
41 } | 41 } |
42 | 42 |
43 return IntPoint( | 43 return IntPoint( |
44 clampTo<int>(specifiedHotSpot.x(), imageRect.x(), imageRect.maxX() -
1), | 44 clampTo<int>(specifiedHotSpot.x(), imageRect.x(), imageRect.maxX() -
1), |
45 clampTo<int>(specifiedHotSpot.y(), imageRect.y(), imageRect.maxY() -
1)); | 45 clampTo<int>(specifiedHotSpot.y(), imageRect.y(), imageRect.maxY() -
1)); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 return c; | 350 return c; |
351 } | 351 } |
352 | 352 |
353 const Cursor& grabbingCursor() | 353 const Cursor& grabbingCursor() |
354 { | 354 { |
355 DEFINE_STATIC_LOCAL(Cursor, c, (Cursor::Grabbing)); | 355 DEFINE_STATIC_LOCAL(Cursor, c, (Cursor::Grabbing)); |
356 return c; | 356 return c; |
357 } | 357 } |
358 | 358 |
359 } // namespace blink | 359 } // namespace blink |
OLD | NEW |