X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fdevtools%2Ffront_end%2FView.js;h=84168b5075a5356237bf762b73a503fde2729f09;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=0b45201267a0263db67040b2f3aebada1a6309ed;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/devtools/front_end/View.js b/src/third_party/WebKit/Source/devtools/front_end/View.js index 0b45201..84168b5 100644 --- a/src/third_party/WebKit/Source/devtools/front_end/View.js +++ b/src/third_party/WebKit/Source/devtools/front_end/View.js @@ -53,6 +53,11 @@ WebInspector.View.prototype = { this._isRoot = true; }, + makeLayoutBoundary: function() + { + this._isLayoutBoundary = true; + }, + /** * @return {?WebInspector.View} */ @@ -145,6 +150,41 @@ WebInspector.View.prototype = { this._callOnVisibleChildren(this._processOnResize); }, + _processDiscardCachedSize: function() + { + if (this._isLayoutBoundary) { + this.element.style.removeProperty("width"); + this.element.style.removeProperty("height"); + } + this._callOnVisibleChildren(this._processDiscardCachedSize); + }, + + _cacheSize: function() + { + this._prepareCacheSize(); + this._applyCacheSize(); + }, + + _prepareCacheSize: function() + { + if (this._isLayoutBoundary) { + this._cachedOffsetWidth = this.element.offsetWidth; + this._cachedOffsetHeight = this.element.offsetHeight; + } + this._callOnVisibleChildren(this._prepareCacheSize); + }, + + _applyCacheSize: function() + { + if (this._isLayoutBoundary) { + this.element.style.setProperty("width", this._cachedOffsetWidth + "px"); + this.element.style.setProperty("height", this._cachedOffsetHeight + "px"); + delete this._cachedOffsetWidth; + delete this._cachedOffsetHeight; + } + this._callOnVisibleChildren(this._applyCacheSize); + }, + /** * @param {function(this:WebInspector.View)} notification */ @@ -213,8 +253,10 @@ WebInspector.View.prototype = { WebInspector.View._originalAppendChild.call(parentElement, this.element); } - if (this._parentIsShowing()) + if (this._parentIsShowing()) { this._processWasShown(); + this._cacheSize(); + } }, /** @@ -226,8 +268,10 @@ WebInspector.View.prototype = { if (!parentElement) return; - if (this._parentIsShowing()) + if (this._parentIsShowing()) { + this._processDiscardCachedSize(); this._processWillHide(); + } if (this._hideOnDetach && !overrideHideOnDetach) { this.element.classList.remove("visible"); @@ -310,7 +354,13 @@ WebInspector.View.prototype = { doResize: function() { - this._processOnResize(); + if (!this.isShowing()) + return; + this._processDiscardCachedSize(); + // No matter what notification we are in, dispatching onResize is not needed. + if (!this._inNotification()) + this._callOnVisibleChildren(this._processOnResize); + this._cacheSize(); }, registerRequiredCSS: function(cssFile) @@ -514,13 +564,13 @@ WebInspector.ViewWithResizeCallback.prototype = { Element.prototype.appendChild = function(child) { - WebInspector.View._assert(!child.__view, "Attempt to add view via regular DOM operation."); + WebInspector.View._assert(!child.__view || child.parentElement === this, "Attempt to add view via regular DOM operation."); return WebInspector.View._originalAppendChild.call(this, child); } Element.prototype.insertBefore = function(child, anchor) { - WebInspector.View._assert(!child.__view, "Attempt to add view via regular DOM operation."); + WebInspector.View._assert(!child.__view || child.parentElement === this, "Attempt to add view via regular DOM operation."); return WebInspector.View._originalInsertBefore.call(this, child, anchor); }