Commit abfeb013 authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

split view: Simplify overly complicated code (mostly for snapped bounds)

Change-Id: I5f7ee685fd794ec55685c55164a12eda6debf0c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879557Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709174}
parent e3f10ed9
This diff is collapsed.
......@@ -134,16 +134,14 @@ class ASH_EXPORT SplitViewController : public aura::WindowObserver,
aura::Window* GetDefaultSnappedWindow();
// Gets the window bounds according to the snap state |snap_state| and the
// divider position |divider_position_|. The returned snapped window bounds
// are adjusted to its minimum size if the desired bounds are smaller than
// its minumum bounds. Note: the snapped window bounds can't be pushed
// outside of the workspace area.
gfx::Rect GetSnappedWindowBoundsInParent(SnapPosition snap_position);
gfx::Rect GetSnappedWindowBoundsInScreen(SnapPosition snap_position);
// Gets the desired snapped window bounds accoridng to the snap state
// |snap_state| and the divider pistion |divider_position_|.
gfx::Rect GetSnappedWindowBoundsInScreenUnadjusted(SnapPosition snap_postion);
// divider position |divider_position_|. If |adjust_for_minimum_size| is true,
// the returned snapped window bounds are adjusted to its minimum size if the
// desired bounds are smaller than its minumum bounds. Note: the snapped
// window bounds can't be pushed outside of the workspace area.
gfx::Rect GetSnappedWindowBoundsInParent(SnapPosition snap_position,
bool adjust_for_minimum_size = true);
gfx::Rect GetSnappedWindowBoundsInScreen(SnapPosition snap_position,
bool adjust_for_minimum_size = true);
// Gets the default value of |divider_position_|.
int GetDefaultDividerPosition() const;
......@@ -237,6 +235,10 @@ class ASH_EXPORT SplitViewController : public aura::WindowObserver,
class TabDraggedWindowObserver;
class DividerSnapAnimation;
// |position| should be |LEFT| or |RIGHT|, and this function returns
// |left_window_| or |right_window_| accordingly.
aura::Window* GetSnappedWindow(SnapPosition position);
// These functions return |left_window_| and |right_window_|, swapped in
// nonprimary screen orientations. Note that they may return null.
aura::Window* GetPhysicalLeftOrTopWindow();
......@@ -270,21 +272,6 @@ class ASH_EXPORT SplitViewController : public aura::WindowObserver,
// resizing.
void UpdateDividerPosition(const gfx::Point& location_in_screen);
// Get the window bounds for left_or_top and right_or_bottom snapped windows.
// Note the bounds returned by this function doesn't take the snapped windows
// minimum sizes into account.
void GetSnappedWindowBoundsInScreenInternal(gfx::Rect* left_or_top_rect,
gfx::Rect* right_or_bottom_rect);
// Splits the |work_area_rect| by |divider_rect| and outputs the two halves.
// |left_or_top_rect|, |divider_rect| and |right_or_bottom_rect| should align
// vertically or horizontally depending on |is_split_vertically|.
void SplitRect(const gfx::Rect& work_area_rect,
const gfx::Rect& divider_rect,
const bool is_split_vertically,
gfx::Rect* left_or_top_rect,
gfx::Rect* right_or_bottom_rect);
// Returns the closest fix location for |divider_position_|.
int GetClosestFixedDividerPosition();
......@@ -322,13 +309,6 @@ class ASH_EXPORT SplitViewController : public aura::WindowObserver,
// of dragging.
void OnSnappedWindowDetached(aura::Window* window, bool window_drag);
// If the desired bounds of the snapped windows bounds |left_or_top_rect| and
// |right_or_bottom_rect| are smaller than the minimum bounds of the snapped
// windows, adjust the desired bounds to the minimum bounds. Note the snapped
// windows can't be pushed out of the work area display area.
void AdjustSnappedWindowBounds(gfx::Rect* left_or_top_rect,
gfx::Rect* right_or_bottom_rect);
// Returns the closest position ratio based on |distance| and |length|.
float FindClosestPositionRatio(float distance, float length);
......
......@@ -469,8 +469,8 @@ gfx::Rect BackdropController::GetBackdropBounds() {
(state == SplitViewController::State::kLeftSnapped)
? SplitViewController::LEFT
: SplitViewController::RIGHT;
return split_view_controller->GetSnappedWindowBoundsInScreenUnadjusted(
snap_position);
return split_view_controller->GetSnappedWindowBoundsInScreen(
snap_position, /*adjust_for_minimum_size=*/false);
}
void BackdropController::Layout() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment