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

Side by Side Diff: third_party/WebKit/Source/platform/Cursor.cpp

Issue 1732563007: [NOT FOR COMMIT] Pass defaultObjectSize to get image size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698