Skip to content

Commit f8cc090

Browse files
Merge
2 parents 4597437 + bb24322 commit f8cc090

File tree

31 files changed

+530
-56
lines changed

31 files changed

+530
-56
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ void addNative(Project project, String name) {
14241424
cleanTask.delete "$libRootDir/${t.name}"
14251425
}
14261426
nativeTask.dependsOn(linkTask)
1427-
if (IS_WINDOWS && t.name == "win") {
1427+
if (IS_WINDOWS && t.name == "win" && (!IS_STATIC_BUILD || name == "glass")) {
14281428
def rcTask = project.task("rc$capitalName$capitalVariant", type: CompileResourceTask, group: "Build") {
14291429
description = "Compiles native sources for $name"
14301430
matches = ".*\\.rc"

build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jfx.gradle.version.min=5.3
8989

9090
# Toolchains
9191
jfx.build.linux.gcc.version=gcc9.2.0-OL6.4+1.0
92-
jfx.build.windows.msvc.version=VS2017-15.9.16+1.0
92+
jfx.build.windows.msvc.version=VS2019-16.5.3+1.0
9393
jfx.build.macosx.xcode.version=Xcode10.1-MacOSX10.14+1.0
9494

9595
# Build tools

buildSrc/win.gradle

+14-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ WIN.compileSWT = true;
3434
WIN.includeNull3d = true
3535

3636
// Lambda for naming the generated libs
37-
WIN.library = { name -> return "${name}.dll" as String }
37+
WIN.library = { name -> return (IS_STATIC_BUILD ? "${name}.lib" : "${name}.dll") as String }
3838

3939
WIN.libDest = "bin"
4040
WIN.modLibDest = "lib"
@@ -116,8 +116,12 @@ def ccFlags = ["/nologo", "/W3", "/EHsc", "/c",
116116
"/DUNICODE", "/D_UNICODE", "/DWIN32", "/DIAL", "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN",
117117
"/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
118118
ccDebugFlags].flatten();
119+
if (IS_STATIC_BUILD) ccFlags.add("/DSTATIC_BUILD")
119120

120-
def linkFlags = ["/nologo", "/dll", "/manifest", "/opt:REF", "/incremental:no", "/dynamicbase", "/nxcompat"];
121+
def linkFlags = ["/nologo"]
122+
if (!IS_STATIC_BUILD) {
123+
linkFlags += ["/dll", "/manifest", "/opt:REF", "/incremental:no", "/dynamicbase", "/nxcompat"]
124+
}
121125
if (!IS_64) linkFlags.add("/safeseh");
122126
if (IS_DEBUG_NATIVE) linkFlags.add("/debug");
123127

@@ -150,7 +154,7 @@ if (hasProperty('toolchainDir')) {
150154
: "$WINDOWS_VS_VSINSTALLDIR/VC/BIN")
151155
}
152156
def compiler = IS_COMPILE_PARFAIT ? "cl.exe" : cygpath("$msvcBinDir/cl.exe")
153-
def linker = IS_COMPILE_PARFAIT ? "link.exe" : cygpath("$msvcBinDir/link.exe")
157+
def linker = IS_STATIC_BUILD ? (IS_COMPILE_PARFAIT ? "lib.exe" : cygpath("$msvcBinDir/lib.exe")) : (IS_COMPILE_PARFAIT ? "link.exe" : cygpath("$msvcBinDir/link.exe"))
154158
def winSdkBinDir = "$WINDOWS_SDK_DIR/Bin"
155159
if (WINDOWS_VS_VER != "100") {
156160
winSdkBinDir += "/$CPU_BITS"
@@ -219,6 +223,7 @@ def WinSDKDLLsPath = cygpath("${winSdkDllDir}")
219223
if (file(WinSDKDLLsPath).exists()) {
220224
ext.WIN.WinSDKDLLNames = [
221225
"api-ms-win-core-console-l1-1-0.dll",
226+
"api-ms-win-core-console-l1-2-0.dll",
222227
"api-ms-win-core-datetime-l1-1-0.dll",
223228
"api-ms-win-core-debug-l1-1-0.dll",
224229
"api-ms-win-core-errorhandling-l1-1-0.dll",
@@ -290,7 +295,7 @@ def rcFlags = [
290295
"/d", "\"JFX_BUILD_ID=${rcVerBuild}\"",
291296
"/d", "\"JFX_COPYRIGHT=Copyright \u00A9 ${rcVerCopyrYear}\"",
292297
"/d", "\"JFX_FVER=${rcVerFile}\"",
293-
"/d", "\"JFX_FTYPE=0x2L\"",
298+
"/d", "\"JFX_FTYPE=${IS_STATIC_BUILD ? "0x7L" : "0x2L" }\"",
294299
"/nologo"
295300
];
296301

@@ -313,10 +318,10 @@ WIN.glass.rcFlags = [
313318
WIN.glass.ccFlags = [ccFlags, "/WX"].flatten()
314319
if (WINDOWS_VS_VER != "100") WIN.glass.ccFlags -= ["/WX"]
315320
WIN.glass.linker = linker
316-
WIN.glass.linkFlags = [linkFlags, "delayimp.lib", "gdi32.lib", "urlmon.lib", "Comdlg32.lib",
321+
WIN.glass.linkFlags = (IS_STATIC_BUILD ? [linkFlags] : [linkFlags, "delayimp.lib", "gdi32.lib", "urlmon.lib", "Comdlg32.lib",
317322
"winmm.lib", "imm32.lib", "shell32.lib", "Uiautomationcore.lib", "dwmapi.lib",
318323
"/DELAYLOAD:user32.dll", "/DELAYLOAD:urlmon.dll", "/DELAYLOAD:winmm.dll", "/DELAYLOAD:shell32.dll",
319-
"/DELAYLOAD:Uiautomationcore.dll", "/DELAYLOAD:dwmapi.dll"].flatten()
324+
"/DELAYLOAD:Uiautomationcore.dll", "/DELAYLOAD:dwmapi.dll"]).flatten()
320325
WIN.glass.lib = "glass"
321326

322327
WIN.decora = [:]
@@ -361,7 +366,7 @@ WIN.prismD3D.nativeSource = [
361366
WIN.prismD3D.compiler = compiler
362367
WIN.prismD3D.ccFlags = [ccFlags, "/Ibuild/headers/PrismD3D"].flatten()
363368
WIN.prismD3D.linker = linker
364-
WIN.prismD3D.linkFlags = [linkFlags, "user32.lib"].flatten()
369+
WIN.prismD3D.linkFlags = (IS_STATIC_BUILD ? [linkFlags] : [linkFlags, "user32.lib"]).flatten()
365370
WIN.prismD3D.lib = "prism_d3d"
366371
WIN.prismD3D.rcCompiler = rcCompiler;
367372
WIN.prismD3D.rcSource = defaultRcSource
@@ -391,7 +396,7 @@ WIN.prismES2.nativeSource = [
391396
WIN.prismES2.compiler = compiler
392397
WIN.prismES2.ccFlags = ["/Ob1", "/GF", "/Gy", "/GS", "/DWIN32", ccFlags].flatten()
393398
WIN.prismES2.linker = linker
394-
WIN.prismES2.linkFlags = [linkFlags, "/SUBSYSTEM:WINDOWS", "opengl32.lib", "gdi32.lib", "user32.lib", "kernel32.lib"].flatten()
399+
WIN.prismES2.linkFlags = (IS_STATIC_BUILD ? [linkFlags] : [linkFlags, "/SUBSYSTEM:WINDOWS", "opengl32.lib", "gdi32.lib", "user32.lib", "kernel32.lib"]).flatten()
395400
WIN.prismES2.lib = "prism_es2"
396401
WIN.prismES2.rcCompiler = rcCompiler;
397402
WIN.prismES2.rcSource = defaultRcSource
@@ -407,7 +412,7 @@ WIN.font.compiler = compiler
407412
WIN.font.ccFlags = ["/DJFXFONT_PLUS", "/D_WIN32_WINNT=0x0601", ccFlags].flatten()
408413
WIN.font.ccFlags -= ["/DUNICODE", "/D_UNICODE"]
409414
WIN.font.linker = linker
410-
WIN.font.linkFlags = [linkFlags, "advapi32.lib", "gdi32.lib", "user32.lib", "dwrite.lib", "d2d1.lib", "windowscodecs.lib", "ole32.lib"].flatten()
415+
WIN.font.linkFlags = (IS_STATIC_BUILD ? [linkFlags] : [linkFlags, "advapi32.lib", "gdi32.lib", "user32.lib", "dwrite.lib", "d2d1.lib", "windowscodecs.lib", "ole32.lib"]).flatten()
411416
WIN.font.lib = "javafx_font"
412417
WIN.font.rcCompiler = rcCompiler;
413418
WIN.font.rcSource = defaultRcSource

modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/Utils.java

+13-3
Original file line numberDiff line numberDiff line change
@@ -417,17 +417,27 @@ public static String computeClippedText(Font font, String text, double width,
417417
}
418418

419419
public static String computeClippedWrappedText(Font font, String text, double width,
420-
double height, OverrunStyle truncationStyle,
420+
double height, double lineSpacing, OverrunStyle truncationStyle,
421421
String ellipsisString, TextBoundsType boundsType) {
422422
if (font == null) {
423423
throw new IllegalArgumentException("Must specify a font");
424424
}
425425

426+
// The height given does not need to include the line spacing after
427+
// the last line to be able to render that last line correctly.
428+
//
429+
// However the calculations include the line spacing as part of a
430+
// line's height. In order to not cut off the last line because its
431+
// line spacing wouldn't fit, the height used for the calculation
432+
// is increased here with the line spacing amount.
433+
434+
height += lineSpacing;
435+
426436
String ellipsis = (truncationStyle == CLIP) ? "" : ellipsisString;
427437
int eLen = ellipsis.length();
428438
// Do this before using helper, as it's not reentrant.
429439
double eWidth = computeTextWidth(font, ellipsis, 0);
430-
double eHeight = computeTextHeight(font, ellipsis, 0, boundsType);
440+
double eHeight = computeTextHeight(font, ellipsis, 0, lineSpacing, boundsType);
431441

432442
if (width < eWidth || height < eHeight) {
433443
// The ellipsis doesn't fit.
@@ -438,7 +448,7 @@ public static String computeClippedWrappedText(Font font, String text, double wi
438448
helper.setFont(font);
439449
helper.setWrappingWidth((int)Math.ceil(width));
440450
helper.setBoundsType(boundsType);
441-
helper.setLineSpacing(0);
451+
helper.setLineSpacing(lineSpacing);
442452

443453
boolean leading = (truncationStyle == LEADING_ELLIPSIS ||
444454
truncationStyle == LEADING_WORD_ELLIPSIS);

modules/javafx.controls/src/main/java/javafx/scene/control/skin/ButtonSkin.java

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public ButtonSkin(Button control) {
175175

176176
/** {@inheritDoc} */
177177
@Override public void dispose() {
178+
if (getSkinnable() == null) return;
178179
if (getSkinnable().isDefaultButton()) {
179180
setDefaultButton(false);
180181
}

modules/javafx.controls/src/main/java/javafx/scene/control/skin/LabeledSkinBase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ private void updateDisplayedText(double w, double h) {
11071107
String ellipsisString = labeled.getEllipsisString();
11081108

11091109
if (labeled.isWrapText()) {
1110-
result = Utils.computeClippedWrappedText(font, s, wrapWidth, wrapHeight, truncationStyle, ellipsisString, text.getBoundsType());
1110+
result = Utils.computeClippedWrappedText(font, s, wrapWidth, wrapHeight, labeled.getLineSpacing(), truncationStyle, ellipsisString, text.getBoundsType());
11111111
} else if (multiline) {
11121112
StringBuilder sb = new StringBuilder();
11131113

modules/javafx.controls/src/main/java/javafx/scene/control/skin/MenuButtonSkinBase.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ public MenuButtonSkinBase(final C control) {
218218

219219
/** {@inheritDoc} */
220220
@Override public void dispose() {
221-
// FIXME : JDK-8244112 - backout if we are already disposed
222-
// should check for getSkinnable to be null and return
221+
if (getSkinnable() == null) return;
223222

224223
// Cleanup accelerators
225224
if (getSkinnable().getScene() != null) {

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableCellSkinBase.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -133,6 +133,7 @@ public final TableColumnBase<S,T> getTableColumn() {
133133

134134
/** {@inheritDoc} */
135135
@Override public void dispose() {
136+
if (getSkinnable() == null) return;
136137
TableColumnBase<?,T> tableColumn = getTableColumn();
137138
if (tableColumn != null) {
138139
tableColumn.widthProperty().removeListener(weakColumnWidthListener);

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableViewSkinBase.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -357,6 +357,7 @@ public TableViewSkinBase(final C control) {
357357

358358
/** {@inheritDoc} */
359359
@Override public void dispose() {
360+
if (getSkinnable() == null) return;
360361
final ObjectProperty<ObservableList<S>> itemsProperty = TableSkinUtils.itemsProperty(this);
361362

362363
getVisibleLeafColumns().removeListener(weakVisibleLeafColumnsListener);

modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -2445,11 +2445,13 @@ private void updateScrollBarsAndCells(boolean recreate) {
24452445
}
24462446
else {
24472447
if (isVertical) {
2448-
hbar.resizeRelocate(0, (viewportLength-hbar.getHeight()),
2449-
viewportBreadth, hbar.prefHeight(viewportBreadth));
2448+
double prefHeight = hbar.prefHeight(viewportBreadth);
2449+
hbar.resizeRelocate(0, viewportLength - prefHeight,
2450+
viewportBreadth, prefHeight);
24502451
} else {
2451-
vbar.resizeRelocate((viewportLength-vbar.getWidth()), 0,
2452-
vbar.prefWidth(viewportBreadth), viewportBreadth);
2452+
double prefWidth = vbar.prefWidth(viewportBreadth);
2453+
vbar.resizeRelocate(viewportLength - prefWidth, 0,
2454+
prefWidth, viewportBreadth);
24532455
}
24542456
}
24552457

@@ -2522,9 +2524,11 @@ private void updateScrollBarsAndCells(boolean recreate) {
25222524
}
25232525
else {
25242526
if (isVertical) {
2525-
vbar.resizeRelocate((viewportBreadth-vbar.getWidth()), 0, vbar.prefWidth(viewportLength), viewportLength);
2527+
double prefWidth = vbar.prefWidth(viewportLength);
2528+
vbar.resizeRelocate(viewportBreadth - prefWidth, 0, prefWidth, viewportLength);
25262529
} else {
2527-
hbar.resizeRelocate(0, (viewportBreadth-hbar.getHeight()), viewportLength, hbar.prefHeight(-1));
2530+
double prefHeight = hbar.prefHeight(-1);
2531+
hbar.resizeRelocate(0, viewportBreadth - prefHeight, viewportLength, prefHeight);
25282532
}
25292533
}
25302534
}

modules/javafx.controls/src/shims/java/javafx/scene/control/ControlShim.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,19 @@
2828

2929
public class ControlShim extends Control {
3030

31+
/**
32+
* Installs the default skin for the given control.
33+
*
34+
* Note that this has no noticeable effect if the control's
35+
* skin already is set to the default skin (see skinProperty for
36+
* implementations details).
37+
*
38+
* @param control the control to set the default skin on
39+
*/
40+
public static void installDefaultSkin(Control control) {
41+
control.setSkin(control.createDefaultSkin());
42+
}
43+
3144
public static StringProperty skinClassNameProperty(Control c) {
3245
return c.skinClassNameProperty();
3346
}

modules/javafx.controls/src/test/java/test/javafx/scene/control/skin/LabelSkinTest.java

+35
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ public class LabelSkinTest {
136136
assertTrue(skin.propertyChanged);
137137
}
138138

139+
@Test public void lineSpacingChangesOnLabelShouldInvoke_handleControlPropertyChanged() {
140+
skin.addWatchedProperty(label.lineSpacingProperty());
141+
label.setLineSpacing(1.0);
142+
assertTrue(skin.propertyChanged);
143+
}
144+
139145
@Test public void textChangesOnLabelShouldInvoke_handleControlPropertyChanged() {
140146
skin.addWatchedProperty(label.textProperty());
141147
label.setText("Bust my buffers!");
@@ -279,6 +285,15 @@ public class LabelSkinTest {
279285
assertFalse(skin.get_invalidText());
280286
}
281287

288+
@Test public void lineSpacingChangesOnLabelShouldInvalidateLayoutAndDisplayText() {
289+
label.layout();
290+
skin.updateDisplayedText();
291+
292+
label.setLineSpacing(1.0);
293+
assertTrue(label.isNeedsLayout());
294+
assertTrue(skin.get_invalidText());
295+
}
296+
282297
@Test public void textChangesOnLabelShouldInvalidateLayoutAndDisplayTextAndTextWidth() {
283298
label.layout();
284299
skin.updateDisplayedText();
@@ -1145,6 +1160,26 @@ public class LabelSkinTest {
11451160
assertTrue(height >= singleLineHeight * 5);
11461161
}
11471162

1163+
@Test public void whenTextHasNewlinesAndPositiveLineSpacing_computePrefHeight_IncludesTheMultipleLinesAndLineSpacingInThePrefHeight() {
1164+
label.setLineSpacing(2);
1165+
label.setText("This\nis a test\nof the emergency\nbroadcast system.\nThis is only a test");
1166+
label.setPadding(new Insets(0, 0, 0, 0));
1167+
final double singleLineHeight = Utils.computeTextHeight(label.getFont(), " ", 0, text.getBoundsType());
1168+
final double expectedHeight = singleLineHeight * 5 + label.getLineSpacing() * 5 - label.getLineSpacing();
1169+
final double height = label.prefHeight(-1);
1170+
assertEquals(expectedHeight, height, 0);
1171+
}
1172+
1173+
@Test public void whenTextHasNewlinesAndNegativeLineSpacing_computePrefHeight_IncludesTheMultipleLinesAndLineSpacingInThePrefHeight() {
1174+
label.setLineSpacing(-2);
1175+
label.setText("This\nis a test\nof the emergency\nbroadcast system.\nThis is only a test");
1176+
label.setPadding(new Insets(0, 0, 0, 0));
1177+
final double singleLineHeight = Utils.computeTextHeight(label.getFont(), " ", 0, text.getBoundsType());
1178+
final double expectedHeight = singleLineHeight * 5 + label.getLineSpacing() * 5 - label.getLineSpacing();
1179+
final double height = label.prefHeight(-1);
1180+
assertEquals(expectedHeight, height, 0);
1181+
}
1182+
11481183
@Test public void whenTextHasNewlinesAfterPreviousComputationOf_computePrefHeight_IncludesTheMultipleLinesInThePrefHeight() {
11491184
label.setText("This is a test");
11501185
final double oldPrefHeight = label.prefHeight(-1);

0 commit comments

Comments
 (0)