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

Side by Side Diff: Source/core/platform/ScrollView.cpp

Issue 13963006: Remove frame flattening support as Chromium has no intention of using it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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 | « Source/core/platform/ScrollView.h ('k') | Source/core/rendering/RenderFrame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 void ScrollView::removeChild(Widget* child) 76 void ScrollView::removeChild(Widget* child)
77 { 77 {
78 ASSERT(child->parent() == this); 78 ASSERT(child->parent() == this);
79 child->setParent(0); 79 child->setParent(0);
80 m_children.remove(child); 80 m_children.remove(child);
81 } 81 }
82 82
83 void ScrollView::setHasHorizontalScrollbar(bool hasBar) 83 void ScrollView::setHasHorizontalScrollbar(bool hasBar)
84 { 84 {
85 ASSERT(!hasBar || !avoidScrollbarCreation()); 85 ASSERT(!hasBar);
86 if (hasBar && !m_horizontalScrollbar) { 86 if (hasBar && !m_horizontalScrollbar) {
87 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); 87 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar);
88 addChild(m_horizontalScrollbar.get()); 88 addChild(m_horizontalScrollbar.get());
89 didAddHorizontalScrollbar(m_horizontalScrollbar.get()); 89 didAddHorizontalScrollbar(m_horizontalScrollbar.get());
90 m_horizontalScrollbar->styleChanged(); 90 m_horizontalScrollbar->styleChanged();
91 } else if (!hasBar && m_horizontalScrollbar) { 91 } else if (!hasBar && m_horizontalScrollbar) {
92 willRemoveHorizontalScrollbar(m_horizontalScrollbar.get()); 92 willRemoveHorizontalScrollbar(m_horizontalScrollbar.get());
93 removeChild(m_horizontalScrollbar.get()); 93 removeChild(m_horizontalScrollbar.get());
94 m_horizontalScrollbar = 0; 94 m_horizontalScrollbar = 0;
95 } 95 }
96 96
97 if (AXObjectCache* cache = axObjectCache()) 97 if (AXObjectCache* cache = axObjectCache())
98 cache->handleScrollbarUpdate(this); 98 cache->handleScrollbarUpdate(this);
99 } 99 }
100 100
101 void ScrollView::setHasVerticalScrollbar(bool hasBar) 101 void ScrollView::setHasVerticalScrollbar(bool hasBar)
102 { 102 {
103 ASSERT(!hasBar || !avoidScrollbarCreation()); 103 ASSERT(!hasBar);
104 if (hasBar && !m_verticalScrollbar) { 104 if (hasBar && !m_verticalScrollbar) {
105 m_verticalScrollbar = createScrollbar(VerticalScrollbar); 105 m_verticalScrollbar = createScrollbar(VerticalScrollbar);
106 addChild(m_verticalScrollbar.get()); 106 addChild(m_verticalScrollbar.get());
107 didAddVerticalScrollbar(m_verticalScrollbar.get()); 107 didAddVerticalScrollbar(m_verticalScrollbar.get());
108 m_verticalScrollbar->styleChanged(); 108 m_verticalScrollbar->styleChanged();
109 } else if (!hasBar && m_verticalScrollbar) { 109 } else if (!hasBar && m_verticalScrollbar) {
110 willRemoveVerticalScrollbar(m_verticalScrollbar.get()); 110 willRemoveVerticalScrollbar(m_verticalScrollbar.get());
111 removeChild(m_verticalScrollbar.get()); 111 removeChild(m_verticalScrollbar.get());
112 m_verticalScrollbar = 0; 112 m_verticalScrollbar = 0;
113 } 113 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 ScrollbarMode hScroll = m_horizontalScrollbarMode; 419 ScrollbarMode hScroll = m_horizontalScrollbarMode;
420 ScrollbarMode vScroll = m_verticalScrollbarMode; 420 ScrollbarMode vScroll = m_verticalScrollbarMode;
421 421
422 if (hScroll != ScrollbarAuto) 422 if (hScroll != ScrollbarAuto)
423 newHasHorizontalScrollbar = (hScroll == ScrollbarAlwaysOn); 423 newHasHorizontalScrollbar = (hScroll == ScrollbarAlwaysOn);
424 if (vScroll != ScrollbarAuto) 424 if (vScroll != ScrollbarAuto)
425 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn); 425 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn);
426 426
427 if (m_scrollbarsSuppressed || (hScroll != ScrollbarAuto && vScroll != Scroll barAuto)) { 427 if (m_scrollbarsSuppressed || (hScroll != ScrollbarAuto && vScroll != Scroll barAuto)) {
428 if (hasHorizontalScrollbar != newHasHorizontalScrollbar && (hasHorizonta lScrollbar || !avoidScrollbarCreation())) 428 if (hasHorizontalScrollbar != newHasHorizontalScrollbar)
429 setHasHorizontalScrollbar(newHasHorizontalScrollbar); 429 setHasHorizontalScrollbar(newHasHorizontalScrollbar);
430 if (hasVerticalScrollbar != newHasVerticalScrollbar && (hasVerticalScrol lbar || !avoidScrollbarCreation())) 430 if (hasVerticalScrollbar != newHasVerticalScrollbar)
431 setHasVerticalScrollbar(newHasVerticalScrollbar); 431 setHasVerticalScrollbar(newHasVerticalScrollbar);
432 } else { 432 } else {
433 bool sendContentResizedNotification = false; 433 bool sendContentResizedNotification = false;
434 434
435 IntSize docSize = totalContentsSize(); 435 IntSize docSize = totalContentsSize();
436 IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size(); 436 IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size();
437 437
438 if (hScroll == ScrollbarAuto) { 438 if (hScroll == ScrollbarAuto) {
439 newHasHorizontalScrollbar = docSize.width() > visibleWidth(); 439 newHasHorizontalScrollbar = docSize.width() > visibleWidth();
440 if (newHasHorizontalScrollbar && !m_updateScrollbarsPass && docSize. width() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height ()) 440 if (newHasHorizontalScrollbar && !m_updateScrollbarsPass && docSize. width() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height ())
441 newHasHorizontalScrollbar = false; 441 newHasHorizontalScrollbar = false;
442 } 442 }
443 if (vScroll == ScrollbarAuto) { 443 if (vScroll == ScrollbarAuto) {
444 newHasVerticalScrollbar = docSize.height() > visibleHeight(); 444 newHasVerticalScrollbar = docSize.height() > visibleHeight();
445 if (newHasVerticalScrollbar && !m_updateScrollbarsPass && docSize.wi dth() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height() ) 445 if (newHasVerticalScrollbar && !m_updateScrollbarsPass && docSize.wi dth() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height() )
446 newHasVerticalScrollbar = false; 446 newHasVerticalScrollbar = false;
447 } 447 }
448 448
449 // If we ever turn one scrollbar off, always turn the other one off too. Never ever 449 // If we ever turn one scrollbar off, always turn the other one off too. Never ever
450 // try to both gain/lose a scrollbar in the same pass. 450 // try to both gain/lose a scrollbar in the same pass.
451 if (!newHasHorizontalScrollbar && hasHorizontalScrollbar && vScroll != S crollbarAlwaysOn) 451 if (!newHasHorizontalScrollbar && hasHorizontalScrollbar && vScroll != S crollbarAlwaysOn)
452 newHasVerticalScrollbar = false; 452 newHasVerticalScrollbar = false;
453 if (!newHasVerticalScrollbar && hasVerticalScrollbar && hScroll != Scrol lbarAlwaysOn) 453 if (!newHasVerticalScrollbar && hasVerticalScrollbar && hScroll != Scrol lbarAlwaysOn)
454 newHasHorizontalScrollbar = false; 454 newHasHorizontalScrollbar = false;
455 455
456 bool scrollbarIsOverlay = ScrollbarTheme::theme()->usesOverlayScrollbars (); 456 bool scrollbarIsOverlay = ScrollbarTheme::theme()->usesOverlayScrollbars ();
457 if (hasHorizontalScrollbar != newHasHorizontalScrollbar && (hasHorizonta lScrollbar || !avoidScrollbarCreation())) { 457 if (hasHorizontalScrollbar != newHasHorizontalScrollbar) {
458 if (!scrollbarIsOverlay) 458 if (!scrollbarIsOverlay)
459 sendContentResizedNotification = true; 459 sendContentResizedNotification = true;
460 if (scrollOrigin().y() && !newHasHorizontalScrollbar && !scrollbarIs Overlay) 460 if (scrollOrigin().y() && !newHasHorizontalScrollbar && !scrollbarIs Overlay)
461 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x(), scr ollOrigin().y() - m_horizontalScrollbar->height())); 461 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x(), scr ollOrigin().y() - m_horizontalScrollbar->height()));
462 if (hasHorizontalScrollbar) 462 if (hasHorizontalScrollbar)
463 m_horizontalScrollbar->invalidate(); 463 m_horizontalScrollbar->invalidate();
464 setHasHorizontalScrollbar(newHasHorizontalScrollbar); 464 setHasHorizontalScrollbar(newHasHorizontalScrollbar);
465 } 465 }
466 466
467 if (hasVerticalScrollbar != newHasVerticalScrollbar && (hasVerticalScrol lbar || !avoidScrollbarCreation())) { 467 if (hasVerticalScrollbar != newHasVerticalScrollbar) {
468 if (!scrollbarIsOverlay) 468 if (!scrollbarIsOverlay)
469 sendContentResizedNotification = true; 469 sendContentResizedNotification = true;
470 if (scrollOrigin().x() && !newHasVerticalScrollbar && !scrollbarIsOv erlay) 470 if (scrollOrigin().x() && !newHasVerticalScrollbar && !scrollbarIsOv erlay)
471 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x() - m_ verticalScrollbar->width(), scrollOrigin().y())); 471 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x() - m_ verticalScrollbar->width(), scrollOrigin().y()));
472 if (hasVerticalScrollbar) 472 if (hasVerticalScrollbar)
473 m_verticalScrollbar->invalidate(); 473 m_verticalScrollbar->invalidate();
474 setHasVerticalScrollbar(newHasVerticalScrollbar); 474 setHasVerticalScrollbar(newHasVerticalScrollbar);
475 } 475 }
476 476
477 if (sendContentResizedNotification && m_updateScrollbarsPass < cMaxUpdat eScrollbarsPass) { 477 if (sendContentResizedNotification && m_updateScrollbarsPass < cMaxUpdat eScrollbarsPass) {
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 { 1277 {
1278 } 1278 }
1279 1279
1280 bool ScrollView::platformIsOffscreen() const 1280 bool ScrollView::platformIsOffscreen() const
1281 { 1281 {
1282 return false; 1282 return false;
1283 } 1283 }
1284 1284
1285 1285
1286 } 1286 }
OLDNEW
« no previous file with comments | « Source/core/platform/ScrollView.h ('k') | Source/core/rendering/RenderFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698