From 33afebeaeba978afaf6d7b52a44cf2f87e29a007 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Thu, 15 Aug 2002 21:49:40 +0000 Subject: [PATCH] Fix upper limits for input fields in Composer property dialogs. b=155193, r=brade, sr=hewitt git-svn-id: svn://10.0.0.236/trunk@127403 18797224-902f-48f8-a5cc-f745e15eee43 --- .../ui/dialogs/content/EdDialogCommon.js | 12 ++++++++--- .../editor/ui/dialogs/content/EdHLineProps.js | 2 +- .../ui/dialogs/content/EdImageOverlay.js | 10 ++++----- .../ui/dialogs/content/EdInsertTable.js | 11 ++++------ .../editor/ui/dialogs/content/EdTableProps.js | 21 ++++++++----------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js index cad77a67a7e..c29e1816888 100644 --- a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js +++ b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js @@ -32,10 +32,16 @@ var gDialog = {}; var gValidationError = false; // Use for 'defaultIndex' param in InitPixelOrPercentMenulist -var gPixel = 0; -var gPercent = 1; +const gPixel = 0; +const gPercent = 1; + +const gMaxPixels = 100000; // Used for image size, borders, spacing, and padding +// Gecko code uses 1000 for maximum rowspan, colspan +// Also, editing performance is really bad above this +const gMaxRows = 1000; +const gMaxColumns = 1000; +const gMaxTableSize = 1000000; // Width or height of table or cells -var maxPixels = 10000; // For dialogs that expand in size. Default is smaller size see "onMoreFewer()" below var SeeMore = false; diff --git a/mozilla/editor/ui/dialogs/content/EdHLineProps.js b/mozilla/editor/ui/dialogs/content/EdHLineProps.js index 5e49bf27676..653186e1bd8 100644 --- a/mozilla/editor/ui/dialogs/content/EdHLineProps.js +++ b/mozilla/editor/ui/dialogs/content/EdHLineProps.js @@ -171,7 +171,7 @@ function ValidateData() if (gValidationError) return false; - width = ValidateNumber(gDialog.widthInput, gDialog.pixelOrPercentMenulist, 1, maxPixels, + width = ValidateNumber(gDialog.widthInput, gDialog.pixelOrPercentMenulist, 1, gMaxPixels, globalElement, "width", false); if (gValidationError) return false; diff --git a/mozilla/editor/ui/dialogs/content/EdImageOverlay.js b/mozilla/editor/ui/dialogs/content/EdImageOverlay.js index 865ba47bc92..60fe332e418 100644 --- a/mozilla/editor/ui/dialogs/content/EdImageOverlay.js +++ b/mozilla/editor/ui/dialogs/content/EdImageOverlay.js @@ -530,12 +530,12 @@ function ValidateImage() if (!gDialog.actualSizeRadio.selected) { // Get user values for width and height - width = ValidateNumber(gDialog.widthInput, gDialog.widthUnitsMenulist, 1, maxPixels, + width = ValidateNumber(gDialog.widthInput, gDialog.widthUnitsMenulist, 1, gMaxPixels, globalElement, "width", false, true); if (gValidationError) return false; - height = ValidateNumber(gDialog.heightInput, gDialog.heightUnitsMenulist, 1, maxPixels, + height = ValidateNumber(gDialog.heightInput, gDialog.heightUnitsMenulist, 1, gMaxPixels, globalElement, "height", false, true); if (gValidationError) return false; @@ -563,18 +563,18 @@ function ValidateImage() // spacing attributes gValidateTab = gDialog.tabBorder; - ValidateNumber(gDialog.imagelrInput, null, 0, maxPixels, + ValidateNumber(gDialog.imagelrInput, null, 0, gMaxPixels, globalElement, "hspace", false, true, true); if (gValidationError) return false; - ValidateNumber(gDialog.imagetbInput, null, 0, maxPixels, + ValidateNumber(gDialog.imagetbInput, null, 0, gMaxPixels, globalElement, "vspace", false, true); if (gValidationError) return false; // note this is deprecated and should be converted to stylesheets - ValidateNumber(gDialog.border, null, 0, maxPixels, + ValidateNumber(gDialog.border, null, 0, gMaxPixels, globalElement, "border", false, true); if (gValidationError) return false; diff --git a/mozilla/editor/ui/dialogs/content/EdInsertTable.js b/mozilla/editor/ui/dialogs/content/EdInsertTable.js index da445aa946b..f69e03490ca 100644 --- a/mozilla/editor/ui/dialogs/content/EdInsertTable.js +++ b/mozilla/editor/ui/dialogs/content/EdInsertTable.js @@ -25,9 +25,6 @@ var tagName = "table" var tableElement = null; var rowElement = null; var cellElement = null; -var maxRows = 10000; -var maxColumns = 10000; -var maxPixels = 10000; var rows; var columns; var prefs = GetPrefs(); @@ -114,21 +111,21 @@ function ChangeRowOrColumn(id) // Set attributes on globalElement so they can be accessed by AdvancedEdit() function ValidateData() { - rows = ValidateNumber(gDialog.rowsInput, null, 1, maxRows, null, null, true) + rows = ValidateNumber(gDialog.rowsInput, null, 1, gMaxRows, null, null, true) if (gValidationError) return false; - columns = ValidateNumber(gDialog.columnsInput, null, 1, maxColumns, null, null, true) + columns = ValidateNumber(gDialog.columnsInput, null, 1, gMaxColumns, null, null, true) if (gValidationError) return false; // Set attributes: NOTE: These may be empty strings (last param = false) - ValidateNumber(gDialog.borderInput, null, 0, maxPixels, globalElement, "border", false); + ValidateNumber(gDialog.borderInput, null, 0, gMaxPixels, globalElement, "border", false); // TODO: Deal with "BORDER" without value issue if (gValidationError) return false; ValidateNumber(gDialog.widthInput, gDialog.widthPixelOrPercentMenulist, - 1, maxPixels, globalElement, "width", false); + 1, gMaxTableSize, globalElement, "width", false); if (gValidationError) return false; diff --git a/mozilla/editor/ui/dialogs/content/EdTableProps.js b/mozilla/editor/ui/dialogs/content/EdTableProps.js index 6043d4b4194..4724fde5381 100644 --- a/mozilla/editor/ui/dialogs/content/EdTableProps.js +++ b/mozilla/editor/ui/dialogs/content/EdTableProps.js @@ -74,9 +74,6 @@ From C++: var gSelectedCellCount = 0; var ApplyUsed = false; -// What should these be? -var maxRows = 1000; // This is the value gecko code uses for maximum rowspan, colspan -var maxColumns = 1000; var selection; var CellDataChanged = false; var canDelete = false; @@ -771,10 +768,10 @@ function SetAlign(listID, defaultValue, element, attName) function ValidateTableData() { gValidateTab = gDialog.TableTab; - newRowCount = Number(ValidateNumber(gDialog.TableRowsInput, null, 1, maxRows, null, true, true)); + newRowCount = Number(ValidateNumber(gDialog.TableRowsInput, null, 1, gMaxRows, null, true, true)); if (gValidationError) return false; - newColCount = Number(ValidateNumber(gDialog.TableColumnsInput, null, 1, maxColumns, null, true, true)); + newColCount = Number(ValidateNumber(gDialog.TableColumnsInput, null, 1, gMaxColumns, null, true, true)); if (gValidationError) return false; // If user is deleting any cells, get confirmation @@ -797,23 +794,23 @@ function ValidateTableData() } ValidateNumber(gDialog.TableWidthInput, gDialog.TableWidthUnits, - 1, maxPixels, globalTableElement, "width"); + 1, gMaxTableSize, globalTableElement, "width"); if (gValidationError) return false; if (gUseCSS) { ValidateNumber(gDialog.TableHeightInput, gDialog.TableHeightUnits, - 1, maxPixels, globalTableElement, "height"); + 1, gMaxTableSize, globalTableElement, "height"); if (gValidationError) return false; } - var border = ValidateNumber(gDialog.BorderWidthInput, null, 0, maxPixels, globalTableElement, "border"); + var border = ValidateNumber(gDialog.BorderWidthInput, null, 0, gMaxPixels, globalTableElement, "border"); // TODO: Deal with "BORDER" without value issue if (gValidationError) return false; - ValidateNumber(gDialog.SpacingInput, null, 0, maxPixels, globalTableElement, "cellspacing"); + ValidateNumber(gDialog.SpacingInput, null, 0, gMaxPixels, globalTableElement, "cellspacing"); if (gValidationError) return false; - ValidateNumber(gDialog.PaddingInput, null, 0, maxPixels, globalTableElement, "cellpadding"); + ValidateNumber(gDialog.PaddingInput, null, 0, gMaxPixels, globalTableElement, "cellpadding"); if (gValidationError) return false; SetAlign("TableAlignList", defHAlign, globalTableElement, "align"); @@ -830,14 +827,14 @@ function ValidateCellData() if (gDialog.CellHeightCheckbox.checked) { ValidateNumber(gDialog.CellHeightInput, gDialog.CellHeightUnits, - 1, maxPixels, globalCellElement, "height"); + 1, gMaxTableSize, globalCellElement, "height"); if (gValidationError) return false; } if (gDialog.CellWidthCheckbox.checked) { ValidateNumber(gDialog.CellWidthInput, gDialog.CellWidthUnits, - 1, maxPixels, globalCellElement, "width"); + 1, gMaxTableSize, globalCellElement, "width"); if (gValidationError) return false; }