summaryrefslogtreecommitdiffstats
path: root/cc/test/fake_web_scrollbar_theme_geometry.cc
blob: 8a0f378875bf5998931a6500967d3c078f24436d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright 2012 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.

#include "cc/test/fake_web_scrollbar_theme_geometry.h"

using WebKit::WebRect;

namespace cc {

WebKit::WebScrollbarThemeGeometry*
    FakeWebScrollbarThemeGeometry::clone() const {
  return new FakeWebScrollbarThemeGeometry(m_hasThumb);
}

int FakeWebScrollbarThemeGeometry::thumbPosition(WebKit::WebScrollbar*) {
  if (!m_hasThumb)
    return 0;
  return 5;
}

int FakeWebScrollbarThemeGeometry::thumbLength(WebKit::WebScrollbar*) {
  if (!m_hasThumb)
    return 0;
  return 2;
}

int FakeWebScrollbarThemeGeometry::trackPosition(WebKit::WebScrollbar*) {
  return 0;
}

int FakeWebScrollbarThemeGeometry::trackLength(WebKit::WebScrollbar*) {
  return 10;
}

bool FakeWebScrollbarThemeGeometry::hasButtons(WebKit::WebScrollbar*) {
  return false;
}

bool FakeWebScrollbarThemeGeometry::hasThumb(WebKit::WebScrollbar*) {
  return m_hasThumb;
}

WebRect FakeWebScrollbarThemeGeometry::trackRect(WebKit::WebScrollbar*) {
  return WebRect(0, 0, 10, 10);
}

WebRect FakeWebScrollbarThemeGeometry::thumbRect(WebKit::WebScrollbar*) {
  if (!m_hasThumb)
    return WebRect(0, 0, 0, 0);
  return WebRect(0, 5, 5, 2);
}

int FakeWebScrollbarThemeGeometry::minimumThumbLength(WebKit::WebScrollbar*) {
  return 0;
}

int FakeWebScrollbarThemeGeometry::scrollbarThickness(WebKit::WebScrollbar*) {
  return 0;
}

WebRect FakeWebScrollbarThemeGeometry::backButtonStartRect(
    WebKit::WebScrollbar*) {
  return WebRect();
}

WebRect FakeWebScrollbarThemeGeometry::backButtonEndRect(
    WebKit::WebScrollbar*) {
  return WebRect();
}

WebRect FakeWebScrollbarThemeGeometry::forwardButtonStartRect(
    WebKit::WebScrollbar*) {
  return WebRect();
}

WebRect FakeWebScrollbarThemeGeometry::forwardButtonEndRect(
    WebKit::WebScrollbar*) {
  return WebRect();
}

WebRect FakeWebScrollbarThemeGeometry::constrainTrackRectToTrackPieces(
   WebKit::WebScrollbar*,
   const WebRect&) {
  return WebRect();
}

void FakeWebScrollbarThemeGeometry::splitTrack(
    WebKit::WebScrollbar*,
    const WebRect& track,
    WebRect& startTrack,
    WebRect& thumb,
    WebRect& endTrack) {
  if (!m_hasThumb) {
    thumb = WebRect(0, 0, 0, 0);
    startTrack = WebRect(0, 0, 10, 10);
    endTrack = WebRect(0, 10, 10, 0);
  } else {
    thumb = WebRect(0, 5, 5, 2);
    startTrack = WebRect(0, 5, 0, 5);
    endTrack = WebRect(0, 0, 0, 5);
  }
}

}  // namespace cc