You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/12/30 00:35:52 UTC

[royale-asjs] 09/13: special case some html

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 0898e23b6f0b5712efee62e245b751589d2ff190
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Dec 27 23:59:02 2019 -0800

    special case some html
---
 .../MXRoyale/src/main/royale/mx/core/UITextFormat.as       | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UITextFormat.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UITextFormat.as
index 2dc5b17..1ce581a 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UITextFormat.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UITextFormat.as
@@ -570,10 +570,18 @@ public class UITextFormat extends TextFormat
         if (sm.measuringElement == null)
         {
             sm.measuringElement = document.createElement("span") as HTMLSpanElement;
-            sm.measuringElement.style.position = "float"; // to try to keep it from affecting position of other elements
-            sm.measuringElement.style.display = "none"; // to try to keep it hidden
+            //everything else is absolute position so should be above this element
+            //sm.measuringElement.style.position = "float"; // to try to keep it from affecting position of other elements
+            // offsetWidth/Height not computed for display: none
+            //sm.measuringElement.style.display = "none"; // to try to keep it hidden
+            sm.measuringElement.style.opacity = 0;
+            sm.measuringElement.style["pointer-events"] = "none";
+            sm.element.appendChild(sm.measuringElement);
         }
-        sm.measuringElement.text = s;
+        if (s.indexOf("&nbsp;") >= 0)
+            sm.measuringElement.innerHTML = s;
+        else
+            sm.measuringElement.textContent = s;
         var tlm:TextLineMetrics = new TextLineMetrics();
         tlm.width = sm.measuringElement.offsetWidth;
         tlm.height = sm.measuringElement.offsetHeight;