Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9ecae5b1
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
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看板
提交
9ecae5b1
编写于
8月 03, 2009
作者:
G
gsm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6539700: JTextPane line wrap radically different from previous versions in jre 1.5.0_10+
Reviewed-by: peterz
上级
f675b70e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
116 addition
and
53 deletion
+116
-53
src/share/classes/javax/swing/text/GlyphView.java
src/share/classes/javax/swing/text/GlyphView.java
+1
-24
src/share/classes/javax/swing/text/ParagraphView.java
src/share/classes/javax/swing/text/ParagraphView.java
+1
-29
test/javax/swing/text/GlyphView/6539700/bug6539700.java
test/javax/swing/text/GlyphView/6539700/bug6539700.java
+114
-0
未找到文件。
src/share/classes/javax/swing/text/GlyphView.java
浏览文件 @
9ecae5b1
...
@@ -540,30 +540,7 @@ public class GlyphView extends View implements TabableView, Cloneable {
...
@@ -540,30 +540,7 @@ public class GlyphView extends View implements TabableView, Cloneable {
*/
*/
@Override
@Override
public
float
getMinimumSpan
(
int
axis
)
{
public
float
getMinimumSpan
(
int
axis
)
{
switch
(
axis
)
{
return
super
.
getMinimumSpan
(
axis
);
case
View
.
X_AXIS
:
if
(
minimumSpan
<
0
)
{
minimumSpan
=
0
;
int
p0
=
getStartOffset
();
int
p1
=
getEndOffset
();
while
(
p1
>
p0
)
{
int
breakSpot
=
getBreakSpot
(
p0
,
p1
);
if
(
breakSpot
==
BreakIterator
.
DONE
)
{
// the rest of the view is non-breakable
breakSpot
=
p0
;
}
minimumSpan
=
Math
.
max
(
minimumSpan
,
getPartialSpan
(
breakSpot
,
p1
));
// Note: getBreakSpot returns the *last* breakspot
p1
=
breakSpot
-
1
;
}
}
return
minimumSpan
;
case
View
.
Y_AXIS
:
return
super
.
getMinimumSpan
(
axis
);
default
:
throw
new
IllegalArgumentException
(
"Invalid axis: "
+
axis
);
}
}
}
/**
/**
...
...
src/share/classes/javax/swing/text/ParagraphView.java
浏览文件 @
9ecae5b1
...
@@ -721,35 +721,7 @@ public class ParagraphView extends FlowView implements TabExpander {
...
@@ -721,35 +721,7 @@ public class ParagraphView extends FlowView implements TabExpander {
@Override
@Override
protected
SizeRequirements
calculateMinorAxisRequirements
(
int
axis
,
protected
SizeRequirements
calculateMinorAxisRequirements
(
int
axis
,
SizeRequirements
r
)
{
SizeRequirements
r
)
{
r
=
super
.
calculateMinorAxisRequirements
(
axis
,
r
);
return
super
.
calculateMinorAxisRequirements
(
axis
,
r
);
float
min
=
0
;
float
glue
=
0
;
int
n
=
getLayoutViewCount
();
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
View
v
=
getLayoutView
(
i
);
float
span
=
v
.
getMinimumSpan
(
axis
);
if
(
v
.
getBreakWeight
(
axis
,
0
,
v
.
getMaximumSpan
(
axis
))
>
View
.
BadBreakWeight
)
{
// find the longest non-breakable fragments at the view edges
int
p0
=
v
.
getStartOffset
();
int
p1
=
v
.
getEndOffset
();
float
start
=
findEdgeSpan
(
v
,
axis
,
p0
,
p0
,
p1
);
float
end
=
findEdgeSpan
(
v
,
axis
,
p1
,
p0
,
p1
);
glue
+=
start
;
min
=
Math
.
max
(
min
,
Math
.
max
(
span
,
glue
));
glue
=
end
;
}
else
{
// non-breakable view
glue
+=
span
;
min
=
Math
.
max
(
min
,
glue
);
}
}
r
.
minimum
=
Math
.
max
(
r
.
minimum
,
(
int
)
min
);
r
.
preferred
=
Math
.
max
(
r
.
minimum
,
r
.
preferred
);
r
.
maximum
=
Math
.
max
(
r
.
preferred
,
r
.
maximum
);
return
r
;
}
}
/**
/**
...
...
test/javax/swing/text/GlyphView/6539700/bug6539700.java
0 → 100644
浏览文件 @
9ecae5b1
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6539700
* @summary test that the long space-less lines are correctly soft-wrapped
* @author Sergey Groznyh
* @run main bug6539700
*/
import
javax.swing.JEditorPane
;
import
javax.swing.JFrame
;
import
javax.swing.SwingUtilities
;
import
javax.swing.text.ParagraphView
;
import
javax.swing.text.View
;
public
class
bug6539700
{
static
JFrame
f
;
static
JEditorPane
ep
;
static
String
text
=
"AAAAAAAA<b>AAAAAA</b>AAAAAAAA<b>AAAAAAAAA</b>"
+
"AA<b>AAA</b>AAAAAAAAA"
;
static
int
size
=
100
;
static
Class
rowClass
=
null
;
static
void
createContentPane
()
{
ep
=
new
JEditorPane
();
ep
.
setContentType
(
"text/html"
);
ep
.
setEditable
(
false
);
ep
.
setText
(
text
);
f
=
new
JFrame
();
f
.
setSize
(
size
,
2
*
size
);
f
.
add
(
ep
);
f
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
f
.
setVisible
(
true
);
}
static
void
checkRows
(
View
v
,
boolean
last
)
{
int
width
=
(
int
)
v
.
getPreferredSpan
(
View
.
X_AXIS
);
if
(
v
.
getClass
()
==
rowClass
)
{
// Row width shouldn't exceed the container width
if
(
width
>
size
)
{
throw
new
RuntimeException
(
"too long row: "
+
width
);
}
// Row shouldn't be too short (except for the last one)
if
(!
last
)
{
if
(
width
<
size
*
2
/
3
)
{
throw
new
RuntimeException
(
"too short row: "
+
width
);
}
}
}
int
n
=
v
.
getViewCount
();
if
(
n
>
0
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
View
c
=
v
.
getView
(
i
);
checkRows
(
c
,
i
==
n
-
1
);
}
}
}
public
static
void
main
(
String
[]
argv
)
{
try
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
createContentPane
();
}
});
}
catch
(
Exception
ex
)
{
throw
new
RuntimeException
(
ex
);
}
Class
[]
pvchildren
=
ParagraphView
.
class
.
getDeclaredClasses
();
for
(
Class
c
:
pvchildren
)
{
if
(
c
.
getName
().
equals
(
"javax.swing.text.ParagraphView$Row"
))
{
rowClass
=
c
;
break
;
}
}
if
(
rowClass
==
null
)
{
throw
new
RuntimeException
(
"can't find ParagraphView.Row class"
);
}
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
checkRows
(
ep
.
getUI
().
getRootView
(
ep
),
true
);
}
});
System
.
out
.
println
(
"OK"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录