Commit 64953ecc authored by Emmanuel Bourg's avatar Emmanuel Bourg

New upstream version 11+15

parent 63337746
......@@ -395,7 +395,7 @@ defineProperty("COMPILE_PARFAIT", "false")
ext.IS_COMPILE_PARFAIT = Boolean.parseBoolean(COMPILE_PARFAIT)
// BUILD_FXPACKAGER enables building the packager modules and native code
defineProperty("BUILD_FXPACKAGER", "true")
defineProperty("BUILD_FXPACKAGER", "false")
ext.IS_BUILD_FXPACKAGER = Boolean.parseBoolean(BUILD_FXPACKAGER)
// RETAIN_PACKAGER_TESTS specifies whether the tests in fxpackager should
......@@ -1221,8 +1221,8 @@ if (Integer.parseInt(NUM_COMPILE_THREADS.toString()) < 1) {
NUM_COMPILE_THREADS = 1
}
// Check for Gradle 4.3, error if < 3.0.
if (gradle.gradleVersion != "4.3") {
// Check for Gradle 4.8, error if < 4.3.
if (gradle.gradleVersion != "4.8") {
def ver = gradle.gradleVersion.split("[\\.]");
def gradleMajor = Integer.parseInt(ver[0]);
def gradleMinor = Integer.parseInt(ver[1].split("[^0-9]")[0]);
......@@ -1237,7 +1237,7 @@ if (gradle.gradleVersion != "4.3") {
logger.warn("*****************************************************************");
logger.warn("Unsupported gradle version $gradle.gradleVersion in use.");
logger.warn("Only version 4.3 is supported. Use this version at your own risk");
logger.warn("Only version 4.8 is supported. Use this version at your own risk");
if ( err != "") logger.warn(err);
logger.warn("*****************************************************************");
}
......@@ -1729,11 +1729,6 @@ allprojects {
}
}
// Qualified exports needed by javafx.* modules (excluding javafx.swing)
def qualExportsCore = [
"--add-exports=java.desktop/sun.print=javafx.graphics",
]
// Qualified exports needed by javafx.swing
def qualExportsSwing = [
"--add-exports=java.desktop/java.awt.dnd.peer=javafx.swing",
......@@ -1819,8 +1814,6 @@ project(":base") {
sourceSets.main.java.srcDirs += "$buildDir/gensrc/java"
compileJava.dependsOn processVersionInfo
compileJava.options.compilerArgs.addAll(qualExportsCore)
}
// The graphics module is needed for any graphical JavaFX application. It requires
......@@ -1935,7 +1928,6 @@ project(":graphics") {
'-implicit:none',
'--module-source-path', defaultModuleSourcePath
] )
options.compilerArgs.addAll(qualExportsCore)
}
classes.dependsOn(compileFullJava)
......@@ -2245,8 +2237,6 @@ project(":graphics") {
}
}
}
compileJava.options.compilerArgs.addAll(qualExportsCore)
}
project(":controls") {
......@@ -2305,8 +2295,6 @@ project(":controls") {
into project.moduleShimsDir
include "**/*.bss"
})
compileJava.options.compilerArgs.addAll(qualExportsCore)
}
project(":swing") {
......@@ -2342,7 +2330,6 @@ project(":swing") {
}
}
compileJava.options.compilerArgs.addAll(qualExportsCore)
compileJava.options.compilerArgs.addAll(qualExportsSwing)
}
......@@ -2436,8 +2423,6 @@ project(":fxml") {
// FIXME: change this to also allow JDK 9 boot jdk
classpath += files("$JDK_HOME/jre/lib/ext/nashorn.jar")
}
compileJava.options.compilerArgs.addAll(qualExportsCore)
}
project(":fxpackagerservices") {
......@@ -3638,8 +3623,6 @@ project(":media") {
dependsOn buildNativeTargets
}
}
compileJava.options.compilerArgs.addAll(qualExportsCore)
}
project(":web") {
......@@ -3725,6 +3708,7 @@ project(":web") {
compileTargets { t ->
def targetProperties = project.rootProject.ext[t.upper]
def webkitProperties = targetProperties.webkit
def classifier = (t.name != "linux" && t.name != "win") ? t.name :
IS_64 ? "${t.name}-amd64" : "${t.name}-i586"
......@@ -3767,12 +3751,19 @@ project(":web") {
} else if (t.name == "mac") {
cmakeArgs = "-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_MIN_VERSION -DCMAKE_OSX_SYSROOT=$MACOSX_SDK_PATH"
} else if (t.name == "linux") {
cmakeArgs = "-DCMAKE_SYSTEM_NAME=Linux"
cmakeArgs = "-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=${webkitProperties.compiler}"
if (IS_64) {
cmakeArgs = "$cmakeArgs -DCMAKE_SYSTEM_PROCESSOR=x86_64"
} else {
cmakeArgs = "$cmakeArgs -DCMAKE_SYSTEM_PROCESSOR=i586 -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32"
cmakeArgs = "$cmakeArgs -DCMAKE_SYSTEM_PROCESSOR=i586"
}
// TODO: Use cflags and ldflags from all platforms
def cFlags = webkitProperties.ccFlags?.join(' ') ?: ''
def lFlags = webkitProperties.linkFlags?.join(' ') ?: ''
// -shared flag should be omitted while creating executable.
def exeFlags = webkitProperties.linkFlags?.join(' ')?.replace('-shared', '') ?: ''
cmakeArgs = "$cmakeArgs -DCMAKE_C_FLAGS='${cFlags}' -DCMAKE_CXX_FLAGS='${cFlags}'"
cmakeArgs = "$cmakeArgs -DCMAKE_SHARED_LINKER_FLAGS='${lFlags}' -DCMAKE_EXE_LINKER_FLAGS='${exeFlags}'"
} else if (t.name.startsWith("arm")) {
fail("ARM target is not supported as of now.")
}
......@@ -3820,7 +3811,6 @@ project(":web") {
}
if (IS_WINDOWS && t.name == "win") {
def webkitProperties = project.rootProject.ext[t.upper].webkit
def rcTask = project.task("rc${t.capital}", type: CompileResourceTask) {
compiler = webkitProperties.rcCompiler
source(webkitProperties.rcSource)
......@@ -3863,8 +3853,6 @@ project(":web") {
if (IS_COMPILE_WEBKIT) {
assemble.dependsOn compileJavaDOMBinding, drtJar
}
compileJava.options.compilerArgs.addAll(qualExportsCore)
}
// This project is for system tests that need to run with a full SDK.
......
......@@ -52,10 +52,12 @@ if (!IS_64) {
// Specify the compilation parameters and link parameters
def ccFlags = [
commonFlags, "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c",
"-ffunction-sections", "-fdata-sections",
IS_DEBUG_NATIVE ? ["-ggdb", "-DVERBOSE"] : ["-O2", "-DNDEBUG"]].flatten()
def ccFlagsGTK3 = ccFlags
//ccFlags.addAll(["-Wnon-virtual-dtor", "-Woverloaded-virtual", "-std=c++0x"])
def linkFlags = ["-shared", commonFlags].flatten()
def linkFlags = ["-static-libgcc", "-static-libstdc++", "-shared", commonFlags,
"-Wl,--gc-sections"].flatten()
if (IS_DEBUG_NATIVE) {
linkFlags += "-g"
......@@ -268,9 +270,9 @@ if (!IS_64) {
LINUX.launcherlibrary = [:]
LINUX.launcherlibrary.compiler = compiler
LINUX.launcherlibrary.ccFlags = ["-Wextra", "-Wformat", "-Wformat-security", "-DJAVAARCH=\"$OS_ARCH\"", "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c", "-fPIC", "-std=gnu++98"]
LINUX.launcherlibrary.ccFlags = ["-Wextra", "-Wformat", "-Wformat-security", "-DJAVAARCH=\"$OS_ARCH\"", "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c", "-fPIC", "-std=gnu++98", "-ffunction-sections", "-fdata-sections"]
LINUX.launcherlibrary.linker = linker
LINUX.launcherlibrary.linkFlags = ["-ldl", "-lpthread", "-shared" ]
LINUX.launcherlibrary.linkFlags = ["-ldl", "-lpthread", "-shared", "-static-libgcc", "-static-libstdc++", "-Wl,--gc-sections"]
if (!IS_64) {
LINUX.launcherlibrary.ccFlags += "-m32"
LINUX.launcherlibrary.linkFlags += "-m32"
......@@ -327,3 +329,9 @@ LINUX.media = [:]
LINUX.media.compiler = compiler
LINUX.media.linker = linker
LINUX.media.ar = "ar"
LINUX.webkit = [:]
LINUX.webkit.compiler = compiler
LINUX.webkit.linker = linker
LINUX.webkit.ccFlags = commonFlags.flatten()
LINUX.webkit.linkFlags = linkFlags.flatten()
......@@ -29,4 +29,3 @@ exports sun.awt.dnd to javafx.swing;
exports sun.awt.image to javafx.swing;
exports sun.java2d to javafx.swing;
exports sun.swing to javafx.swing;
exports sun.print to javafx.graphics;
## Gradle v4.3
## Gradle v4.8
### Apache 2.0 License
<pre>
......
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
......@@ -1235,7 +1235,7 @@ public class TabPaneSkin extends SkinBase<TabPane> {
@Override
public void handle(MouseEvent me) {
Tab tab = getTab();
if (behavior.canCloseTab(tab)) {
if (me.getButton().equals(MouseButton.PRIMARY) && behavior.canCloseTab(tab)) {
behavior.closeTab(tab);
setOnMousePressed(null);
me.consume();
......@@ -1427,19 +1427,27 @@ public class TabPaneSkin extends SkinBase<TabPane> {
});
setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent me) {
if (getTab().isDisable()) {
Tab tab = getTab();
if (tab.isDisable()) {
return;
}
if (me.getButton().equals(MouseButton.MIDDLE)
|| me.getButton().equals(MouseButton.PRIMARY)) {
if (tab.getContextMenu() != null
&& tab.getContextMenu().isShowing()) {
tab.getContextMenu().hide();
}
}
if (me.getButton().equals(MouseButton.MIDDLE)) {
if (showCloseButton()) {
Tab tab = getTab();
if (behavior.canCloseTab(tab)) {
removeListeners(tab);
behavior.closeTab(tab);
}
}
} else if (me.getButton().equals(MouseButton.PRIMARY)) {
behavior.selectTab(getTab());
behavior.selectTab(tab);
}
}
});
......@@ -2005,18 +2013,24 @@ public class TabPaneSkin extends SkinBase<TabPane> {
}
private void handleHeaderMousePressed(MouseEvent event) {
((StackPane)event.getSource()).setMouseTransparent(true);
startDrag(event);
if (event.getButton().equals(MouseButton.PRIMARY)) {
((StackPane) event.getSource()).setMouseTransparent(true);
startDrag(event);
}
}
private void handleHeaderMouseReleased(MouseEvent event) {
((StackPane)event.getSource()).setMouseTransparent(false);
stopDrag();
event.consume();
if (event.getButton().equals(MouseButton.PRIMARY)) {
((StackPane) event.getSource()).setMouseTransparent(false);
stopDrag();
event.consume();
}
}
private void handleHeaderDragged(MouseEvent event) {
perfromDrag(event);
if (event.getButton().equals(MouseButton.PRIMARY)) {
perfromDrag(event);
}
}
private double getDragDelta(double curr, double prev) {
......
......@@ -35,6 +35,11 @@ import com.sun.javafx.text.GlyphLayout;
import com.sun.javafx.text.TextRun;
class PangoGlyphLayout extends GlyphLayout {
private static final long fontmap;
static {
fontmap = OSPango.pango_ft2_font_map_new();
}
private int getSlot(PGFont font, PangoGlyphString glyphString) {
CompositeFontResource fr = (CompositeFontResource)font.getFontResource();
......@@ -63,7 +68,7 @@ class PangoGlyphLayout extends GlyphLayout {
return slot;
}
private boolean check(long checkValue, String message, long fontmap, long context, long desc, long attrList) {
private boolean check(long checkValue, String message, long context, long desc, long attrList) {
if (checkValue != 0) return false;
if (message != null && PrismFontFactory.debugFonts) {
System.err.println(message);
......@@ -72,7 +77,6 @@ class PangoGlyphLayout extends GlyphLayout {
if (attrList != 0) OSPango.pango_attr_list_unref(attrList);
if (desc != 0) OSPango.pango_font_description_free(desc);
if (context != 0) OSPango.g_object_unref(context);
if (fontmap != 0) OSPango.g_object_unref(fontmap);
return true;
}
......@@ -85,12 +89,11 @@ class PangoGlyphLayout extends GlyphLayout {
if (composite) {
fr = ((CompositeFontResource)fr).getSlotResource(0);
}
long fontmap = OSPango.pango_ft2_font_map_new();
if (check(fontmap, "Failed allocating PangoFontMap.", 0, 0, 0, 0)) {
if (check(fontmap, "Failed allocating PangoFontMap.", 0, 0, 0)) {
return;
}
long context = OSPango.pango_font_map_create_context(fontmap);
if (check(context, "Failed allocating PangoContext.", fontmap, 0, 0, 0)) {
if (check(context, "Failed allocating PangoContext.", 0, 0, 0)) {
return;
}
boolean rtl = (run.getLevel() & 1) != 0;
......@@ -101,7 +104,7 @@ class PangoGlyphLayout extends GlyphLayout {
int style = fr.isItalic() ? OSPango.PANGO_STYLE_ITALIC : OSPango.PANGO_STYLE_NORMAL;
int weight = fr.isBold() ? OSPango.PANGO_WEIGHT_BOLD : OSPango.PANGO_WEIGHT_NORMAL;
long desc = OSPango.pango_font_description_new();
if (check(desc, "Failed allocating FontDescription.", fontmap, context, 0, 0)) {
if (check(desc, "Failed allocating FontDescription.", context, 0, 0)) {
return;
}
OSPango.pango_font_description_set_family(desc, fr.getFamilyName());
......@@ -110,11 +113,11 @@ class PangoGlyphLayout extends GlyphLayout {
OSPango.pango_font_description_set_style(desc, style);
OSPango.pango_font_description_set_weight(desc, weight);
long attrList = OSPango.pango_attr_list_new();
if (check(attrList, "Failed allocating PangoAttributeList.", fontmap, context, desc, 0)) {
if (check(attrList, "Failed allocating PangoAttributeList.", context, desc, 0)) {
return;
}
long attr = OSPango.pango_attr_font_desc_new(desc);
if (check(attr, "Failed allocating PangoAttribute.", fontmap, context, desc, attrList)) {
if (check(attr, "Failed allocating PangoAttribute.", context, desc, attrList)) {
return;
}
OSPango.pango_attr_list_insert(attrList, attr);
......@@ -125,7 +128,7 @@ class PangoGlyphLayout extends GlyphLayout {
if (str == 0L) {
str = OSPango.g_utf16_to_utf8(text);
if (check(str, "Failed allocating UTF-8 buffer.", fontmap, context, desc, attrList)) {
if (check(str, "Failed allocating UTF-8 buffer.", context, desc, attrList)) {
return;
}
}
......@@ -190,7 +193,7 @@ class PangoGlyphLayout extends GlyphLayout {
run.shape(glyphCount, glyphs, pos, indices);
}
check(0, null, fontmap, context, desc, attrList);
check(0, null, context, desc, attrList);
}
@Override
......
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, 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
......@@ -107,17 +107,19 @@ public final class DDasher implements DPathConsumer2D, MarlinConst {
* @param recycleDashes true to indicate to recycle the given dash array
* @return this instance
*/
public DDasher init(final DPathConsumer2D out, double[] dash, int dashLen,
double phase, boolean recycleDashes)
public DDasher init(final DPathConsumer2D out, final double[] dash, final int dashLen,
double phase, final boolean recycleDashes)
{
this.out = out;
// Normalize so 0 <= phase < dash[0]
int sidx = 0;
dashOn = true;
// note: BasicStroke constructor checks dash elements and sum > 0
double sum = 0.0d;
for (double d : dash) {
sum += d;
for (int i = 0; i < dashLen; i++) {
sum += dash[i];
}
double cycles = phase / sum;
if (phase < 0.0d) {
......@@ -125,13 +127,13 @@ public final class DDasher implements DPathConsumer2D, MarlinConst {
phase = 0.0d;
} else {
int fullcycles = FloatMath.floor_int(-cycles);
if ((fullcycles & dash.length & 1) != 0) {
if ((fullcycles & dashLen & 1) != 0) {
dashOn = !dashOn;
}
phase += fullcycles * sum;
while (phase < 0.0d) {
if (--sidx < 0) {
sidx = dash.length - 1;
sidx = dashLen - 1;
}
phase += dash[sidx];
dashOn = !dashOn;
......@@ -142,14 +144,14 @@ public final class DDasher implements DPathConsumer2D, MarlinConst {
phase = 0.0d;
} else {
int fullcycles = FloatMath.floor_int(cycles);
if ((fullcycles & dash.length & 1) != 0) {
if ((fullcycles & dashLen & 1) != 0) {
dashOn = !dashOn;
}
phase -= fullcycles * sum;
double d;
while (phase >= (d = dash[sidx])) {
phase -= d;
sidx = (sidx + 1) % dash.length;
sidx = (sidx + 1) % dashLen;
dashOn = !dashOn;
}
}
......
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, 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
......@@ -108,17 +108,19 @@ public final class Dasher implements PathConsumer2D, MarlinConst {
* @param recycleDashes true to indicate to recycle the given dash array
* @return this instance
*/
public Dasher init(final PathConsumer2D out, float[] dash, int dashLen,
float phase, boolean recycleDashes)
public Dasher init(final PathConsumer2D out, final float[] dash, final int dashLen,
float phase, final boolean recycleDashes)
{
this.out = out;
// Normalize so 0 <= phase < dash[0]
int sidx = 0;
dashOn = true;
// note: BasicStroke constructor checks dash elements and sum > 0
float sum = 0.0f;
for (float d : dash) {
sum += d;
for (int i = 0; i < dashLen; i++) {
sum += dash[i];
}
float cycles = phase / sum;
if (phase < 0.0f) {
......@@ -126,13 +128,13 @@ public final class Dasher implements PathConsumer2D, MarlinConst {
phase = 0.0f;
} else {
int fullcycles = FloatMath.floor_int(-cycles);
if ((fullcycles & dash.length & 1) != 0) {
if ((fullcycles & dashLen & 1) != 0) {
dashOn = !dashOn;
}
phase += fullcycles * sum;
while (phase < 0.0f) {
if (--sidx < 0) {
sidx = dash.length - 1;
sidx = dashLen - 1;
}
phase += dash[sidx];
dashOn = !dashOn;
......@@ -143,14 +145,14 @@ public final class Dasher implements PathConsumer2D, MarlinConst {
phase = 0.0f;
} else {
int fullcycles = FloatMath.floor_int(cycles);
if ((fullcycles & dash.length & 1) != 0) {
if ((fullcycles & dashLen & 1) != 0) {
dashOn = !dashOn;
}
phase -= fullcycles * sum;
float d;
while (phase >= (d = dash[sidx])) {
phase -= d;
sidx = (sidx + 1) % dash.length;
sidx = (sidx + 1) % dashLen;
dashOn = !dashOn;
}
}
......
......@@ -80,6 +80,8 @@ import com.sun.javafx.sg.prism.NGNode;
import com.sun.javafx.stage.WindowHelper;
import com.sun.javafx.tk.TKStage;
import com.sun.javafx.tk.Toolkit;
import com.sun.glass.utils.NativeLibLoader;
import com.sun.prism.impl.PrismSettings;
import com.sun.prism.j2d.PrismPrintGraphics;
......@@ -89,6 +91,21 @@ import java.security.PrivilegedAction;
public class J2DPrinterJob implements PrinterJobImpl {
static {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
String libName = "prism_common";
if (PrismSettings.verbose) {
System.out.println("Loading Prism common native library ...");
}
NativeLibLoader.loadLibrary(libName);
if (PrismSettings.verbose) {
System.out.println("\tsucceeded.");
}
return null;
});
}
javafx.print.PrinterJob fxPrinterJob;
java.awt.print.PrinterJob pJob2D;
javafx.print.Printer fxPrinter;
......@@ -106,17 +123,25 @@ public class J2DPrinterJob implements PrinterJobImpl {
PrintRequestAttribute alwaysOnTop = null;
try {
if (onTopClass == null) {
onTopClass = Class.forName("sun.print.DialogOnTop");
onTopClass =
Class.forName("javax.print.attribute.standard.DialogOwner");
}
if (id == 0) {
Constructor<PrintRequestAttribute>
cons = onTopClass.getConstructor();
alwaysOnTop = cons.newInstance();
} else {
alwaysOnTop = getAlwaysOnTop(onTopClass, id);
}
Constructor<PrintRequestAttribute> cons =
onTopClass.getConstructor(long.class);
alwaysOnTop = cons.newInstance(id);
} catch (Throwable t) {
}
return alwaysOnTop;
});
}
private static native
PrintRequestAttribute getAlwaysOnTop(Class onTopClass, long id);
public J2DPrinterJob(javafx.print.PrinterJob fxJob) {
fxPrinterJob = fxJob;
......@@ -159,7 +184,10 @@ public class J2DPrinterJob implements PrinterJobImpl {
printReqAttrSet.remove(onTopClass);
}
if (owner != null) {
long id = WindowHelper.getPeer(owner).getRawHandle();
long id = 0L;
if (PlatformUtil.isWindows()) {
id = WindowHelper.getPeer(owner).getRawHandle();
}
PrintRequestAttribute alwaysOnTop = getAlwaysOnTop(id);
if (alwaysOnTop != null) {
printReqAttrSet.add(alwaysOnTop);
......@@ -230,7 +258,10 @@ public class J2DPrinterJob implements PrinterJobImpl {
printReqAttrSet.remove(onTopClass);
}
if (owner != null) {
long id = WindowHelper.getPeer(owner).getRawHandle();
long id = 0L;
if (PlatformUtil.isWindows()) {
id = WindowHelper.getPeer(owner).getRawHandle();
}
PrintRequestAttribute alwaysOnTop = getAlwaysOnTop(id);
if (alwaysOnTop != null) {
printReqAttrSet.add(alwaysOnTop);
......
......@@ -158,7 +158,7 @@ final class CssStyleHelper {
// If this node had a style helper, then reset properties to their initial value
// since the node won't have a style helper after this call
if (node.styleHelper != null) {
node.styleHelper.resetToInitialValues(node, null);
node.styleHelper.resetToInitialValues(node);
}
//
......@@ -181,14 +181,7 @@ final class CssStyleHelper {
// If this node had a style helper, then reset properties to their initial value
// since the style map might now be different
if (node.styleHelper != null) {
StyleMap oldMap = node.styleHelper.getStyleMap(node);
StyleMap newMap = helper.getStyleMap(node);
if (oldMap != newMap) {
node.styleHelper.resetToInitialValues(node, null);
} else {
node.styleHelper.resetToInitialValues(node, newMap);
}
node.styleHelper.resetToInitialValues(node);
}
return helper;
}
......@@ -454,58 +447,29 @@ final class CssStyleHelper {
private boolean forceSlowpath = false;
}
private void resetToInitialValues(final Styleable styleable, StyleMap smap) {
// This method is invoked on a styleHelper before it is being reset
// to null or a new StyleHelper.
//
// if smap is null/empty -- it means node will not have any new styles
// in immediate future.
//
// Action taken in this method :
// reset all styleableProperties in cssSetProperties to initial values
// if smap is a valid StyleMap -- it means node will have styles from
// new stylemap in immediate future
//
// Action taken in this method :
// reset styleableProperties in cssSetProperties in case they are not
// present in smap
private void resetToInitialValues(final Styleable styleable) {
if (cacheContainer == null ||
cacheContainer.cssSetProperties == null ||
cacheContainer.cssSetProperties.isEmpty()) return;
// RT-31714 - make a copy of the entry set and clear the cssSetProperties immediately.
Set<Entry<CssMetaData, CalculatedValue>> entrySet =
new HashSet<>(cacheContainer.cssSetProperties.entrySet());
Set<Entry<CssMetaData, CalculatedValue>> entrySet = new HashSet<>(cacheContainer.cssSetProperties.entrySet());
cacheContainer.cssSetProperties.clear();
if (smap == null || smap.isEmpty() ) {
for (Entry<CssMetaData, CalculatedValue> resetValues : entrySet) {
final CssMetaData metaData = resetValues.getKey();
setStyleableProperty(metaData.getStyleableProperty(styleable), resetValues.getValue());
}
} else {
Map<String, List<CascadingStyle>> newStyles = smap.getCascadingStyles();
for (Entry<CssMetaData, CalculatedValue> resetValues : entrySet) {
for (Entry<CssMetaData, CalculatedValue> resetValues : entrySet) {
final CssMetaData metaData = resetValues.getKey();
final CssMetaData metaData = resetValues.getKey();
final StyleableProperty styleableProperty = metaData.getStyleableProperty(styleable);
if (newStyles.containsKey(metaData.getProperty()) == false) {
// earlier set property is not available in new Stylemap - reset it to initial value
setStyleableProperty(metaData.getStyleableProperty(styleable), resetValues.getValue());
}
final StyleOrigin styleOrigin = styleableProperty.getStyleOrigin();
if (styleOrigin != null && styleOrigin != StyleOrigin.USER) {
final CalculatedValue calculatedValue = resetValues.getValue();
styleableProperty.applyStyle(calculatedValue.getOrigin(), calculatedValue.getValue());
}
}
}
private void setStyleableProperty(StyleableProperty property, CalculatedValue value) {
final StyleOrigin styleOrigin = property.getStyleOrigin();
if (styleOrigin != null && styleOrigin != StyleOrigin.USER) {
property.applyStyle(value.getOrigin(), value.getValue());
}
}
private StyleMap getStyleMap(Styleable styleable) {
if (cacheContainer == null || styleable == null) return null;
......
......@@ -72,8 +72,6 @@ module javafx.graphics {
javafx.web;
exports com.sun.javafx.css to
javafx.controls;
exports com.sun.javafx.css.parser to
jdk.packager;
exports com.sun.javafx.cursor to
javafx.swing;
exports com.sun.javafx.embed to
......
......@@ -7,7 +7,9 @@ glue(shaderName,samplerInit,paramInit,maxTexCoordIndex,isPixcoordUsed) ::= <<
*
* 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.
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*