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

Unified Diff: Source/core/frame/FrameView.cpp

Issue 1162623007: Removed redundant rect methods on FrameView (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index 3d86061aaa69653fbd0367a20f059cba60000999..09ed992ed015e987a77ae3792ea38c518d6c20af 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -125,7 +125,6 @@ FrameView::FrameView(LocalFrame* frame)
, m_safeToPropagateScrollToParent(true)
, m_isTrackingPaintInvalidations(false)
, m_scrollCorner(nullptr)
- , m_visibleContentScaleFactor(1)
, m_inputEventsScaleFactorForEmulation(1)
, m_layoutSizeFixedToFrameSize(true)
, m_didScrollTimer(this, &FrameView::didScrollTimerFired)
@@ -407,7 +406,7 @@ void FrameView::setFrameRect(const IntRect& newRect)
layoutView->compositor()->frameViewDidChangeSize();
}
- viewportConstrainedVisibleContentSizeChanged(newRect.width() != oldRect.width(), newRect.height() != oldRect.height());
+ viewportSizeChanged(newRect.width() != oldRect.width(), newRect.height() != oldRect.height());
if (oldRect.size() != newRect.size() && m_frame->isMainFrame())
page()->frameHost().pinchViewport().mainFrameDidChangeSize();
@@ -517,7 +516,7 @@ void FrameView::setContentsSize(const IntSize& size)
IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) const
{
IntPoint maxScrollExtent(contentsSize().width() - scrollOrigin().x(), contentsSize().height() - scrollOrigin().y());
- FloatSize scaledSize = unscaledVisibleContentSize();
+ FloatSize scaledSize = visibleContentSize();
if (scale)
scaledSize.scale(1 / scale);
@@ -1275,14 +1274,7 @@ void FrameView::removeViewportConstrainedObject(LayoutObject* object)
}
}
-LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
-{
- LayoutRect viewportRect = LayoutRect(visibleContentRect());
- viewportRect.setLocation(clampScrollPosition(scrollPosition()));
- return viewportRect;
-}
-
-void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged)
+void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged)
{
if (!hasViewportConstrainedObjects())
return;
@@ -1305,11 +1297,6 @@ void FrameView::viewportConstrainedVisibleContentSizeChanged(bool widthChanged,
}
}
-IntSize FrameView::scrollOffsetForViewportConstrainedObjects() const
-{
- return roundedIntSize(viewportConstrainedVisibleContentRect().location());
-}
-
IntPoint FrameView::lastKnownMousePosition() const
{
return m_frame->eventHandler().lastKnownMousePosition();
@@ -2254,15 +2241,6 @@ IntRect FrameView::windowResizerRect() const
return page->chrome().windowResizerRect();
}
-void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor)
-{
- if (m_visibleContentScaleFactor == visibleContentScaleFactor)
- return;
-
- m_visibleContentScaleFactor = visibleContentScaleFactor;
- updateScrollbars(scrollOffsetDouble());
-}
-
void FrameView::setInputEventsTransformForEmulation(const IntSize& offset, float contentScaleFactor)
{
m_inputEventsOffsetForEmulation = offset;
@@ -3073,18 +3051,14 @@ IntPoint FrameView::maximumScrollPosition() const
{
// Make the same calculation as in CC's LayerImpl::MaxScrollOffset()
// FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/422331.
- FloatSize visibleSize = unscaledVisibleContentSize(ExcludeScrollbars);
+ FloatSize visibleSize = visibleContentSize(ExcludeScrollbars);
visibleSize.expand(0, m_topControlsViewportAdjustment);
FloatSize contentBounds = contentsSize();
- contentBounds.scale(visibleContentScaleFactor());
contentBounds = flooredIntSize(contentBounds);
FloatSize maximumOffset = contentBounds - visibleSize - toIntSize(scrollOrigin());
- // Convert back to CSS pixels.
- maximumOffset.scale(1 / visibleContentScaleFactor());
-
IntPoint snappedMaximumOffset = flooredIntPoint(maximumOffset);
snappedMaximumOffset.clampNegativeToZero();
return snappedMaximumOffset;
@@ -3195,16 +3169,14 @@ void FrameView::setClipsRepaints(bool clipsRepaints)
m_clipsRepaints = clipsRepaints;
}
-IntSize FrameView::unscaledVisibleContentSize(IncludeScrollbarsInRect scrollbarInclusion) const
+IntSize FrameView::visibleContentSize(IncludeScrollbarsInRect scrollbarInclusion) const
{
return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(frameRect().size()) : frameRect().size();
}
-IntRect FrameView::visibleContentRect(IncludeScrollbarsInRect scollbarInclusion) const
+IntRect FrameView::visibleContentRect(IncludeScrollbarsInRect scrollbarInclusion) const
{
- FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion);
- visibleContentSize.scale(1 / visibleContentScaleFactor());
- return IntRect(flooredIntPoint(m_scrollPosition), expandedIntSize(visibleContentSize));
+ return IntRect(flooredIntPoint(m_scrollPosition), visibleContentSize(scrollbarInclusion));
}
IntSize FrameView::contentsSize() const
@@ -3443,7 +3415,7 @@ void FrameView::updateScrollbars(const DoubleSize& desiredOffset)
return;
InUpdateScrollbarsScope inUpdateScrollbarsScope(this);
- IntSize oldVisibleSize = visibleSize();
+ IntSize oldVisibleSize = visibleContentSize();
bool scrollbarExistenceChanged = false;
@@ -3470,7 +3442,7 @@ void FrameView::updateScrollbars(const DoubleSize& desiredOffset)
}
// FIXME: We don't need to do this if we are composited.
- IntSize newVisibleSize = visibleSize();
+ IntSize newVisibleSize = visibleContentSize();
if (newVisibleSize.width() > oldVisibleSize.width()) {
if (shouldPlaceVerticalScrollbarOnLeft())
invalidateRect(IntRect(0, 0, newVisibleSize.width() - oldVisibleSize.width(), newVisibleSize.height()));
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/PinchViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698