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

Side by Side Diff: sky/engine/core/frame/FrameView.cpp

Issue 681023002: Remove a bunch of frame-level scrolling machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/engine/core/frame/FrameView.h ('k') | sky/engine/core/loader/EmptyClients.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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t 222 IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) cons t
223 { 223 {
224 FloatSize scaledSize = unscaledVisibleContentSize(); 224 FloatSize scaledSize = unscaledVisibleContentSize();
225 if (scale) 225 if (scale)
226 scaledSize.scale(1 / scale); 226 scaledSize.scale(1 / scale);
227 227
228 IntPoint clampedOffset = offset; 228 IntPoint clampedOffset = offset;
229 clampedOffset = clampedOffset.shrunkTo( 229 clampedOffset = clampedOffset.shrunkTo(
230 IntPoint(size()) - expandedIntSize(scaledSize)); 230 IntPoint(size()) - expandedIntSize(scaledSize));
231 clampedOffset = clampedOffset.expandedTo(-scrollOrigin());
232
233 return clampedOffset; 231 return clampedOffset;
234 } 232 }
235 233
236 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar Mode& hMode, ScrollbarMode& vMode) 234 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar Mode& hMode, ScrollbarMode& vMode)
237 { 235 {
238 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE treats 236 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE treats
239 // overflow:hidden and overflow:scroll on <body> as applying to the document 's 237 // overflow:hidden and overflow:scroll on <body> as applying to the document 's
240 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should 238 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should
241 // use the root element. 239 // use the root element.
242 240
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(o bject)) { 736 if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(o bject)) {
739 m_viewportConstrainedObjects->remove(object); 737 m_viewportConstrainedObjects->remove(object);
740 738
741 if (Page* page = m_frame->page()) { 739 if (Page* page = m_frame->page()) {
742 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator()) 740 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoor dinator())
743 scrollingCoordinator->frameViewFixedObjectsDidChange(this); 741 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
744 } 742 }
745 } 743 }
746 } 744 }
747 745
748 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
749 {
750 LayoutRect viewportRect = visibleContentRect();
751 // Ignore overhang. No-op when not using rubber banding.
752 viewportRect.setLocation(clampScrollPosition(scrollPosition()));
753 return viewportRect;
754 }
755
756 void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged) 746 void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged)
757 { 747 {
758 // FIXME(sky): Remove 748 // FIXME(sky): Remove
759 } 749 }
760 750
761 IntSize FrameView::scrollOffsetForFixedPosition() const
762 {
763 return toIntSize(clampScrollPosition(scrollPosition()));
764 }
765
766 IntPoint FrameView::lastKnownMousePosition() const 751 IntPoint FrameView::lastKnownMousePosition() const
767 { 752 {
768 return m_frame->eventHandler().lastKnownMousePosition(); 753 return m_frame->eventHandler().lastKnownMousePosition();
769 } 754 }
770 755
771 bool FrameView::shouldSetCursor() const 756 bool FrameView::shouldSetCursor() const
772 { 757 {
773 Page* page = frame().page(); 758 Page* page = frame().page();
774 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); 759 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse();
775 } 760 }
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 { 1282 {
1298 return m_inputEventsOffsetForEmulation; 1283 return m_inputEventsOffsetForEmulation;
1299 } 1284 }
1300 1285
1301 float FrameView::inputEventsScaleFactor() const 1286 float FrameView::inputEventsScaleFactor() const
1302 { 1287 {
1303 float pageScale = visibleContentScaleFactor(); 1288 float pageScale = visibleContentScaleFactor();
1304 return pageScale * m_inputEventsScaleFactorForEmulation; 1289 return pageScale * m_inputEventsScaleFactorForEmulation;
1305 } 1290 }
1306 1291
1307 bool FrameView::scrollbarsCanBeActive() const
1308 {
1309 if (m_frame->view() != this)
1310 return false;
1311
1312 return !!m_frame->document();
1313 }
1314
1315 IntRect FrameView::scrollableAreaBoundingBox() const 1292 IntRect FrameView::scrollableAreaBoundingBox() const
1316 { 1293 {
1317 return frameRect(); 1294 return frameRect();
1318 } 1295 }
1319 1296
1320 bool FrameView::isScrollable() 1297 bool FrameView::isScrollable()
1321 { 1298 {
1322 // FIXME(sky): Remove 1299 // FIXME(sky): Remove
1323 return false; 1300 return false;
1324 } 1301 }
1325 1302
1326 void FrameView::notifyPageThatContentAreaWillPaint() const
1327 {
1328 Page* page = m_frame->page();
1329 if (!page)
1330 return;
1331
1332 if (!m_scrollableAreas)
1333 return;
1334
1335 for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin( ), end = m_scrollableAreas->end(); it != end; ++it) {
1336 ScrollableArea* scrollableArea = *it;
1337
1338 if (!scrollableArea->scrollbarsCanBeActive())
1339 continue;
1340
1341 scrollableArea->contentAreaWillPaint();
1342 }
1343 }
1344
1345 bool FrameView::scrollAnimatorEnabled() const 1303 bool FrameView::scrollAnimatorEnabled() const
1346 { 1304 {
1347 return m_frame->settings() && m_frame->settings()->scrollAnimatorEnabled(); 1305 return m_frame->settings() && m_frame->settings()->scrollAnimatorEnabled();
1348 } 1306 }
1349 1307
1350 Color FrameView::documentBackgroundColor() const 1308 Color FrameView::documentBackgroundColor() const
1351 { 1309 {
1352 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c olor of 1310 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c olor of
1353 // the document and the body against the base background color of the frame view. 1311 // the document and the body against the base background color of the frame view.
1354 // Background images are unfortunately impractical to include. 1312 // Background images are unfortunately impractical to include.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 bool FrameView::isPainting() const 1426 bool FrameView::isPainting() const
1469 { 1427 {
1470 return m_isPainting; 1428 return m_isPainting;
1471 } 1429 }
1472 1430
1473 void FrameView::setNodeToDraw(Node* node) 1431 void FrameView::setNodeToDraw(Node* node)
1474 { 1432 {
1475 m_nodeToDraw = node; 1433 m_nodeToDraw = node;
1476 } 1434 }
1477 1435
1478 void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& hori zontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRec t)
1479 {
1480 if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, hori zontalOverhangArea, verticalOverhangArea, dirtyRect))
1481 return;
1482 }
1483
1484 void FrameView::updateWidgetPositionsIfNeeded() 1436 void FrameView::updateWidgetPositionsIfNeeded()
1485 { 1437 {
1486 if (!m_needsUpdateWidgetPositions) 1438 if (!m_needsUpdateWidgetPositions)
1487 return; 1439 return;
1488 1440
1489 m_needsUpdateWidgetPositions = false; 1441 m_needsUpdateWidgetPositions = false;
1490 1442
1491 updateWidgetPositions(); 1443 updateWidgetPositions();
1492 } 1444 }
1493 1445
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 void FrameView::setLayoutSizeInternal(const IntSize& size) 1690 void FrameView::setLayoutSizeInternal(const IntSize& size)
1739 { 1691 {
1740 if (m_layoutSize == size) 1692 if (m_layoutSize == size)
1741 return; 1693 return;
1742 1694
1743 m_layoutSize = size; 1695 m_layoutSize = size;
1744 contentsResized(); 1696 contentsResized();
1745 } 1697 }
1746 1698
1747 } // namespace blink 1699 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/frame/FrameView.h ('k') | sky/engine/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698