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

Side by Side Diff: cc/layers/painted_scrollbar_layer.cc

Issue 524373003: Scrollbar ThumbLength is not updated when window size is changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified Variable Name Created 6 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 unified diff | Download patch
« no previous file with comments | « cc/layers/painted_scrollbar_layer.h ('k') | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/painted_scrollbar_layer.h" 5 #include "cc/layers/painted_scrollbar_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/layers/painted_scrollbar_layer_impl.h" 10 #include "cc/layers/painted_scrollbar_layer_impl.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, 36 PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar,
37 int scroll_layer_id) 37 int scroll_layer_id)
38 : scrollbar_(scrollbar.Pass()), 38 : scrollbar_(scrollbar.Pass()),
39 scroll_layer_id_(scroll_layer_id), 39 scroll_layer_id_(scroll_layer_id),
40 clip_layer_id_(Layer::INVALID_ID), 40 clip_layer_id_(Layer::INVALID_ID),
41 thumb_thickness_(scrollbar_->ThumbThickness()), 41 thumb_thickness_(scrollbar_->ThumbThickness()),
42 thumb_length_(scrollbar_->ThumbLength()), 42 thumb_length_(scrollbar_->ThumbLength()),
43 is_overlay_(scrollbar_->IsOverlay()), 43 is_overlay_(scrollbar_->IsOverlay()),
44 has_thumb_(scrollbar_->HasThumb()) { 44 has_thumb_(scrollbar_->HasThumb()),
45 cache_has_thumb_(false) {
45 if (!scrollbar_->IsOverlay()) 46 if (!scrollbar_->IsOverlay())
46 SetShouldScrollOnMainThread(true); 47 SetShouldScrollOnMainThread(true);
47 } 48 }
48 49
49 PaintedScrollbarLayer::~PaintedScrollbarLayer() {} 50 PaintedScrollbarLayer::~PaintedScrollbarLayer() {}
50 51
51 int PaintedScrollbarLayer::ScrollLayerId() const { 52 int PaintedScrollbarLayer::ScrollLayerId() const {
52 return scroll_layer_id_; 53 return scroll_layer_id_;
53 } 54 }
54 55
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 gfx::Size(scrollbar_->ThumbThickness(), scrollbar_->ThumbLength()); 183 gfx::Size(scrollbar_->ThumbThickness(), scrollbar_->ThumbLength());
183 } 184 }
184 return gfx::Rect(thumb_size); 185 return gfx::Rect(thumb_size);
185 } 186 }
186 187
187 void PaintedScrollbarLayer::UpdateThumbAndTrackGeometry() { 188 void PaintedScrollbarLayer::UpdateThumbAndTrackGeometry() {
188 UpdateProperty(scrollbar_->TrackRect(), &track_rect_); 189 UpdateProperty(scrollbar_->TrackRect(), &track_rect_);
189 UpdateProperty(scrollbar_->Location(), &location_); 190 UpdateProperty(scrollbar_->Location(), &location_);
190 UpdateProperty(scrollbar_->IsOverlay(), &is_overlay_); 191 UpdateProperty(scrollbar_->IsOverlay(), &is_overlay_);
191 UpdateProperty(scrollbar_->HasThumb(), &has_thumb_); 192 UpdateProperty(scrollbar_->HasThumb(), &has_thumb_);
192 if (has_thumb_) { 193 if ((cache_has_thumb_ != has_thumb_) || has_thumb_) {
danakj 2014/09/03 15:38:27 I mean you don't need to add this cache_has_thumb_
193 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_); 194 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_);
194 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_); 195 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_);
196 cache_has_thumb_ = has_thumb_;
195 } 197 }
196 } 198 }
197 199
198 bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, 200 bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue,
199 const OcclusionTracker<Layer>* occlusion) { 201 const OcclusionTracker<Layer>* occlusion) {
200 UpdateThumbAndTrackGeometry(); 202 UpdateThumbAndTrackGeometry();
201 203
202 gfx::Rect track_layer_rect = gfx::Rect(location_, bounds()); 204 gfx::Rect track_layer_rect = gfx::Rect(location_, bounds());
203 gfx::Rect scaled_track_rect = ScrollbarLayerRectToContentRect( 205 gfx::Rect scaled_track_rect = ScrollbarLayerRectToContentRect(
204 track_layer_rect); 206 track_layer_rect);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 265
264 scrollbar_->PaintPart(&skcanvas, part, layer_rect); 266 scrollbar_->PaintPart(&skcanvas, part, layer_rect);
265 // Make sure that the pixels are no longer mutable to unavoid unnecessary 267 // Make sure that the pixels are no longer mutable to unavoid unnecessary
266 // allocation and copying. 268 // allocation and copying.
267 skbitmap.setImmutable(); 269 skbitmap.setImmutable();
268 270
269 return UIResourceBitmap(skbitmap); 271 return UIResourceBitmap(skbitmap);
270 } 272 }
271 273
272 } // namespace cc 274 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/painted_scrollbar_layer.h ('k') | cc/layers/scrollbar_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698