Changeset 134874 in webkit
- Timestamp:
- Nov 15, 2012 6:28:00 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r134870 r134874 1 2012-11-15 Rick Byers <rbyers@chromium.org> 2 3 custom CSS cursors ignore hotspot values embedded in CUR files 4 https://bugs.webkit.org/show_bug.cgi?id=100059 5 6 Reviewed by Kenneth Russell. 7 8 Add mouse cursor test cases that use CUR files that have embedded hotspot values. 9 10 * fast/events/mouse-cursor-expected.txt: 11 * fast/events/mouse-cursor-multiframecur-expected.txt: Added. 12 * fast/events/mouse-cursor-multiframecur.html: Copied from LayoutTests/fast/events/mouse-cursor.html. 13 * fast/events/mouse-cursor.html: 14 * fast/events/resources/greenbox-3frames.cur: Added. 15 * fast/events/resources/greenbox-hotspot35-4.cur: Added. 16 * fast/events/resources/greenbox-hotspot5-4.cur: Added. 17 * platform/mac/TestExpectations: Skip the multi-frame case on mac because it causes a hang 18 1 19 2012-11-15 Kenichi Ishibashi <bashi@chromium.org> 2 20 -
trunk/LayoutTests/fast/events/mouse-cursor-expected.txt
r134803 r134874 46 46 Cursor Info: type=Custom hotSpot=0,0 image=25x25 47 47 48 TEST CASE: Image with implicit hot spot at (5,4) 49 Cursor Info: type=Custom hotSpot=5,4 image=25x25 50 51 TEST CASE: Image with explicit hot spot at (20,10) overriding implicit hot spot 52 Cursor Info: type=Custom hotSpot=20,10 image=25x25 53 54 TEST CASE: Image with implicit hot spot outside image at (35,4) 55 Cursor Info: type=Custom hotSpot=0,0 image=25x25 56 48 57 TEST CASE: Over large image with fallback to pointer 49 58 Cursor Info: type=Hand hotSpot=0,0 -
trunk/LayoutTests/fast/events/mouse-cursor.html
r134803 r134874 29 29 <div style='cursor: url(resources/greenbox.png) -1 -1, pointer'>Image with explicit hot spot at (-1,-1)</div> 30 30 <div style='cursor: url(resources/greenbox.png) 30 30, pointer'>Image with explicit hot spot outside image at (30,30)</div> 31 <div style='cursor: url(resources/greenbox-hotspot5-4.cur), pointer'>Image with implicit hot spot at (5,4)</div> 32 <div style='cursor: url(resources/greenbox-hotspot5-4.cur) 20 10, pointer'>Image with explicit hot spot at (20,10) overriding implicit hot spot</div> 33 <div style='cursor: url(resources/greenbox-hotspot35-4.cur), pointer'>Image with implicit hot spot outside image at (35,4)</div> 31 34 <div style='cursor: url(resources/onload-image.png), pointer'>Over large image with fallback to pointer</div> 32 35 <div style='cursor: url(#greenbox), pointer'>SVG cursor</div> … … 68 71 var node = nodesToTest[i]; 69 72 debug('TEST CASE: ' + node.textContent); 70 eventSender.mouseMoveTo(node.offsetLeft + 3, node.offsetTop + 3); 73 74 // Make sure the node is visible and move the mouse over top of it. 75 document.body.scrollTop = node.offsetTop - 50; 76 eventSender.mouseMoveTo(node.offsetLeft + 3, node.offsetTop - document.body.scrollTop + 3); 77 78 // Get details of the current mouse cursor. 71 79 // Note that we could return structured data which we then validate, but that's a lot more 72 80 // work and is redundant with relying on the expected output anyway. Better to just dump … … 99 107 { url: 'resources/greenbox.png' }, 100 108 { url: 'resources/onload-image.png' }, 109 { url: 'resources/greenbox-hotspot5-4.cur' }, 110 { url: 'resources/greenbox-hotspot35-4.cur' }, 101 111 { url: 'doesntexist.png', error: true }, 102 112 { url: 'unknown-scheme:cursor.png', error: true }, -
trunk/LayoutTests/platform/mac/TestExpectations
r134802 r134874 1186 1186 # Mountain Lion and prior do not support custom media data loading 1187 1187 Bug(jernoble) [ MountainLion Lion SnowLeopard ] media/video-src-blob.html 1188 1189 # Hangs safari apparently due to an issue with weird multi-frame CUR image files 1190 webkit.org/b/101811 fast/events/mouse-cursor-multiframecur.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r134871 r134874 1 2012-11-15 Rick Byers <rbyers@chromium.org> 2 3 custom CSS cursors ignore hotspot values embedded in CUR files 4 https://bugs.webkit.org/show_bug.cgi?id=100059 5 6 Reviewed by Kenneth Russell. 7 8 Add reading the hotspot values to the ICOImageDecoder (for CUR files only), 9 and plumb it through so that the existing calls to ImageSource::getHotSpot 10 actually return the hot spot value when there is one. 11 12 Tests: fast/events/mouse-cursor.html, fast/events/mouse-cursor-multiframecur.html 13 14 * platform/graphics/ImageSource.cpp: 15 (WebCore::ImageSource::getHotSpot): 16 * platform/graphics/chromium/DeferredImageDecoder.cpp: 17 (WebCore::DeferredImageDecoder::hotSpot): 18 (WebCore::DeferredImageDecoder::hotSpotAtIndex): 19 * platform/graphics/chromium/DeferredImageDecoder.h: 20 (DeferredImageDecoder): 21 * platform/image-decoders/ImageDecoder.h: 22 (WebCore::ImageDecoder::hotSpot): 23 (WebCore::ImageDecoder::hotSpotAtIndex): 24 (ImageDecoder): 25 * platform/image-decoders/ico/ICOImageDecoder.cpp: 26 (WebCore::ICOImageDecoder::hotSpot): 27 (WebCore::ICOImageDecoder::hotSpotAtIndex): 28 (WebCore::ICOImageDecoder::processDirectory): 29 (WebCore::ICOImageDecoder::readDirectoryEntry): 30 * platform/image-decoders/ico/ICOImageDecoder.h: 31 (ICOImageDecoder): 32 (IconDirectoryEntry): 33 1 34 2012-11-15 Kenichi Ishibashi <bashi@chromium.org> 2 35 -
trunk/Source/WebCore/platform/graphics/ImageSource.cpp
r132433 r134874 122 122 } 123 123 124 bool ImageSource::getHotSpot(IntPoint& ) const125 { 126 return false;124 bool ImageSource::getHotSpot(IntPoint& hotSpot) const 125 { 126 return m_decoder ? m_decoder->hotSpot(hotSpot) : false; 127 127 } 128 128 -
trunk/Source/WebCore/platform/graphics/chromium/DeferredImageDecoder.cpp
r134822 r134874 220 220 } 221 221 222 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const 223 { 224 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; 225 } 226 222 227 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/chromium/DeferredImageDecoder.h
r134822 r134874 63 63 unsigned frameBytesAtIndex(size_t index) const; 64 64 ImageOrientation orientation() const; 65 bool hotSpot(IntPoint&) const; 65 66 66 67 private: -
trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h
r132260 r134874 377 377 #endif 378 378 379 // If the image has a cursor hot-spot, stores it in the argument 380 // and returns true. Otherwise returns false. 381 virtual bool hotSpot(IntPoint&) const { return false; } 382 379 383 virtual void reportMemoryUsage(MemoryObjectInfo*) const; 380 384 -
trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp
r125769 r134874 134 134 } 135 135 136 bool ICOImageDecoder::hotSpot(IntPoint& hotSpot) const 137 { 138 // When unspecified, the default frame is always frame 0. This is consistent with 139 // BitmapImage where currentFrame() starts at 0 and only increases when animation is 140 // requested. 141 return hotSpotAtIndex(0, hotSpot); 142 } 143 144 bool ICOImageDecoder::hotSpotAtIndex(size_t index, IntPoint& hotSpot) const 145 { 146 if (index >= m_dirEntries.size() || m_fileType != CURSOR) 147 return false; 148 149 hotSpot = m_dirEntries[index].m_hotSpot; 150 return true; 151 } 152 153 136 154 // static 137 155 bool ICOImageDecoder::compareEntries(const IconDirectoryEntry& a, const IconDirectoryEntry& b) … … 233 251 // See if this is an icon filetype we understand, and make sure we have at 234 252 // least one entry in the directory. 235 enum {236 ICON = 1,237 CURSOR = 2,238 };239 253 if (((fileType != ICON) && (fileType != CURSOR)) || (!idCount)) 240 254 return setFailed(); 255 256 m_fileType = static_cast<FileType>(fileType); 241 257 242 258 // Enlarge member vectors to hold all the entries. … … 288 304 IconDirectoryEntry entry; 289 305 entry.m_size = IntSize(width, height); 290 entry.m_bitCount = readUint16(6); 306 if (m_fileType == CURSOR) { 307 entry.m_bitCount = 0; 308 entry.m_hotSpot = IntPoint(readUint16(4), readUint16(6)); 309 } else { 310 entry.m_bitCount = readUint16(6); 311 entry.m_hotSpot = IntPoint(); 312 } 291 313 entry.m_imageOffset = readUint32(12); 292 314 -
trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h
r95901 r134874 57 57 // inside BMPImageReader! 58 58 virtual bool setFailed(); 59 virtual bool hotSpot(IntPoint&) const; 59 60 60 61 private: … … 65 66 }; 66 67 68 enum FileType { 69 ICON = 1, 70 CURSOR = 2, 71 }; 72 67 73 struct IconDirectoryEntry { 68 74 IntSize m_size; 69 75 uint16_t m_bitCount; 76 IntPoint m_hotSpot; 70 77 uint32_t m_imageOffset; 71 78 }; … … 110 117 bool processDirectoryEntries(); 111 118 119 // Stores the hot-spot for |index| in |hotSpot| and returns true, 120 // or returns false if there is none. 121 bool hotSpotAtIndex(size_t index, IntPoint& hotSpot) const; 122 112 123 // Reads and returns a directory entry from the current offset into 113 124 // |data|. … … 122 133 // BMPImageReader takes over this will not be updated further. 123 134 size_t m_decodedOffset; 135 136 // Which type of file (ICO/CUR) this is. 137 FileType m_fileType; 124 138 125 139 // The headers for the ICO.
Note: See TracChangeset
for help on using the changeset viewer.