Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ MESSAGE ( STATUS "external downloads will be stored/expected in: ${EXTERNALS_DOW
ExternalProject_Add(
ClosureCompiler
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL "http://dl.google.com/closure-compiler/compiler-20130823.tar.gz"
URL_MD5 105db24c4676e23f2495adfdea3159bc
URL "http://dl.google.com/closure-compiler/compiler-20150505.tar.gz"
URL_MD5 dea8e282c316316daeb39fcd5708d369
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand Down
4 changes: 2 additions & 2 deletions programs/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ add_custom_command(
--transform_amd_modules
--process_common_js_modules
--common_js_entry_module HTMLBenchmark.js
--common_js_module_path_prefix ${CMAKE_CURRENT_SOURCE_DIR}/js
--common_js_module_path_prefix ${CMAKE_CURRENT_SOURCE_DIR}/js/
--compilation_level SIMPLE_OPTIMIZATIONS
--formatting PRETTY_PRINT
--js_output_file "benchmark.js-"
Expand All @@ -35,4 +35,4 @@ add_custom_command(
DEPENDS ClosureCompiler webodf.js-target
)

add_custom_target(html-benchmark DEPENDS benchmark.js-target ${BENCHMARK_HTML})
add_custom_target(html-benchmark DEPENDS benchmark.js-target ${BENCHMARK_HTML})
2 changes: 1 addition & 1 deletion programs/benchmark/js/HTMLBenchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ define([

/**
* Extract supported benchmark options from the url query parameters
* @return {!{fileUrl: !string, includeSlow: !boolean, colour: string|undefined}}
* @return {!{fileUrl: !string, includeSlow: !boolean, colour: (string|undefined)}}
*/
function getConfiguration() {
var params = getQueryParams();
Expand Down
72 changes: 68 additions & 4 deletions webodf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ include(${CMAKE_BINARY_DIR}/jsfileslist.txt)

configure_file(webodfversion.js.in ${CMAKE_CURRENT_BINARY_DIR}/webodfversion.js)

set(EXTERNS_LIST
"--use_only_custom_externs"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/es3.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/es5.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/es6.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_dom1.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_dom2.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_dom3.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_elementtraversal.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_anim_timing.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_range.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_xml.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_css.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/w3c_event.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/window.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/gecko_xml.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/gecko_dom.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/ie_dom.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/gecko_event.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/ie_event.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/html5.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/iphone.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs/fileapi.js"
"--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js"
)
string(REPLACE ";" " " EXTERNS "${EXTERNS_LIST}")

set(TESTJSFILES
tests/core/UnitTester.js
tests/core/ZipTests.js
Expand Down Expand Up @@ -73,7 +100,47 @@ add_custom_target(webodf.css.js-target DEPENDS webodf.css.js)

# Windows has a command-line limit of around 8,000 chars, so files to be compiled are supplied to CC using the --flagfile
# option to help keep the length of the compilation command as small as possible.
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/cc-noTestFiles.txt "--warning_level VERBOSE --jscomp_error accessControls --jscomp_error ambiguousFunctionDecl --jscomp_error checkEventfulObjectDisposal --jscomp_error checkRegExp --jscomp_error checkStructDictInheritance --jscomp_error checkTypes --jscomp_error checkVars --jscomp_error const --jscomp_error constantProperty --jscomp_error deprecated --jscomp_error duplicateMessage --jscomp_error es3 --jscomp_error es5Strict --jscomp_error externsValidation --jscomp_error fileoverviewTags --jscomp_error globalThis --jscomp_error invalidCasts --jscomp_error misplacedTypeAnnotation --jscomp_error missingProperties --jscomp_error missingProvide --jscomp_error missingRequire --jscomp_error missingReturn --jscomp_off nonStandardJsDocs --jscomp_error suspiciousCode --jscomp_error strictModuleDepCheck --jscomp_error typeInvalidation --jscomp_error undefinedNames --jscomp_error undefinedVars --jscomp_error unknownDefines --jscomp_error uselessCode --jscomp_error visibility --summary_detail_level 3")
SET(CLOSURE_ERROR_OPTION_LIST
"--jscomp_error accessControls"
"--jscomp_error ambiguousFunctionDecl"
"--jscomp_error checkEventfulObjectDisposal"
"--jscomp_error checkRegExp"
"--jscomp_error checkStructDictInheritance"
"--jscomp_error checkTypes"
"--jscomp_error checkVars"
# "--jscomp error conformanceViolations"
"--jscomp_error const"
"--jscomp_error constantProperty"
"--jscomp_error deprecated"
"--jscomp_error deprecatedAnnotations"
"--jscomp_error duplicateMessage"
"--jscomp_error es3"
"--jscomp_error es5Strict"
"--jscomp_error externsValidation"
"--jscomp_error fileoverviewTags"
"--jscomp_error globalThis"
"--jscomp_error inferredConstCheck"
"--jscomp_error invalidCasts"
"--jscomp_error misplacedTypeAnnotation"
"--jscomp_error missingGetCssName"
"--jscomp_error missingProperties"
"--jscomp_error missingProvide"
"--jscomp_off missingRequire"
"--jscomp_error missingReturn"
# "--jscomp_error newCheckTypes"
"--jscomp_off nonStandardJsDocs"
"--jscomp_error suspiciousCode"
"--jscomp_error strictModuleDepCheck"
"--jscomp_error typeInvalidation"
"--jscomp_error undefinedNames"
"--jscomp_error undefinedVars"
"--jscomp_error unknownDefines"
"--jscomp_error uselessCode"
"--jscomp_error useOfGoogBase"
"--jscomp_error visibility")
string(REPLACE ";" " " CLOSURE_ERROR_OPTIONS "${CLOSURE_ERROR_OPTION_LIST}")

file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/cc-noTestFiles.txt "--warning_level VERBOSE ${CLOSURE_ERROR_OPTIONS} --summary_detail_level 3 ${EXTERNS}")

file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/cc-noTestFiles.txt " --js ${HEADERCOMPILED_FILE}")

Expand Down Expand Up @@ -133,7 +200,6 @@ add_custom_command(
--define IS_COMPILED_CODE=true
--compilation_level ADVANCED_OPTIMIZATIONS
--formatting PRETTY_PRINT
--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js
--js_output_file compiled.js-
COMMAND ${CMAKE_COMMAND} ARGS -E rename compiled.js- compiled.js
DEPENDS ClosureCompiler ${LIBJSFILES} ${TESTJSFILES} tools/externs.js
Expand All @@ -149,7 +215,6 @@ add_custom_command(
--jscomp_error reportUnknownTypes
--define IS_COMPILED_CODE=true
--compilation_level SIMPLE_OPTIMIZATIONS
--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js
--js_output_file webodf.js-
COMMAND ${CMAKE_COMMAND} ARGS -E rename webodf.js- webodf.js
DEPENDS ClosureCompiler ${LIBJSFILES} tools/externs.js
Expand All @@ -166,7 +231,6 @@ add_custom_command(
--define IS_COMPILED_CODE=true
--compilation_level WHITESPACE_ONLY
--formatting PRETTY_PRINT
--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js
--js_output_file webodf-debug.js-
# in WHITESPACE_ONLY mode, it is not possible to define IS_COMPILED_CODE
# so the value for IS_COMPILED_CODE is set by find and replace in the code
Expand Down
4 changes: 2 additions & 2 deletions webodf/lib/core/NodeFilterChain.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/**
* @constructor
* @extends NodeFilter
* @implements NodeFilter
* @param {!Array.<!NodeFilter>} filters
*/
core.NodeFilterChain = function (filters) {
Expand All @@ -47,4 +47,4 @@ core.NodeFilterChain = function (filters) {
}
return FILTER_ACCEPT;
};
};
};
4 changes: 2 additions & 2 deletions webodf/lib/core/PositionIterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ core.PositionIterator = function PositionIterator(root, whatToShow, filter,
* Empty text nodes are not considered to be a valid position for the
* positioniterator. They should be filtered out in all cases.
* @constructor
* @extends NodeFilter
* @implements NodeFilter
*/
function EmptyTextNodeFilter() {
/**
Expand All @@ -104,7 +104,7 @@ core.PositionIterator = function PositionIterator(root, whatToShow, filter,
}
/**
* @constructor
* @extends NodeFilter
* @implements NodeFilter
* @param {!NodeFilter} filter
*/
function FilteredEmptyTextNodeFilter(filter) {
Expand Down
4 changes: 2 additions & 2 deletions webodf/lib/gui/BlacklistNamespaceNodeFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/**
* @constructor
* @extends NodeFilter
* @implements NodeFilter
* @param {!Array.<!string>} excludedNamespaces
*/
gui.BlacklistNamespaceNodeFilter = function (excludedNamespaces) {
Expand All @@ -53,4 +53,4 @@ gui.BlacklistNamespaceNodeFilter = function (excludedNamespaces) {
});
}
init();
};
};
20 changes: 14 additions & 6 deletions webodf/lib/gui/DirectFormattingController.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,14 @@ gui.DirectFormattingController = function DirectFormattingController(
function emptyFunction() {
}
/*jslint emptyblock: false*/

/**
* @return {!boolean}
*/
function emptyBoolFunction () {
return false;
}

/**
* @return {!boolean}
*/
Expand Down Expand Up @@ -897,13 +905,13 @@ gui.DirectFormattingController = function DirectFormattingController(
}

if (!directParagraphStylingEnabled) {
self.alignParagraphCenter = emptyFunction;
self.alignParagraphJustified = emptyFunction;
self.alignParagraphLeft = emptyFunction;
self.alignParagraphRight = emptyFunction;
self.alignParagraphCenter = emptyBoolFunction;
self.alignParagraphJustified = emptyBoolFunction;
self.alignParagraphLeft = emptyBoolFunction;
self.alignParagraphRight = emptyBoolFunction;
self.createParagraphStyleOps = function () { return []; };
self.indent = emptyFunction;
self.outdent = emptyFunction;
self.indent = emptyBoolFunction;
self.outdent = emptyBoolFunction;
}
}

Expand Down
4 changes: 2 additions & 2 deletions webodf/lib/gui/OdfTextBodyNodeFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* - Any node within a text:tracked-changes block
*
* @constructor
* @extends NodeFilter
* @implements NodeFilter
*/
gui.OdfTextBodyNodeFilter = function () {
"use strict";
Expand All @@ -54,4 +54,4 @@ gui.OdfTextBodyNodeFilter = function () {
}
return FILTER_ACCEPT;
};
};
};
21 changes: 11 additions & 10 deletions webodf/lib/gui/SessionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ gui.SessionControllerOptions = function () {

/**
* Return the number of mouse clicks if the mouse event is for the primary button. Otherwise return 0.
* @param {!Event} event
* @param {!UIEvent} event
* @return {!number}
*/
function computeClickCount(event) {
Expand All @@ -450,7 +450,7 @@ gui.SessionControllerOptions = function () {
* This is necessary because the mouse-up binding needs to be global in order to handle mouse-up
* events that occur when the user releases the mouse button outside the canvas.
* This filter limits selection changes to mouse down events that start inside the canvas
* @param {!Event} e
* @param {!UIEvent} e
*/
function handleMouseDown(e) {
var target = getTarget(e),
Expand Down Expand Up @@ -515,7 +515,7 @@ gui.SessionControllerOptions = function () {
/**
* Causes a cursor movement to the position hinted by a mouse click
* event.
* @param {!Event} event
* @param {!UIEvent} event
* @return {undefined}
*/
function moveByMouseClickEvent(event) {
Expand Down Expand Up @@ -617,7 +617,7 @@ gui.SessionControllerOptions = function () {
}

/**
* @param {!Event} event
* @param {!UIEvent} event
* @return {undefined}
*/
function handleMouseClickEvent(event) {
Expand Down Expand Up @@ -678,7 +678,7 @@ gui.SessionControllerOptions = function () {
// TODO: IE10 on a test machine does not have the "detail" property set on "mouseup" events here,
// even if the docs claim it should exist, cmp. http://msdn.microsoft.com/en-au/library/ie/ff974344(v=vs.85).aspx
// So doubleclicks will not be detected on (some?) IE currently.
clickEvent = domUtils.cloneEvent(event);
clickEvent = /**@type{!UIEvent}*/(domUtils.cloneEvent(event));
handleMouseClickTimeoutId = runtime.setTimeout(function () {
moveByMouseClickEvent(clickEvent);
}, 0);
Expand Down Expand Up @@ -718,7 +718,7 @@ gui.SessionControllerOptions = function () {
}

/**
* @param {!Event} e
* @param {!UIEvent} e
*/
function handleContextMenu(e) {
// TODO Various browsers have different default behaviours on right click
Expand All @@ -731,7 +731,7 @@ gui.SessionControllerOptions = function () {
}

/**
* @param {!Event} event
* @param {!UIEvent} event
*/
function handleMouseUp(event) {
var target = /**@type{!Element}*/(getTarget(event)),
Expand Down Expand Up @@ -790,15 +790,16 @@ gui.SessionControllerOptions = function () {
function rangeSelectionOnly(fn) {
/**
* @param {*} e
* return {function(*):(boolean|undefined)
* @return {!boolean|undefined}
*/
return function (e) {
function f(e) {
var selectionType = odtDocument.getCursor(inputMemberId).getSelectionType();
if (selectionType === ops.OdtCursor.RangeSelection) {
return fn(e);
}
return true;
};
}
return f;
}

/**
Expand Down
20 changes: 20 additions & 0 deletions webodf/lib/odf/Namespaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,40 @@ odf.Namespaces = {
dr3dns: "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",
drawns: "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",
chartns: "urn:oasis:names:tc:opendocument:xmlns:chart:1.0",
/**
* @const
* @type{string}
*/
fons: "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
formns: "urn:oasis:names:tc:opendocument:xmlns:form:1.0",
mathns: "http://www.w3.org/1998/Math/MathML",
metans: "urn:oasis:names:tc:opendocument:xmlns:meta:1.0",
/**
* @const
* @type{string}
*/
numberns: "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",
/**
* @const
* @type{string}
*/
officens: "urn:oasis:names:tc:opendocument:xmlns:office:1.0",
presentationns: "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",
/**
* @const
* @type{string}
*/
stylens: "urn:oasis:names:tc:opendocument:xmlns:style:1.0",
/**
* @const
* @type{string}
*/
svgns: "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",
tablens: "urn:oasis:names:tc:opendocument:xmlns:table:1.0",
/**
* @const
* @type{string}
*/
textns: "urn:oasis:names:tc:opendocument:xmlns:text:1.0",
xformsns: "http://www.w3.org/2002/xforms",
xlinkns: 'http://www.w3.org/1999/xlink',
Expand Down
1 change: 1 addition & 0 deletions webodf/lib/odf/TextStyleApplicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ odf.TextStyleApplicator = function TextStyleApplicator(objectNameGenerator, form
function moveToNewSpan(startNode, range) {
var document = startNode.ownerDocument,
originalContainer = /**@type{!Element}*/(startNode.parentNode),
/**@type{!Element}*/
styledContainer,
trailingContainer,
moveTrailing,
Expand Down
Loading