started removing support for vml

development
mcyph 2021-03-20 14:58:27 +11:00
parent b416ac578f
commit 62f0f61eda
16 changed files with 54 additions and 189 deletions

View File

@ -139,7 +139,7 @@
{
if (this.state != null && this.domNode != null)
{
var dy = (mxClient.IS_VML && document.compatMode == 'CSS1Compat') ? 20 : 4;
var dy = 4;
this.domNode.style.left = (this.state.x + this.state.width - 56) + 'px';
this.domNode.style.top = (this.state.y + this.state.height + dy) + 'px';
}

View File

@ -15,7 +15,7 @@ var OpenDialog = function()
iframe.frameBorder = '0';
// Adds padding as a workaround for box model in older IE versions
var dx = (mxClient.IS_VML && (document.documentMode == null || document.documentMode < 8)) ? 20 : 0;
var dx = 0;
iframe.setAttribute('width', (((Editor.useLocalStorage) ? 640 : 320) + dx) + 'px');
iframe.setAttribute('height', (((Editor.useLocalStorage) ? 480 : 220) + dx) + 'px');
@ -1688,12 +1688,8 @@ var LinkDialog = function(editorUi, initialValue, btnLabel, fn)
inner.style.whiteSpace = 'nowrap';
inner.style.textOverflow = 'clip';
inner.style.cursor = 'default';
if (!mxClient.IS_VML)
{
inner.style.paddingRight = '20px';
}
inner.style.paddingRight = '20px';
var linkInput = document.createElement('input');
linkInput.setAttribute('value', initialValue);
linkInput.setAttribute('placeholder', 'http://www.example.com/');
@ -1712,10 +1708,8 @@ var LinkDialog = function(editorUi, initialValue, btnLabel, fn)
cross.style.width = '12px';
cross.style.height = '14px';
cross.style.cursor = 'pointer';
// Workaround for inline-block not supported in IE
cross.style.display = (mxClient.IS_VML) ? 'inline' : 'inline-block';
cross.style.top = ((mxClient.IS_VML) ? 0 : 3) + 'px';
cross.style.display = 'inline-block';
cross.style.top = '3px';
// Needed to block event transparency in IE
cross.style.background = 'url(' + IMAGE_PATH + '/transparent.gif)';

View File

@ -783,13 +783,6 @@ function Dialog(editorUi, elt, w, h, modal, closable, onClose, noScroll, transpa
{
var dx = 0;
if (mxClient.IS_VML && (document.documentMode == null || document.documentMode < 8))
{
// Adds padding as a workaround for box model in older IE versions
// This needs to match the total padding of geDialog in CSS
dx = 80;
}
w += dx;
h += dx;

View File

@ -1875,12 +1875,9 @@ EditorUi.prototype.initCanvas = function()
this.chromelessToolbar.style.padding = '10px 10px 8px 10px';
this.chromelessToolbar.style.left = (graph.isViewer()) ? '0' : '50%';
if (!mxClient.IS_VML)
{
mxUtils.setPrefixedStyle(this.chromelessToolbar.style, 'borderRadius', '20px');
mxUtils.setPrefixedStyle(this.chromelessToolbar.style, 'transition', 'opacity 600ms ease-in-out');
}
mxUtils.setPrefixedStyle(this.chromelessToolbar.style, 'borderRadius', '20px');
mxUtils.setPrefixedStyle(this.chromelessToolbar.style, 'transition', 'opacity 600ms ease-in-out');
var updateChromelessToolbarPosition = mxUtils.bind(this, function()
{
var css = mxUtils.getCurrentStyle(graph.container);

View File

@ -7667,8 +7667,7 @@ if (typeof mxVertexHandler != 'undefined')
pt.x, pt.y) && !mxUtils.isAncestorNode(state.text.node, mxEvent.getSource(evt))))) &&
((state == null && !this.isCellLocked(this.getDefaultParent())) ||
(state != null && !this.isCellLocked(state.cell))) &&
(state != null || (mxClient.IS_VML && src == this.view.getCanvas()) ||
(mxClient.IS_SVG && src == this.view.getCanvas().ownerSVGElement)))
(state != null || (mxClient.IS_SVG && src == this.view.getCanvas().ownerSVGElement)))
{
if (state == null)
{
@ -9932,14 +9931,7 @@ if (typeof mxVertexHandler != 'undefined')
this.textarea.style.left = Math.round(this.bounds.x) + 'px';
this.textarea.style.top = Math.round(this.bounds.y) + 'px';
if (mxClient.IS_VML)
{
this.textarea.style.zoom = scale;
}
else
{
mxUtils.setPrefixedStyle(this.textarea.style, 'transform', 'scale(' + scale + ',' + scale + ')');
}
mxUtils.setPrefixedStyle(this.textarea.style, 'transform', 'scale(' + scale + ',' + scale + ')');
}
else
{

View File

@ -2530,13 +2530,7 @@ Sidebar.prototype.createThumb = function(cells, width, height, parent, title, sh
this.graph.getModel().clear();
mxClient.NO_FO = fo;
// Catch-all event handling
if (mxClient.IS_IE6)
{
parent.style.backgroundImage = 'url(' + this.editorUi.editor.transparentImage + ')';
}
node.style.position = 'relative';
node.style.overflow = 'hidden';
node.style.left = this.thumbBorder + 'px';
@ -2581,12 +2575,7 @@ Sidebar.prototype.createItem = function(cells, title, showLabel, showTitle, widt
elt.style.width = (this.thumbWidth + border) + 'px';
elt.style.height = (this.thumbHeight + border) + 'px';
elt.style.padding = this.thumbPadding + 'px';
if (mxClient.IS_IE6)
{
elt.style.border = 'none';
}
// Blocks default click action
mxEvent.addListener(elt, 'click', function(evt)
{

View File

@ -352,9 +352,9 @@ mouseDownCounter = 0;
*
* Switch to enable moving the preview away from the mousepointer. This is required in browsers
* where the preview cannot be made transparent to events and if the built-in hit detection on
* the HTML elements in the page should be used. Default is the value of <mxClient.IS_VML>.
* the HTML elements in the page should be used. Default is false.
*/
movePreviewAway = mxClient.IS_VML;
movePreviewAway = false;
/**
* Variable: outlineConnect

View File

@ -383,8 +383,8 @@ repaint = ()=>
this.width = Math.max(this.first.x, x) - this.x;
this.height = Math.max(this.first.y, y) - this.y;
var dx = (mxClient.IS_VML) ? this.graph.panDx : 0;
var dy = (mxClient.IS_VML) ? this.graph.panDy : 0;
var dx = 0;
var dy = 0;
this.div.style.left = (this.x + dx) + 'px';
this.div.style.top = (this.y + dy) + 'px';

View File

@ -23,13 +23,6 @@ var mxClient = {
*/
VERSION: '4.2.2',
/**
* Variable: IS_IE6
*
* True if the current browser is Internet Explorer 6.x.
*/
IS_IE6: navigator.userAgent != null && navigator.userAgent.indexOf('MSIE 6') >= 0,
/**
* Variable: IS_EDGE
*
@ -136,13 +129,6 @@ var mxClient = {
(navigator.userAgent.indexOf('Iceape/') >= 0 &&
navigator.userAgent.indexOf('Iceape/1.') < 0),
/**
* Variable: IS_VML
*
* True if the browser supports VML.
*/
IS_VML: navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER',
/**
* Variable: IS_SVG
*
@ -214,7 +200,7 @@ var mxClient = {
* Function: isBrowserSupported
*
* Returns true if the current browser is supported, that is, if
* <mxClient.IS_VML> or <mxClient.IS_SVG> is true.
* <mxClient.IS_SVG> is true.
*
* Example:
*
@ -253,23 +239,19 @@ var mxClient = {
doc = doc || document;
// Workaround for Operation Aborted in IE6 if base tag is used in head
if (mxClient.IS_IE6) {
doc.write('<link rel="' + rel + '" href="' + href + '" charset="UTF-8" type="text/css"/>');
} else {
var link = doc.createElement('link');
var link = doc.createElement('link');
link.setAttribute('rel', rel);
link.setAttribute('href', href);
link.setAttribute('charset', 'UTF-8');
link.setAttribute('type', 'text/css');
link.setAttribute('rel', rel);
link.setAttribute('href', href);
link.setAttribute('charset', 'UTF-8');
link.setAttribute('type', 'text/css');
if (id) {
link.setAttribute('id', id);
}
var head = doc.getElementsByTagName('head')[0];
head.appendChild(link);
if (id) {
link.setAttribute('id', id);
}
var head = doc.getElementsByTagName('head')[0];
head.appendChild(link);
},
/**
@ -529,43 +511,6 @@ if (typeof(mxLanguages) != 'undefined' && mxLanguages != null) {
mxClient.languages = mxLanguages;
}
// Adds required namespaces, stylesheets and memory handling for older IE browsers
if (mxClient.IS_VML) {
if (mxClient.IS_SVG) {
mxClient.IS_VML = false;
} else {
// Enables support for IE8 standards mode. Note that this requires all attributes for VML
// elements to be set using direct notation, ie. node.attr = value, not setAttribute.
if (document.namespaces != null) {
if (document.documentMode == 8) {
document.namespaces.add(mxClient.VML_PREFIX, 'urn:schemas-microsoft-com:vml', '#default#VML');
document.namespaces.add(mxClient.OFFICE_PREFIX, 'urn:schemas-microsoft-com:office:office', '#default#VML');
} else {
document.namespaces.add(mxClient.VML_PREFIX, 'urn:schemas-microsoft-com:vml');
document.namespaces.add(mxClient.OFFICE_PREFIX, 'urn:schemas-microsoft-com:office:office');
}
}
// Workaround for limited number of stylesheets in IE (does not work in standards mode)
if (mxClient.IS_QUIRKS && document.styleSheets.length >= 30) {
(() => {
var node = document.createElement('style');
node.type = 'text/css';
node.styleSheet.cssText = mxClient.VML_PREFIX + '\\:*{behavior:url(#default#VML)}' +
mxClient.OFFICE_PREFIX + '\\:*{behavior:url(#default#VML)}';
document.getElementsByTagName('head')[0].appendChild(node);
})();
} else {
document.createStyleSheet().cssText = mxClient.VML_PREFIX + '\\:*{behavior:url(#default#VML)}' +
mxClient.OFFICE_PREFIX + '\\:*{behavior:url(#default#VML)}';
}
if (mxLoadStylesheets) {
mxClient.link('stylesheet', mxClient.basePath + '/css/explorer.css');
}
}
}
// PREPROCESSOR-REMOVE-START
// If script is loaded via CommonJS, do not write <script> tags to the page
// for dependencies. These are already included in the build.

View File

@ -170,7 +170,7 @@ class mxImageShape extends mxRectangleShape {
this.node.style.borderColor = stroke;
// VML image supports PNG in IE6
var useVml = mxClient.IS_IE6 || ((document.documentMode == null || document.documentMode <= 8) && this.rotation !== 0);
var useVml = false;
var img = document.createElement((useVml) ? mxClient.VML_PREFIX + ':image' : 'img');
img.setAttribute('border', '0');
img.style.position = 'absolute';

View File

@ -300,11 +300,8 @@ class mxShape {
if (container != null && container.ownerSVGElement != null) {
node = this.createSvg(container);
} else if (document.documentMode === 8 || !mxClient.IS_VML ||
(this.dialect !== mxConstants.DIALECT_VML && this.isHtmlAllowed())) {
node = this.createHtml(container);
} else {
node = this.createVml(container);
node = this.createHtml(container);
}
return node;
@ -367,7 +364,7 @@ class mxShape {
this.node.style.visibility = 'visible';
this.clear();
if (this.node.nodeName === 'DIV' && (this.isHtmlAllowed() || !mxClient.IS_VML)) {
if (this.node.nodeName === 'DIV') {
this.redrawHtmlShape();
} else {
this.redrawShape();
@ -546,9 +543,6 @@ class mxShape {
// LATER: Check if reusing existing DOM nodes improves performance
if (this.node.ownerSVGElement != null) {
canvas = this.createSvgCanvas();
} else if (mxClient.IS_VML) {
this.updateVmlContainer();
canvas = this.createVmlCanvas();
}
if (canvas != null && this.outline) {

View File

@ -277,7 +277,7 @@ class mxText extends mxShape {
redraw = () => {
if (this.visible && this.checkBounds() && this.cacheEnabled && this.lastValue == this.value &&
(mxUtils.isNode(this.value) || this.dialect == mxConstants.DIALECT_STRICTHTML)) {
if (this.node.nodeName == 'DIV' && (this.isHtmlAllowed() || !mxClient.IS_VML)) {
if (this.node.nodeName === 'DIV') {
if (mxClient.IS_SVG) {
this.redrawHtmlShapeWithCss3();
} else {

View File

@ -2682,17 +2682,9 @@ var mxUtils = {
*/
createImage: (src) => {
var imageNode = null;
if (mxClient.IS_IE6 && document.compatMode != 'CSS1Compat') {
imageNode = document.createElement(mxClient.VML_PREFIX + ':image');
imageNode.setAttribute('src', src);
imageNode.style.borderStyle = 'none';
} else {
imageNode = document.createElement('img');
imageNode.setAttribute('src', src);
imageNode.setAttribute('border', '0');
}
imageNode = document.createElement('img');
imageNode.setAttribute('src', src);
imageNode.setAttribute('border', '0');
return imageNode;
},

View File

@ -682,17 +682,10 @@ resize = ()=>
}
}
if (mxClient.IS_VML)
{
this.textarea.style.zoom = scale;
}
else
{
mxUtils.setPrefixedStyle(this.textarea.style, 'transformOrigin', '0px 0px');
mxUtils.setPrefixedStyle(this.textarea.style, 'transform',
'scale(' + scale + ',' + scale + ')' + ((m == null) ? '' :
' translate(' + (m.x * 100) + '%,' + (m.y * 100) + '%)'));
}
mxUtils.setPrefixedStyle(this.textarea.style, 'transformOrigin', '0px 0px');
mxUtils.setPrefixedStyle(this.textarea.style, 'transform',
'scale(' + scale + ',' + scale + ')' + ((m == null) ? '' :
' translate(' + (m.x * 100) + '%,' + (m.y * 100) + '%)'));
}
};
@ -729,31 +722,24 @@ getBackgroundColor = (state)=>
*/
isLegacyEditor = ()=>
{
if (mxClient.IS_VML)
var absoluteRoot = false;
if (mxClient.IS_SVG)
{
return true;
}
else
{
var absoluteRoot = false;
if (mxClient.IS_SVG)
var root = this.graph.view.getDrawPane().ownerSVGElement;
if (root != null)
{
var root = this.graph.view.getDrawPane().ownerSVGElement;
if (root != null)
var css = mxUtils.getCurrentStyle(root);
if (css != null)
{
var css = mxUtils.getCurrentStyle(root);
if (css != null)
{
absoluteRoot = css.position == 'absolute';
}
absoluteRoot = css.position == 'absolute';
}
}
return !absoluteRoot;
}
return !absoluteRoot;
};
/**

View File

@ -648,10 +648,6 @@ function mxGraph(container, model, renderHint, stylesheet)
{
this.dialect = mxConstants.DIALECT_SVG;
}
else if (renderHint == mxConstants.RENDERING_HINT_EXACT && mxClient.IS_VML)
{
this.dialect = mxConstants.DIALECT_VML;
}
else if (renderHint == mxConstants.RENDERING_HINT_FASTEST)
{
this.dialect = mxConstants.DIALECT_STRICTHTML;

View File

@ -450,19 +450,12 @@ open = (css, targetWindow, forcePageBreaks, keepOpen)=>
doc.writeln(dt);
}
if (mxClient.IS_VML)
if (document.compatMode === 'CSS1Compat')
{
doc.writeln('<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">');
doc.writeln('<!DOCTYPE html>');
}
else
{
if (document.compatMode === 'CSS1Compat')
{
doc.writeln('<!DOCTYPE html>');
}
doc.writeln('<html>');
}
doc.writeln('<html>');
doc.writeln('<head>');
this.writeHead(doc, css);
@ -701,12 +694,6 @@ writeHead = (doc, css)=>
doc.writeln('<title>' + this.title + '</title>');
}
// Adds required namespaces
if (mxClient.IS_VML)
{
doc.writeln('<style type="text/css">v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}</style>');
}
// Adds all required stylesheets
mxClient.link('stylesheet', mxClient.basePath + '/css/common.css', doc);