[BUGFIX] Padding of RTE statusbar is too big
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 8 Sep 2011 15:19:48 +0000 (11:19 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Thu, 8 Sep 2011 15:23:39 +0000 (17:23 +0200)
onLayout produces incorrect results when executed on a hidden element.

Change-Id: Iffe239a05f43033ca7bb352d0f840e733b82bace
Resolves: #29485
Releases: 4.5, 4.6
Reviewed-on: http://review.typo3.org/4859
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js

index 2c733dc..5bd1f77 100644 (file)
@@ -834,17 +834,12 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         * In all browsers, it breaks the evaluation of the framework dimensions
         */
        initStyleChangeEventListener: function () {
-               if (this.isNested  && !Ext.isWebKit) {
+               if (this.isNested  && Ext.isGecko) {
                        var options = {
-                               stopEvent: true
+                               stopEvent: true,
+                               delay: 50
                        };
-                       if (Ext.isGecko) {
-                               options.delay = 50;
-                       }
                        Ext.each(this.nestedParentElements.sorted, function (nested) {
-                               if (!Ext.isGecko) {
-                                       options.target = Ext.get(nested);
-                               }
                                this.mon(
                                        Ext.get(nested),
                                        Ext.isIE ? 'propertychange' : 'DOMAttrModified',
@@ -1824,6 +1819,19 @@ HTMLArea.Framework = Ext.extend(Ext.Panel, {
                }
        },
        /*
+        * onLayout will fail if inside a hidden tab or inline element
+        */
+       onLayout: function () {
+               if (!this.isNested || HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)) {
+                       HTMLArea.Framework.superclass.onLayout.call(this);
+               } else {
+                               // Clone the array of nested tabs and inline levels instead of using a reference as HTMLArea.util.TYPO3.accessParentElements will modify the array
+                       var parentElements = [].concat(this.nestedParentElements.sorted);
+                               // Walk through all nested tabs and inline levels to get correct sizes
+                               HTMLArea.util.TYPO3.accessParentElements(parentElements, 'HTMLArea.Framework.superclass.onLayout.call(args[0])', [this]);
+               }
+       },
+       /*
         * Make the framework resizable, if configured
         */
        makeResizable: function () {
@@ -1882,18 +1890,14 @@ HTMLArea.Framework = Ext.extend(Ext.Panel, {
                        this.resizer.resizeTo(frameworkWidth, frameworkHeight);
                } else {
                        this.setSize(frameworkWidth, frameworkHeight);
+                       this.doLayout();
                }
        },
        /*
         * Resize the framework components
         */
        onFrameworkResize: function () {
-                       // For unknown reason, in Chrome 7, this following is the only way to set the height of the iframe
-               if (Ext.isChrome) {
-                       this.iframe.getResizeEl().dom.setAttribute('style', 'width:' + this.getInnerWidth() + 'px; height:' + this.getInnerHeight() + 'px;');
-               } else {
-                       this.iframe.setSize(this.getInnerWidth(), this.getInnerHeight());
-               }
+               this.iframe.setSize(this.getInnerWidth(), this.getInnerHeight());
                this.textArea.setSize(this.getInnerWidth(), this.getInnerHeight());
        },
        /*
@@ -1910,12 +1914,7 @@ HTMLArea.Framework = Ext.extend(Ext.Panel, {
                if (this.getInnerHeight() <= 0) {
                        this.onWindowResize();
                } else {
-                               // For unknown reason, in Chrome 7, this following is the only way to set the height of the iframe
-                       if (Ext.isChrome) {
-                               this.iframe.getResizeEl().dom.setAttribute('style', 'width:' + this.getInnerWidth() + 'px; height:' + this.getInnerHeight() + 'px;');
-                       } else {
-                               this.iframe.setHeight(this.getInnerHeight());
-                       }
+                       this.iframe.setHeight(this.getInnerHeight());
                        this.textArea.setHeight(this.getInnerHeight());
                }
        },