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

Side by Side Diff: Source/WebCore/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
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 && hasHorizontal Scrollbar)
429 setHasHorizontalScrollbar(newHasHorizontalScrollbar); 429 setHasHorizontalScrollbar(newHasHorizontalScrollbar);
430 if (hasVerticalScrollbar != newHasVerticalScrollbar && (hasVerticalScrol lbar || !avoidScrollbarCreation())) 430 if (hasVerticalScrollbar != newHasVerticalScrollbar && hasVerticalScroll bar)
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 if (hasHorizontalScrollbar != newHasHorizontalScrollbar && (hasHorizonta lScrollbar || !avoidScrollbarCreation())) { 456 if (hasHorizontalScrollbar != newHasHorizontalScrollbar && hasHorizontal Scrollbar) {
457 if (scrollOrigin().y() && !newHasHorizontalScrollbar) 457 if (scrollOrigin().y() && !newHasHorizontalScrollbar)
458 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x(), scr ollOrigin().y() - m_horizontalScrollbar->height())); 458 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x(), scr ollOrigin().y() - m_horizontalScrollbar->height()));
459 if (m_horizontalScrollbar) 459 if (m_horizontalScrollbar)
460 m_horizontalScrollbar->invalidate(); 460 m_horizontalScrollbar->invalidate();
461 setHasHorizontalScrollbar(newHasHorizontalScrollbar); 461 setHasHorizontalScrollbar(newHasHorizontalScrollbar);
462 sendContentResizedNotification = true; 462 sendContentResizedNotification = true;
463 } 463 }
464 464
465 if (hasVerticalScrollbar != newHasVerticalScrollbar && (hasVerticalScrol lbar || !avoidScrollbarCreation())) { 465 if (hasVerticalScrollbar != newHasVerticalScrollbar && hasVerticalScroll bar) {
466 if (scrollOrigin().x() && !newHasVerticalScrollbar) 466 if (scrollOrigin().x() && !newHasVerticalScrollbar)
467 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x() - m_ verticalScrollbar->width(), scrollOrigin().y())); 467 ScrollableArea::setScrollOrigin(IntPoint(scrollOrigin().x() - m_ verticalScrollbar->width(), scrollOrigin().y()));
468 if (m_verticalScrollbar) 468 if (m_verticalScrollbar)
469 m_verticalScrollbar->invalidate(); 469 m_verticalScrollbar->invalidate();
470 setHasVerticalScrollbar(newHasVerticalScrollbar); 470 setHasVerticalScrollbar(newHasVerticalScrollbar);
471 sendContentResizedNotification = true; 471 sendContentResizedNotification = true;
472 } 472 }
473 473
474 if (sendContentResizedNotification && m_updateScrollbarsPass < cMaxUpdat eScrollbarsPass) { 474 if (sendContentResizedNotification && m_updateScrollbarsPass < cMaxUpdat eScrollbarsPass) {
475 m_updateScrollbarsPass++; 475 m_updateScrollbarsPass++;
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 { 1274 {
1275 } 1275 }
1276 1276
1277 bool ScrollView::platformIsOffscreen() const 1277 bool ScrollView::platformIsOffscreen() const
1278 { 1278 {
1279 return false; 1279 return false;
1280 } 1280 }
1281 1281
1282 1282
1283 } 1283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698