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

Unified Diff: chrome/browser/resources/net_internals/resizableverticalsplitview.js

Issue 7531005: Rename the net_internals file names to include hyphens. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add some missing files Created 9 years, 5 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: chrome/browser/resources/net_internals/resizableverticalsplitview.js
===================================================================
--- chrome/browser/resources/net_internals/resizableverticalsplitview.js (revision 94551)
+++ chrome/browser/resources/net_internals/resizableverticalsplitview.js (working copy)
@@ -1,137 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * This view implements a vertically split display with a draggable divider.
- *
- * <<-- sizer -->>
- *
- * +----------------------++----------------+
- * | || |
- * | || |
- * | || |
- * | || |
- * | leftView || rightView |
- * | || |
- * | || |
- * | || |
- * | || |
- * | || |
- * +----------------------++----------------+
- *
- * @param {!View} leftView The widget to position on the left.
- * @param {!View} rightView The widget to position on the right.
- * @param {!DivView} sizerView The widget that will serve as draggable divider.
- * @constructor
- */
-function ResizableVerticalSplitView(leftView, rightView, sizerView) {
- View.call(this);
-
- this.leftView_ = leftView;
- this.rightView_ = rightView;
- this.sizerView_ = sizerView;
-
- // Setup the "sizer" so it can be dragged left/right to reposition the
- // vertical split.
- sizerView.getNode().addEventListener(
- 'mousedown', this.onDragSizerStart_.bind(this), true);
-}
-
-inherits(ResizableVerticalSplitView, View);
-
-// Minimum width to size panels to, in pixels.
-ResizableVerticalSplitView.MIN_PANEL_WIDTH = 50;
-
-/**
- * Sets the width of the left view.
- * @param {Integer} px The number of pixels
- */
-ResizableVerticalSplitView.prototype.setLeftSplit = function(px) {
- this.leftSplit_ = px;
-};
-
-/**
- * Repositions all of the elements to fit the window.
- */
-ResizableVerticalSplitView.prototype.setGeometry = function(
- left, top, width, height) {
- ResizableVerticalSplitView.superClass_.setGeometry.call(
- this, left, top, width, height);
-
- // If this is the first setGeometry(), initialize the split point at 50%.
- if (!this.leftSplit_)
- this.leftSplit_ = parseInt((width / 2).toFixed(0));
-
- // Calculate the horizontal split points.
- var leftboxWidth = this.leftSplit_;
- var sizerWidth = this.sizerView_.getWidth();
- var rightboxWidth = width - (leftboxWidth + sizerWidth);
-
- // Don't let the right pane get too small.
- if (rightboxWidth < ResizableVerticalSplitView.MIN_PANEL_WIDTH) {
- rightboxWidth = ResizableVerticalSplitView.MIN_PANEL_WIDTH;
- leftboxWidth = width - (sizerWidth + rightboxWidth);
- }
-
- // Position the boxes using calculated split points.
- this.leftView_.setGeometry(left, top, leftboxWidth, height);
- this.sizerView_.setGeometry(this.leftView_.getRight(), top,
- sizerWidth, height);
- this.rightView_.setGeometry(this.sizerView_.getRight(), top,
- rightboxWidth, height);
-};
-
-ResizableVerticalSplitView.prototype.show = function(isVisible) {
- ResizableVerticalSplitView.superClass_.show.call(this, isVisible);
- this.leftView_.show(isVisible);
- this.sizerView_.show(isVisible);
- this.rightView_.show(isVisible);
-};
-
-/**
- * Called once we have clicked into the sizer. Starts capturing the mouse
- * position to implement dragging.
- */
-ResizableVerticalSplitView.prototype.onDragSizerStart_ = function(event) {
- this.sizerMouseMoveListener_ = this.onDragSizer.bind(this);
- this.sizerMouseUpListener_ = this.onDragSizerEnd.bind(this);
-
- window.addEventListener('mousemove', this.sizerMouseMoveListener_, true);
- window.addEventListener('mouseup', this.sizerMouseUpListener_, true);
-
- event.preventDefault();
-};
-
-/**
- * Called when the mouse has moved after dragging started.
- */
-ResizableVerticalSplitView.prototype.onDragSizer = function(event) {
- // Convert from page coordinates, to view coordinates.
- this.leftSplit_ = (event.pageX - this.getLeft());
-
- // Avoid shrinking the left box too much.
- this.leftSplit_ = Math.max(
- this.leftSplit_, ResizableVerticalSplitView.MIN_PANEL_WIDTH);
- // Avoid shrinking the right box too much.
- this.leftSplit_ = Math.min(
- this.leftSplit_,
- this.getWidth() - ResizableVerticalSplitView.MIN_PANEL_WIDTH);
-
- // Force a layout with the new |leftSplit_|.
- this.setGeometry(
- this.getLeft(), this.getTop(), this.getWidth(), this.getHeight());
-};
-
-/**
- * Called once the mouse has been released, and the dragging is over.
- */
-ResizableVerticalSplitView.prototype.onDragSizerEnd = function(event) {
- window.removeEventListener('mousemove', this.sizerMouseMoveListener_, true);
- window.removeEventListener('mouseup', this.sizerMouseUpListener_, true);
-
- this.sizerMouseMoveListener_ = null;
- this.sizerMouseUpListener_ = null;
-
- event.preventDefault();
-};

Powered by Google App Engine
This is Rietveld 408576698