From 07bd3b3c799fd99aa02ce3c08462bd312925c501 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 15 Jul 2021 08:42:28 -0700 Subject: [PATCH] clang-format core/utils/dom.js --- core/utils/dom.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/core/utils/dom.js b/core/utils/dom.js index 192aba58e..0e0480c0f 100644 --- a/core/utils/dom.js +++ b/core/utils/dom.js @@ -209,8 +209,9 @@ const insertAfter = function(newNode, refNode) { * @return {boolean} Whether the parent node contains the descendant node. */ const containsNode = function(parent, descendant) { - return !!(parent.compareDocumentPosition(descendant) & - NodeType.DOCUMENT_POSITION_CONTAINED_BY); + return !!( + parent.compareDocumentPosition(descendant) & + NodeType.DOCUMENT_POSITION_CONTAINED_BY); }; /** @@ -296,10 +297,10 @@ const getTextWidth = function(textElement) { * @param {string} fontFamily The font family to use. * @return {number} Width of element. */ -const getFastTextWidth = function(textElement, - fontSize, fontWeight, fontFamily) { - return getFastTextWidthWithSizeString(textElement, - fontSize + 'pt', fontWeight, fontFamily); +const getFastTextWidth = function( + textElement, fontSize, fontWeight, fontFamily) { + return getFastTextWidthWithSizeString( + textElement, fontSize + 'pt', fontWeight, fontFamily); }; /** @@ -314,8 +315,8 @@ const getFastTextWidth = function(textElement, * @param {string} fontFamily The font family to use. * @return {number} Width of element. */ -const getFastTextWidthWithSizeString = function(textElement, - fontSize, fontWeight, fontFamily) { +const getFastTextWidthWithSizeString = function( + textElement, fontSize, fontWeight, fontFamily) { const text = textElement.textContent; const key = text + '\n' + textElement.className.baseVal; let width; @@ -340,8 +341,7 @@ const getFastTextWidthWithSizeString = function(textElement, canvasContext = computeCanvas.getContext('2d'); } // Set the desired font size and family. - canvasContext.font = - fontWeight + ' ' + fontSize + ' ' + fontFamily; + canvasContext.font = fontWeight + ' ' + fontSize + ' ' + fontFamily; // Measure the text width using the helper canvas context. width = canvasContext.measureText(text).width; @@ -361,9 +361,7 @@ const getFastTextWidthWithSizeString = function(textElement, * @param {string} fontFamily The font family to use. * @return {{height: number, baseline: number}} Font measurements. */ -const measureFontMetrics = function(text, fontSize, fontWeight, - fontFamily) { - +const measureFontMetrics = function(text, fontSize, fontWeight, fontFamily) { const span = document.createElement('span'); span.style.font = fontWeight + ' ' + fontSize + ' ' + fontFamily; span.textContent = text;