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

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 1511003003: Use refs for non-null GraphicsContext, Scrollbar, etc. in scrollbar related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarRemove
Patch Set: yet another mac fix Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (scale != m_scale) { 203 if (scale != m_scale) {
204 m_scale = scale; 204 m_scale = scale;
205 valuesChanged = true; 205 valuesChanged = true;
206 frameHost().chromeClient().pageScaleFactorChanged(); 206 frameHost().chromeClient().pageScaleFactorChanged();
207 } 207 }
208 208
209 FloatPoint clampedOffset(clampOffsetToBoundaries(location)); 209 FloatPoint clampedOffset(clampOffsetToBoundaries(location));
210 210
211 if (clampedOffset != m_offset) { 211 if (clampedOffset != m_offset) {
212 m_offset = clampedOffset; 212 m_offset = clampedOffset;
213 scrollAnimator()->setCurrentPosition(m_offset); 213 scrollAnimator().setCurrentPosition(m_offset);
214 214
215 // SVG runs with accelerated compositing disabled so no ScrollingCoordin ator. 215 // SVG runs with accelerated compositing disabled so no ScrollingCoordin ator.
216 if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoor dinator()) 216 if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoor dinator())
217 coordinator->scrollableAreaScrollLayerDidChange(this); 217 coordinator->scrollableAreaScrollLayerDidChange(this);
218 218
219 if (!frameHost().settings().inertVisualViewport()) { 219 if (!frameHost().settings().inertVisualViewport()) {
220 if (Document* document = mainFrame()->document()) 220 if (Document* document = mainFrame()->document())
221 document->enqueueScrollEventForNode(document); 221 document->enqueueScrollEventForNode(document);
222 } 222 }
223 223
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 void VisualViewport::setupScrollbar(WebScrollbar::Orientation orientation) 359 void VisualViewport::setupScrollbar(WebScrollbar::Orientation orientation)
360 { 360 {
361 bool isHorizontal = orientation == WebScrollbar::Horizontal; 361 bool isHorizontal = orientation == WebScrollbar::Horizontal;
362 GraphicsLayer* scrollbarGraphicsLayer = isHorizontal ? 362 GraphicsLayer* scrollbarGraphicsLayer = isHorizontal ?
363 m_overlayScrollbarHorizontal.get() : m_overlayScrollbarVertical.get(); 363 m_overlayScrollbarHorizontal.get() : m_overlayScrollbarVertical.get();
364 OwnPtr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ? 364 OwnPtr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ?
365 m_webOverlayScrollbarHorizontal : m_webOverlayScrollbarVertical; 365 m_webOverlayScrollbarHorizontal : m_webOverlayScrollbarVertical;
366 366
367 ScrollbarTheme* theme = ScrollbarThemeOverlay::mobileTheme(); 367 ScrollbarThemeOverlay& theme = ScrollbarThemeOverlay::mobileTheme();
368 int thumbThickness = theme->thumbThickness(0); 368 int thumbThickness = theme.thumbThickness();
369 int scrollbarThickness = theme->scrollbarThickness(RegularScrollbar); 369 int scrollbarThickness = theme.scrollbarThickness(RegularScrollbar);
370 int scrollbarMargin = theme->scrollbarMargin(); 370 int scrollbarMargin = theme.scrollbarMargin();
371 371
372 if (!webScrollbarLayer) { 372 if (!webScrollbarLayer) {
373 ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordina tor(); 373 ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordina tor();
374 ASSERT(coordinator); 374 ASSERT(coordinator);
375 ScrollbarOrientation webcoreOrientation = isHorizontal ? HorizontalScrol lbar : VerticalScrollbar; 375 ScrollbarOrientation webcoreOrientation = isHorizontal ? HorizontalScrol lbar : VerticalScrollbar;
376 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(webcoreO rientation, thumbThickness, scrollbarMargin, false); 376 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(webcoreO rientation, thumbThickness, scrollbarMargin, false);
377 377
378 // The compositor will control the scrollbar's visibility. Set to invisi ble by defualt 378 // The compositor will control the scrollbar's visibility. Set to invisi ble by defualt
379 // so scrollbars don't show up in layout tests. 379 // so scrollbars don't show up in layout tests.
380 webScrollbarLayer->layer()->setOpacity(0); 380 webScrollbarLayer->layer()->setOpacity(0);
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } else if (graphicsLayer == m_rootTransformLayer) { 736 } else if (graphicsLayer == m_rootTransformLayer) {
737 name = "Root Transform Layer"; 737 name = "Root Transform Layer";
738 } else { 738 } else {
739 ASSERT_NOT_REACHED(); 739 ASSERT_NOT_REACHED();
740 } 740 }
741 741
742 return name; 742 return name;
743 } 743 }
744 744
745 } // namespace blink 745 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698