Fix for off by one error in HTML 5 Safari drag and drop, as well as error when building with Rhino Narwhal.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2009-11-13 17:39:16 -08:00
parent 13c5736a0f
commit 9dfdde674f
4 changed files with 38 additions and 3 deletions
+4
View File
@@ -56,6 +56,7 @@ CPOpacityRequiresFilterFeature = 1 << 24;
//Internet explorer does not allow dynamically changing the type of an input element
CPInputTypeCanBeChangedFeature = 1 << 25;
CPHTML5DragAndDropSourceYOffBy1 = 1 << 26;
@@ -116,6 +117,9 @@ else if (USER_AGENT.indexOf("AppleWebKit/") != -1)
if((USER_AGENT.indexOf("Safari") !== CPNotFound && (majorVersion > 525 || (majorVersion === 525 && minorVersion > 14))) || USER_AGENT.indexOf("Chrome") !== CPNotFound)
PLATFORM_FEATURES |= CPJavascriptRemedialKeySupport;
if (majorVersion < 532 || (majorVersion === 532 && minorVersion < 6))
PLATFORM_FEATURES |= CPHTML5DragAndDropSourceYOffBy1;
}
// KHTML
+24
View File
@@ -606,6 +606,30 @@ CPTexturedBackgroundWindowMask
*/
- (void)setFrame:(CGRect)aFrame display:(BOOL)shouldDisplay animate:(BOOL)shouldAnimate
{
var value = aFrame.origin.x,
delta = value - FLOOR(value);
if (delta)
aFrame.origin.x = value > 0.879 ? CEIL(value) : FLOOR(value);
value = aFrame.origin.y;
delta = value - FLOOR(value);
if (delta)
aFrame.origin.y = value > 0.879 ? CEIL(value) : FLOOR(value);
value = aFrame.size.width;
delta = value - FLOOR(value);
if (delta)
aFrame.size.width = value > 0.15 ? CEIL(value) : FLOOR(value);
value = aFrame.size.height;
delta = value - FLOOR(value);
if (delta)
aFrame.size.height = value > 0.15 ? CEIL(value) : FLOOR(value);
if (shouldAnimate)
{
var animation = [[_CPWindowFrameAnimation alloc] initWithWindow:self targetFrame:aFrame];
+8 -1
View File
@@ -381,7 +381,14 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
}
else if (type === "drag")
[dragServer draggingSourceUpdatedWithGlobalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY)];
{
var y = aDOMEvent.screenY;
if (CPFeatureIsCompatible(CPHTML5DragAndDropSourceYOffBy1))
y -= 1;
[dragServer draggingSourceUpdatedWithGlobalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, y)];
}
else if (type === "dragover" || type === "dragleave")
{
@@ -627,10 +627,10 @@ BundleTask.prototype.defineStaticTask = function()
}
}, this);
fileStream.write("e;", { charset:"UTF-8" });
fileStream.write("e;");
if (MHTMLContents.length > 0)
fileStream.write(MHTMLContents + "*/", { charset:"UTF-8" });
fileStream.write(MHTMLContents + "*/");
fileStream.close();
});