Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: trunk/src/chrome/renderer/resources/extensions/web_view.js

Issue 23833005: Revert 221023 "Reland after fix: Improve <webview> autosize:" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/renderer/resources/extensions/web_view.js
===================================================================
--- trunk/src/chrome/renderer/resources/extensions/web_view.js (revision 221163)
+++ trunk/src/chrome/renderer/resources/extensions/web_view.js (working copy)
@@ -24,21 +24,9 @@
// API can access it and not external developers.
var secret = {};
-var WEB_VIEW_ATTRIBUTE_MAXHEIGHT = 'maxheight';
-var WEB_VIEW_ATTRIBUTE_MAXWIDTH = 'maxwidth';
-var WEB_VIEW_ATTRIBUTE_MINHEIGHT = 'minheight';
-var WEB_VIEW_ATTRIBUTE_MINWIDTH = 'minwidth';
-
/** @type {Array.<string>} */
-var WEB_VIEW_ATTRIBUTES = [
- 'name',
- 'partition',
- 'autosize',
- WEB_VIEW_ATTRIBUTE_MINHEIGHT,
- WEB_VIEW_ATTRIBUTE_MINWIDTH,
- WEB_VIEW_ATTRIBUTE_MAXHEIGHT,
- WEB_VIEW_ATTRIBUTE_MAXWIDTH
-];
+var WEB_VIEW_ATTRIBUTES = ['name', 'partition', 'autosize', 'minheight',
+ 'minwidth', 'maxheight', 'maxwidth'];
var webViewInstanceIdCounter = 0;
@@ -125,9 +113,6 @@
},
'sizechanged': {
evt: CreateEvent('webview.onSizeChanged'),
- customHandler: function(webViewInternal, event, webViewEvent) {
- webViewInternal.handleSizeChangedEvent_(event, webViewEvent);
- },
fields: ['oldHeight', 'oldWidth', 'newHeight', 'newWidth']
},
'unresponsive': {
@@ -490,62 +475,6 @@
return WEB_VIEW_EVENTS;
};
-WebViewInternal.prototype.handleSizeChangedEvent_ =
- function(event, webViewEvent) {
- var node = this.webviewNode_;
-
- var width = node.offsetWidth;
- var height = node.offsetHeight;
-
- // Check the current bounds to make sure we do not resize <webview>
- // outside of current constraints.
- var maxWidth;
- if (node.hasAttribute(WEB_VIEW_ATTRIBUTE_MAXWIDTH) &&
- node[WEB_VIEW_ATTRIBUTE_MAXWIDTH]) {
- maxWidth = node[WEB_VIEW_ATTRIBUTE_MAXWIDTH];
- } else {
- maxWidth = width;
- }
-
- var minWidth;
- if (node.hasAttribute(WEB_VIEW_ATTRIBUTE_MINWIDTH) &&
- node[WEB_VIEW_ATTRIBUTE_MINWIDTH]) {
- minWidth = node[WEB_VIEW_ATTRIBUTE_MINWIDTH];
- } else {
- minWidth = width;
- }
- if (minWidth > maxWidth) {
- minWidth = maxWidth;
- }
-
- var maxHeight;
- if (node.hasAttribute(WEB_VIEW_ATTRIBUTE_MAXHEIGHT) &&
- node[WEB_VIEW_ATTRIBUTE_MAXHEIGHT]) {
- maxHeight = node[WEB_VIEW_ATTRIBUTE_MAXHEIGHT];
- } else {
- maxHeight = height;
- }
- var minHeight;
- if (node.hasAttribute(WEB_VIEW_ATTRIBUTE_MINHEIGHT) &&
- node[WEB_VIEW_ATTRIBUTE_MINHEIGHT]) {
- minHeight = node[WEB_VIEW_ATTRIBUTE_MINHEIGHT];
- } else {
- minHeight = height;
- }
- if (minHeight > maxHeight) {
- minHeight = maxHeight;
- }
-
- if (webViewEvent.newWidth >= minWidth &&
- webViewEvent.newWidth <= maxWidth &&
- webViewEvent.newHeight >= minHeight &&
- webViewEvent.newHeight <= maxHeight) {
- node.style.width = webViewEvent.newWidth + 'px';
- node.style.height = webViewEvent.newHeight + 'px';
- }
- node.dispatchEvent(webViewEvent);
-};
-
/**
* @private
*/

Powered by Google App Engine
This is Rietveld 408576698