Commit 9a44838d authored by andersca's avatar andersca
Browse files

Reviewed by Adam.

        <rdar://problem/5224749> Show a zoom/unzoom cursor for resizable image documents
        
        * WebCore.xcodeproj/project.pbxproj:
        Install the zoom cursors.
        
        * loader/ImageDocument.cpp:
        (WebCore::ImageDocument::resizeImageToFit):
        Set the cursor to the zoom in cursor.
        
        (WebCore::ImageDocument::restoreImageSize):
        If the image fits, reset the cursor. Otherwise, set it to the zoom in cursor.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 662d7bac
2007-05-23 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
<rdar://problem/5224749> Show a zoom/unzoom cursor for resizable image documents
* WebCore.xcodeproj/project.pbxproj:
Install the zoom cursors.
* loader/ImageDocument.cpp:
(WebCore::ImageDocument::resizeImageToFit):
Set the cursor to the zoom in cursor.
(WebCore::ImageDocument::restoreImageSize):
If the image fits, reset the cursor. Otherwise, set it to the zoom in cursor.
2007-05-23 Darin Adler <darin@apple.com>
 
Reviewed by Hyatt.
......@@ -136,6 +136,8 @@
1A98955D0AA78149005EF5EF /* CString.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A98955B0AA78149005EF5EF /* CString.h */; };
1A98956B0AA78F80005EF5EF /* KURLCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A98956A0AA78F80005EF5EF /* KURLCFNet.cpp */; };
1A9EF4570A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A9EF4560A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp */; };
1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE780C051FDE00139F4F /* zoomInCursor.png */; };
1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */; };
1AB7FC680A8B92EC00D9D37B /* XPathEvaluator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC470A8B92EC00D9D37B /* XPathEvaluator.cpp */; };
1AB7FC690A8B92EC00D9D37B /* XPathEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC480A8B92EC00D9D37B /* XPathEvaluator.h */; };
1AB7FC6B0A8B92EC00D9D37B /* XPathExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC4A0A8B92EC00D9D37B /* XPathExpression.cpp */; };
......@@ -3280,6 +3282,8 @@
1A98955B0AA78149005EF5EF /* CString.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CString.h; sourceTree = "<group>"; };
1A98956A0AA78F80005EF5EF /* KURLCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = KURLCFNet.cpp; sourceTree = "<group>"; };
1A9EF4560A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCanvasRenderingContext2DCustom.cpp; sourceTree = "<group>"; };
1AB1AE780C051FDE00139F4F /* zoomInCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = zoomInCursor.png; sourceTree = "<group>"; };
1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = zoomOutCursor.png; sourceTree = "<group>"; };
1AB7FC470A8B92EC00D9D37B /* XPathEvaluator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathEvaluator.cpp; sourceTree = "<group>"; };
1AB7FC480A8B92EC00D9D37B /* XPathEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathEvaluator.h; sourceTree = "<group>"; };
1AB7FC490A8B92EC00D9D37B /* XPathEvaluator.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = XPathEvaluator.idl; sourceTree = "<group>"; };
......@@ -6324,6 +6328,8 @@
089C1665FE841158C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
1AB1AE780C051FDE00139F4F /* zoomInCursor.png */,
1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */,
464EA2710B8A350B00A8E6E3 /* crossHairCursor.png */,
464EA2720B8A350B00A8E6E3 /* notAllowedCursor.png */,
46BD16E20B279473001F0839 /* noneCursor.png */,
......@@ -11489,6 +11495,8 @@
464EA2730B8A350B00A8E6E3 /* crossHairCursor.png in Resources */,
464EA2740B8A350B00A8E6E3 /* notAllowedCursor.png in Resources */,
BC491B4F0C023E2D009D6316 /* HTMLMarqueeElement.idl in Resources */,
1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -179,6 +179,9 @@ void ImageDocument::resizeImageToFit()
float scale = this->scale();
m_imageElement->setWidth(imageSize.width() * scale);
m_imageElement->setHeight(imageSize.height() * scale);
ExceptionCode ec;
m_imageElement->style()->setProperty("cursor", "-webkit-zoom-in", ec);
}
void ImageDocument::imageClicked(int x, int y)
......@@ -231,6 +234,12 @@ void ImageDocument::restoreImageSize()
m_imageElement->setWidth(m_imageElement->cachedImage()->imageSize().width());
m_imageElement->setHeight(m_imageElement->cachedImage()->imageSize().height());
ExceptionCode ec;
if (imageFitsInWindow())
m_imageElement->style()->setProperty("cursor", "pointer", ec);
else
m_imageElement->style()->setProperty("cursor", "-webkit-zoom-out", ec);
m_didShrinkImage = false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment