Element -> SVGElement (#3140)

* Use SVGElement instead of Element for the results of createSvgElement

* More SVGElement annotations.
This commit is contained in:
Rachel Fenichel
2019-10-02 16:12:31 -07:00
committed by Sam El-Husseini
parent eb5f1cc94a
commit 79bedca5a7
14 changed files with 31 additions and 31 deletions

View File

@@ -129,7 +129,7 @@ Blockly.blockAnimations.connectionUiEffect = function(block) {
/**
* Expand a ripple around a connection.
* @param {!Element} ripple Element to animate.
* @param {!SVGElement} ripple Element to animate.
* @param {!Date} start Date of animation's start.
* @param {number} scale Scale of workspace.
* @private
@@ -171,7 +171,7 @@ Blockly.blockAnimations.disconnectUiEffect = function(block) {
};
/**
* Animate a brief wiggle of a disconnected block.
* @param {!Element} group SVG element to animate.
* @param {!SVGElement} group SVG element to animate.
* @param {number} magnitude Maximum degrees skew (reversed for RTL).
* @param {!Date} start Date of animation's start.
* @private

View File

@@ -49,7 +49,7 @@ Blockly.BlockDragSurfaceSvg = function(container) {
/**
* The SVG drag surface. Set once by Blockly.BlockDragSurfaceSvg.createDom.
* @type {Element}
* @type {SVGElement}
* @private
*/
Blockly.BlockDragSurfaceSvg.prototype.SVG_ = null;
@@ -57,7 +57,7 @@ Blockly.BlockDragSurfaceSvg.prototype.SVG_ = null;
/**
* This is where blocks live while they are being dragged if the drag surface
* is enabled.
* @type {Element}
* @type {SVGElement}
* @private
*/
Blockly.BlockDragSurfaceSvg.prototype.dragGroup_ = null;
@@ -106,7 +106,7 @@ Blockly.BlockDragSurfaceSvg.prototype.createDom = function() {
/**
* Set the SVG blocks on the drag surface's group and show the surface.
* Only one block group should be on the drag surface at a time.
* @param {!Element} blocks Block or group of blocks to place on the drag
* @param {!SVGElement} blocks Block or group of blocks to place on the drag
* surface.
*/
Blockly.BlockDragSurfaceSvg.prototype.setBlocksAndShow = function(blocks) {
@@ -180,7 +180,7 @@ Blockly.BlockDragSurfaceSvg.prototype.getSurfaceTranslation = function() {
/**
* Provide a reference to the drag group (primarily for
* BlockSvg.getRelativeToSurfaceXY).
* @return {Element} Drag surface group element.
* @return {SVGElement} Drag surface group element.
*/
Blockly.BlockDragSurfaceSvg.prototype.getGroup = function() {
return this.dragGroup_;

View File

@@ -915,7 +915,7 @@ Blockly.BlockSvg.prototype.setInsertionMarker = function(insertionMarker) {
/**
* Return the root node of the SVG or null if none exists.
* @return {Element} The root SVG node (probably a group).
* @return {SVGElement} The root SVG node (probably a group).
*/
Blockly.BlockSvg.prototype.getSvgRoot = function() {
return this.svgGroup_;

View File

@@ -204,7 +204,7 @@ Blockly.Bubble.prototype.autoLayout_ = true;
* Create the bubble's DOM.
* @param {!Element} content SVG content for the bubble.
* @param {boolean} hasResize Add diagonal resize gripper if true.
* @return {!Element} The bubble's SVG group.
* @return {!SVGElement} The bubble's SVG group.
* @private
*/
Blockly.Bubble.prototype.createDom_ = function(content, hasResize) {
@@ -274,7 +274,7 @@ Blockly.Bubble.prototype.createDom_ = function(content, hasResize) {
/**
* Return the root node of the bubble's SVG group.
* @return {Element} The root SVG node of the bubble's group.
* @return {SVGElement} The root SVG node of the bubble's group.
*/
Blockly.Bubble.prototype.getSvgRoot = function() {
return this.bubbleGroup_;

View File

@@ -99,7 +99,7 @@ Blockly.Comment.prototype.drawIcon_ = function(group) {
/**
* Create the editor for the comment's bubble.
* @return {!Element} The top-level node of the editor.
* @return {!SVGElement} The top-level node of the editor.
* @private
*/
Blockly.Comment.prototype.createEditor_ = function() {

View File

@@ -66,7 +66,7 @@ Blockly.Field = function(value, opt_validator, opt_config) {
/**
* Used to cache the field's tooltip value if setTooltip is called when the
* field is not yet initialized. Is *not* guaranteed to be accurate.
* @type {string|Function|!Element}
* @type {string|Function|!SVGElement}
* @private
*/
this.tooltip_ = null;
@@ -538,10 +538,10 @@ Blockly.Field.prototype.callValidator = function(text) {
/**
* Gets the group element for this editable field.
* Used for measuring the size and for positioning.
* @return {!Element} The group element.
* @return {!SVGElement} The group element.
*/
Blockly.Field.prototype.getSvgRoot = function() {
return /** @type {!Element} */ (this.fieldGroup_);
return /** @type {!SVGElement} */ (this.fieldGroup_);
};
/**
@@ -847,7 +847,7 @@ Blockly.Field.prototype.onMouseDown_ = function(e) {
/**
* Change the tooltip text for this field.
* @param {string|Function|!Element} newTip Text for tooltip or a parent
* @param {string|Function|!SVGElement} newTip Text for tooltip or a parent
* element to link to for its tooltip.
*/
Blockly.Field.prototype.setTooltip = function(newTip) {

View File

@@ -236,7 +236,7 @@ Blockly.FieldAngle.prototype.showEditor_ = function() {
/**
* Create the angle dropdown editor.
* @return {!Element} The newly created angle picker.
* @return {!SVGElement} The newly created angle picker.
* @private
*/
Blockly.FieldAngle.prototype.dropdownCreate_ = function() {

View File

@@ -82,7 +82,7 @@ Blockly.Flyout = function(workspaceOptions) {
/**
* List of background mats that lurk behind each block to catch clicks
* landing in the blocks' lakes and bays.
* @type {!Array.<!Element>}
* @type {!Array.<!SVGElement>}
* @private
*/
this.mats_ = [];
@@ -211,7 +211,7 @@ Blockly.Flyout.prototype.dragAngleRange_ = 70;
* separate svg element.
* @param {string} tagName The type of tag to put the flyout in. This
* should be <svg> or <g>.
* @return {!Element} The flyout's SVG group.
* @return {!SVGElement} The flyout's SVG group.
*/
Blockly.Flyout.prototype.createDom = function(tagName) {
/*
@@ -569,10 +569,10 @@ Blockly.Flyout.prototype.clearOldBlocks_ = function() {
/**
* Add listeners to a block that has been added to the flyout.
* @param {!Element} root The root node of the SVG group the block is in.
* @param {!SVGElement} root The root node of the SVG group the block is in.
* @param {!Blockly.Block} block The block to add listeners for.
* @param {!Element} rect The invisible rectangle under the block that acts as
* a mat for that block.
* @param {!SVGElement} rect The invisible rectangle under the block that acts
* as a mat for that block.
* @protected
*/
Blockly.Flyout.prototype.addBlockListeners_ = function(root, block, rect) {

View File

@@ -115,7 +115,7 @@ Blockly.FlyoutButton.prototype.onMouseUpWrapper_ = null;
/**
* Create the button elements.
* @return {!Element} The button's SVG group.
* @return {!SVGElement} The button's SVG group.
*/
Blockly.FlyoutButton.prototype.createDom = function() {
var cssClass = this.isLabel_ ? 'blocklyFlyoutLabel' : 'blocklyFlyoutButton';

View File

@@ -118,7 +118,7 @@ Blockly.Mutator.prototype.iconClick_ = function(e) {
/**
* Create the editor for the mutator's bubble.
* @return {!Element} The top-level node of the editor.
* @return {!SVGElement} The top-level node of the editor.
* @private
*/
Blockly.Mutator.prototype.createEditor_ = function() {

View File

@@ -163,14 +163,14 @@ Blockly.Trashcan.prototype.minOpenness_ = 0;
/**
* The SVG group containing the trash can.
* @type {Element}
* @type {SVGElement}
* @private
*/
Blockly.Trashcan.prototype.svgGroup_ = null;
/**
* The SVG image element of the trash can lid.
* @type {Element}
* @type {SVGElement}
* @private
*/
Blockly.Trashcan.prototype.svgLid_ = null;
@@ -205,7 +205,7 @@ Blockly.Trashcan.prototype.top_ = 0;
/**
* Create the trash can elements.
* @return {!Element} The trash can's SVG group.
* @return {!SVGElement} The trash can's SVG group.
*/
Blockly.Trashcan.prototype.createDom = function() {
/* Here's the markup that will be generated:

View File

@@ -487,7 +487,7 @@ Blockly.WorkspaceCommentSvg.prototype.setDragging = function(adding) {
/**
* Return the root node of the SVG or null if none exists.
* @return {Element} The root SVG node (probably a group).
* @return {SVGElement} The root SVG node (probably a group).
* @package
*/
Blockly.WorkspaceCommentSvg.prototype.getSvgRoot = function() {

View File

@@ -45,7 +45,7 @@ Blockly.WorkspaceDragSurfaceSvg = function(container) {
/**
* The SVG drag surface. Set once by Blockly.WorkspaceDragSurfaceSvg.createDom.
* @type {Element}
* @type {SVGElement}
* @private
*/
Blockly.WorkspaceDragSurfaceSvg.prototype.SVG_ = null;
@@ -167,9 +167,9 @@ Blockly.WorkspaceDragSurfaceSvg.prototype.clearAndHide = function(newSurface) {
/**
* Set the SVG to have the block canvas and bubble canvas in it and then
* show the surface.
* @param {!Element} blockCanvas The block canvas <g> element from the
* @param {!SVGElement} blockCanvas The block canvas <g> element from the
* workspace.
* @param {!Element} bubbleCanvas The <g> element that contains the bubbles.
* @param {!SVGElement} bubbleCanvas The <g> element that contains the bubbles.
* @param {Element} previousSibling The element to insert the block canvas and
bubble canvas after when it goes back in the DOM at the end of a drag.
* @param {number} width The width of the workspace SVG element.

View File

@@ -68,7 +68,7 @@ Blockly.ZoomControls.prototype.MARGIN_SIDE_ = 20;
/**
* The SVG group containing the zoom controls.
* @type {Element}
* @type {SVGElement}
* @private
*/
Blockly.ZoomControls.prototype.svgGroup_ = null;
@@ -89,7 +89,7 @@ Blockly.ZoomControls.prototype.top_ = 0;
/**
* Create the zoom controls.
* @return {!Element} The zoom controls SVG group.
* @return {!SVGElement} The zoom controls SVG group.
*/
Blockly.ZoomControls.prototype.createDom = function() {
this.svgGroup_ =