Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0b575cf4
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b575cf4
编写于
7月 24, 2014
作者:
D
dmarkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8044614: [macosx] Focus issue with 2 applets in firefox
Reviewed-by: alexsch, pchelko
上级
ea755d1b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
272 addition
and
5 deletion
+272
-5
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+26
-5
test/java/awt/Focus/8044614/TestApplet.java
test/java/awt/Focus/8044614/TestApplet.java
+34
-0
test/java/awt/Focus/8044614/applet1.html
test/java/awt/Focus/8044614/applet1.html
+37
-0
test/java/awt/Focus/8044614/applet2.html
test/java/awt/Focus/8044614/applet2.html
+37
-0
test/java/awt/Focus/8044614/bug8044614.html
test/java/awt/Focus/8044614/bug8044614.html
+36
-0
test/java/awt/Focus/8044614/bug8044614.java
test/java/awt/Focus/8044614/bug8044614.java
+56
-0
test/java/awt/Focus/8044614/main.html
test/java/awt/Focus/8044614/main.html
+46
-0
未找到文件。
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
浏览文件 @
0b575cf4
...
...
@@ -37,7 +37,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
private
CPlatformResponder
responder
;
private
static
final
Object
classLock
=
new
Object
();
private
static
volatile
CEmbeddedFrame
focusedWindow
;
private
static
volatile
CEmbeddedFrame
globalFocusedWindow
;
private
CEmbeddedFrame
browserWindowFocusedApplet
;
private
boolean
parentWindowActive
=
true
;
public
CEmbeddedFrame
()
{
...
...
@@ -110,10 +111,10 @@ public class CEmbeddedFrame extends EmbeddedFrame {
synchronized
(
classLock
)
{
// In some cases an applet may not receive the focus lost event
// from the parent window (see 8012330)
f
ocusedWindow
=
(
focused
)
?
this
:
((
focusedWindow
==
this
)
?
null
:
f
ocusedWindow
);
globalF
ocusedWindow
=
(
focused
)
?
this
:
((
globalFocusedWindow
==
this
)
?
null
:
globalF
ocusedWindow
);
}
if
(
f
ocusedWindow
==
this
)
{
if
(
globalF
ocusedWindow
==
this
)
{
// see bug 8010925
// we can't put this to handleWindowFocusEvent because
// it won't be invoced if focuse is moved to a html element
...
...
@@ -144,9 +145,23 @@ public class CEmbeddedFrame extends EmbeddedFrame {
// non-focused applet. This method can be called from different threads.
public
void
handleWindowFocusEvent
(
boolean
parentWindowActive
)
{
this
.
parentWindowActive
=
parentWindowActive
;
// If several applets are running in different browser's windows, it is necessary to
// detect the switching between the parent windows and update globalFocusedWindow accordingly.
synchronized
(
classLock
)
{
if
(!
parentWindowActive
)
{
this
.
browserWindowFocusedApplet
=
globalFocusedWindow
;
}
if
(
parentWindowActive
&&
globalFocusedWindow
!=
this
&&
isParentWindowChanged
())
{
// It looks like we have switched to another browser window, let's restore focus to
// the previously focused applet in this window. If no applets were focused in the
// window, we will set focus to the first applet in the window.
globalFocusedWindow
=
(
this
.
browserWindowFocusedApplet
!=
null
)
?
this
.
browserWindowFocusedApplet
:
this
;
}
}
// ignore focus "lost" native request as it may mistakenly
// deactivate active window (see 8001161)
if
(
f
ocusedWindow
==
this
&&
parentWindowActive
)
{
if
(
globalF
ocusedWindow
==
this
&&
parentWindowActive
)
{
responder
.
handleWindowFocusEvent
(
parentWindowActive
,
null
);
}
}
...
...
@@ -154,4 +169,10 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public
boolean
isParentWindowActive
()
{
return
parentWindowActive
;
}
private
boolean
isParentWindowChanged
()
{
// If globalFocusedWindow is located at inactive parent window or null, we have swithed to
// another window.
return
globalFocusedWindow
!=
null
?
!
globalFocusedWindow
.
isParentWindowActive
()
:
true
;
}
}
test/java/awt/Focus/8044614/TestApplet.java
0 → 100644
浏览文件 @
0b575cf4
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.applet.Applet
;
import
java.awt.TextField
;
public
class
TestApplet
extends
Applet
{
TextField
textField
=
null
;
public
void
init
()
{
textField
=
new
TextField
(
25
);
add
(
textField
);
}
}
test/java/awt/Focus/8044614/applet1.html
0 → 100644
浏览文件 @
0b575cf4
<!--
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html
lang=
"en"
>
<head>
<meta
http-equiv=
"content-type"
content=
"text/html; charset=utf-8"
>
<title>
First Applet
</title>
</head>
<body>
<applet
code=
"TestApplet.class"
width=
"400"
height=
"200"
/>
</applet>
</body>
</html>
test/java/awt/Focus/8044614/applet2.html
0 → 100644
浏览文件 @
0b575cf4
<!--
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html
lang=
"en"
>
<head>
<meta
http-equiv=
"content-type"
content=
"text/html; charset=utf-8"
>
<title>
Second Applet
</title>
</head>
<body>
<applet
code=
"TestApplet.class"
width=
"400"
height=
"200"
/>
</applet>
</body>
</html>
test/java/awt/Focus/8044614/bug8044614.html
0 → 100644
浏览文件 @
0b575cf4
<!--
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<head>
<title>
bug8044614
</title>
</head>
<body>
<h1>
bug8044614
</h1>
<p>
See the dialog box (usually in upper left corner) for instructions
</p>
<APPLET
CODE=
"bug8044614.class"
WIDTH=
200
HEIGHT=
200
></APPLET>
</body>
</html>
test/java/awt/Focus/8044614/bug8044614.java
0 → 100644
浏览文件 @
0b575cf4
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8044614
* @summary Tests focus transfer between applets in different browser windows
* @author Dmitry Markov
* @library ../../regtesthelpers
* @build Sysout
* @run applet/manual=yesno bug8044614.html
*/
import
javax.swing.JApplet
;
import
test.java.awt.regtesthelpers.Sysout
;
public
class
bug8044614
extends
JApplet
{
public
void
init
()
{
String
[]
instructions
=
{
"(1) Go to the test directory test/java/awt/Focus/8044614"
,
"(2) Compile source file: javac TestApplet.java"
,
"(3) Open the \"main.html\" file in the browser"
,
"(4) Click the \"Start First Applet\" link to open the first applet window"
,
"(5) Wait for the applet to start (press \"Run\" to any security alerts that appears)"
,
"(6) Enter \"Hello\" to the text field"
,
"(7) Click the \"Start Second Applet)\" link to open the second applet window"
,
"(8) Wait for the applet to start (press \"Run\" to any security alerts that appears)"
,
"(9) Enter \"World\" to the text field"
,
"(10) Go back to the first applet and make sure you can enter some text to the text field"
};
Sysout
.
createDialogWithInstructions
(
instructions
);
}
}
test/java/awt/Focus/8044614/main.html
0 → 100644
浏览文件 @
0b575cf4
<!--
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html
lang=
"en"
>
<head>
<meta
http-equiv=
"content-type"
content=
"text/html; charset=utf-8"
>
<title>
Applet Focus Bug main window
</title>
<script
language=
"JavaScript"
>
function
openWindow
(
strURL
,
strWindowName
,
strWindowFeatures
)
{
var
win
=
window
.
open
(
strURL
,
strWindowName
,
strWindowFeatures
);
}
</script>
</head>
<body>
<table>
<tr>
<td><a
href=
"javascript:openWindow('applet1.html', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=400, top=0, left=0, hide=no')"
>
Start First Applet
</a></td>
</tr>
<tr>
<td><a
href=
"javascript:openWindow('applet2.html', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=400, top=0, left=350, hide=no')"
>
Start Second Applet
</a></td>
</tr>
</table>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录