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

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

Issue 2622103002: Generalize browser controls adjustment for arbitrary scrollers. (Closed)
Patch Set: Fixed some comments Created 3 years, 11 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) 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 IntSize clamped = toIntSize(offset); 580 IntSize clamped = toIntSize(offset);
581 clamped = clamped.shrunkTo(max); 581 clamped = clamped.shrunkTo(max);
582 clamped = clamped.expandedTo(min); 582 clamped = clamped.expandedTo(min);
583 return IntPoint(clamped); 583 return IntPoint(clamped);
584 } 584 }
585 585
586 void VisualViewport::setBrowserControlsAdjustment(float adjustment) { 586 void VisualViewport::setBrowserControlsAdjustment(float adjustment) {
587 m_browserControlsAdjustment = adjustment; 587 m_browserControlsAdjustment = adjustment;
588 } 588 }
589 589
590 float VisualViewport::browserControlsAdjustment() const {
591 return m_browserControlsAdjustment;
592 }
593
590 IntRect VisualViewport::scrollableAreaBoundingBox() const { 594 IntRect VisualViewport::scrollableAreaBoundingBox() const {
591 // This method should return the bounding box in the parent view's coordinate 595 // This method should return the bounding box in the parent view's coordinate
592 // space; however, VisualViewport technically isn't a child of any Frames. 596 // space; however, VisualViewport technically isn't a child of any Frames.
593 // Nonetheless, the VisualViewport always occupies the entire main frame so 597 // Nonetheless, the VisualViewport always occupies the entire main frame so
594 // just return that. 598 // just return that.
595 LocalFrame* frame = mainFrame(); 599 LocalFrame* frame = mainFrame();
596 600
597 if (!frame || !frame->view()) 601 if (!frame || !frame->view())
598 return IntRect(); 602 return IntRect();
599 603
600 return frame->view()->frameRect(); 604 return frame->view()->frameRect();
601 } 605 }
602 606
603 IntSize VisualViewport::contentsSize() const { 607 IntSize VisualViewport::contentsSize() const {
604 LocalFrame* frame = mainFrame(); 608 LocalFrame* frame = mainFrame();
605 609
606 if (!frame || !frame->view()) 610 if (!frame || !frame->view())
607 return IntSize(); 611 return IntSize();
608 612
613 // TODO(bokan): This should be the layout viewport rather than main FrameView.
609 return frame->view()->visibleContentRect(IncludeScrollbars).size(); 614 return frame->view()->visibleContentRect(IncludeScrollbars).size();
610 } 615 }
611 616
612 IntRect VisualViewport::visibleContentRect( 617 IntRect VisualViewport::visibleContentRect(
613 IncludeScrollbarsInRect scrollbarInclusion) const { 618 IncludeScrollbarsInRect scrollbarInclusion) const {
614 // TODO(ymalik): We're losing precision here and below. visibleRect should 619 // TODO(ymalik): We're losing precision here and below. visibleRect should
615 // be replaced with visibleContentRect. 620 // be replaced with visibleContentRect.
616 IntRect rect = IntRect(visibleRect()); 621 IntRect rect = IntRect(visibleRect());
617 if (scrollbarInclusion == ExcludeScrollbars) { 622 if (scrollbarInclusion == ExcludeScrollbars) {
618 RootFrameViewport* rootFrameViewport = 623 RootFrameViewport* rootFrameViewport =
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 } else if (graphicsLayer == m_rootTransformLayer.get()) { 841 } else if (graphicsLayer == m_rootTransformLayer.get()) {
837 name = "Root Transform Layer"; 842 name = "Root Transform Layer";
838 } else { 843 } else {
839 ASSERT_NOT_REACHED(); 844 ASSERT_NOT_REACHED();
840 } 845 }
841 846
842 return name; 847 return name;
843 } 848 }
844 849
845 } // namespace blink 850 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698