Fixed a bug where windows would not become visible again after closing their platform windows.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2009-10-21 21:01:49 -07:00
1 parent efaff96168
commit 0af70c04a0
2 files changed
+36 -3

No files matched your search

+4 -3
View File
@@ -68,7 +68,7 @@
count = _windows.length - 1;
CPDOMDisplayServerRemoveChild(_DOMElement, aWindow._DOMElement);
[_windows removeObjectAtIndex:aWindow._index];
for (; index < count; ++index)
@@ -107,11 +107,12 @@
_windows[zIndex]._index = zIndex;
_windows[zIndex]._DOMElement.style.zIndex = zIndex;
}
// If the window is not already a resident of this layer, add it.
if (!isVisible)
if (aWindow._DOMElement.parentNode !== _DOMElement)
{
CPDOMDisplayServerAppendChild(_DOMElement, aWindow._DOMElement);
aWindow._isVisible = YES;
if ([aWindow isFullBridge])
@@ -192,6 +192,8 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
// Make sure the pastboard element is blurred.
_DOMPasteboardElement.blur();
[self _addLayers];
var theClass = [self class],
dragEventImplementation = class_getMethodImplementation(theClass, @selector(dragEvent:)),
@@ -250,6 +252,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
_DOMWindow.addEventListener("unload", function()
{
[self updateFromNativeContentRect];
[self _removeLayers];
theDocument.removeEventListener("mouseup", mouseEventCallback, NO);
theDocument.removeEventListener("mousedown", mouseEventCallback, NO);
@@ -296,6 +299,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
_DOMWindow.attachEvent("onbeforeunload", function()
{
[self updateFromNativeContentRect];
[self _removeLayers];
theDocument.removeEvent("onmouseup", mouseEventCallback);
theDocument.removeEvent("onmousedown", mouseEventCallback);
@@ -904,6 +908,34 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
[layer insertWindow:aWindow atIndex:(otherWindow ? (aPlace == CPWindowAbove ? otherWindow._index + 1 : otherWindow._index) : CPNotFound)];
}
- (void)_removeLayers
{
var levels = _windowLevels,
layers = _windowLayers,
levelCount = levels.length;
while (levelCount--)
{
var layer = [layers objectForKey:levels[levelCount]];
_DOMBodyElement.removeChild(layer._DOMElement);
}
}
- (void)_addLayers
{
var levels = _windowLevels,
layers = _windowLayers,
levelCount = levels.length;
while (levelCount--)
{
var layer = [layers objectForKey:levels[levelCount]];
_DOMBodyElement.appendChild(layer._DOMElement);
}
}
/* @ignore */
- (id)_dragHitTest:(CPPoint)aPoint pasteboard:(CPPasteboard)aPasteboard
{