From f5eb2ac1467658a58e53da1d088e5ed2ccc3d242 Mon Sep 17 00:00:00 2001 From: Jason San Jose Date: Thu, 5 Apr 2012 14:19:32 -0700 Subject: [PATCH] Code review comments --- src/editor/CSSInlineEditor.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/editor/CSSInlineEditor.js b/src/editor/CSSInlineEditor.js index 201f96ba0f8..6f8417bf9a1 100644 --- a/src/editor/CSSInlineEditor.js +++ b/src/editor/CSSInlineEditor.js @@ -243,9 +243,10 @@ define(function (require, exports, module) { rcTop = this.$relatedContainer.offset().top, rcHeight = this.$relatedContainer.outerHeight(), rcBottom = rcTop + rcHeight, - scrollerTop = $(hostScroller).offset().top, + scrollerOffset = $(hostScroller).offset(), + scrollerTop = scrollerOffset.top, scrollerBottom = scrollerTop + hostScroller.clientHeight, - scrollerLeft = $(hostScroller).offset().left, + scrollerLeft = scrollerOffset.left, rightOffset = $(document.body).outerWidth() - (scrollerLeft + hostScroller.clientWidth); if (rcTop < scrollerTop || rcBottom > scrollerBottom) { this.$relatedContainer.css("clip", "rect(" + Math.max(scrollerTop - rcTop, 0) + "px, auto, " + @@ -261,15 +262,9 @@ define(function (require, exports, module) { this._relatedContainerDefaultWidth = relatedContainerWidth; } - var halfWidth = hostScroller.clientWidth / 2; - - if (this._relatedContainerDefaultWidth >= halfWidth) { - relatedContainerWidth = halfWidth; - } else { - relatedContainerWidth = this._relatedContainerDefaultWidth; - } - - this.$relatedContainer.width(Math.floor(relatedContainerWidth)); + var halfWidth = Math.floor(hostScroller.clientWidth / 2); + relatedContainerWidth = Math.min(this._relatedContainerDefaultWidth, halfWidth); + this.$relatedContainer.width(relatedContainerWidth); } // Position immediately to the left of the main editor's scrollbar.