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

Side by Side Diff: Source/core/rendering/RenderView.cpp

Issue 751573002: Use viewportConstrainedVisibleContentRect() to get the scrolling offset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed the 'DEPRECATED' comment Created 6 years 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/rendering/RenderLayerClipper.cpp ('k') | Source/web/FindInPageCoordinates.cpp » ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 { 237 {
238 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); 238 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed));
239 239
240 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) { 240 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) {
241 TransformationMatrix t; 241 TransformationMatrix t;
242 getTransformFromContainer(0, LayoutSize(), t); 242 getTransformFromContainer(0, LayoutSize(), t);
243 transformState.applyTransform(t); 243 transformState.applyTransform(t);
244 } 244 }
245 245
246 if ((mode & IsFixed) && m_frameView) { 246 if ((mode & IsFixed) && m_frameView) {
247 transformState.move(m_frameView->scrollOffsetForFixedPosition()); 247 transformState.move(m_frameView->scrollOffsetForViewportConstrainedObjec ts());
248 // IsFixed flag is only applicable within this RenderView. 248 // IsFixed flag is only applicable within this RenderView.
249 mode &= ~IsFixed; 249 mode &= ~IsFixed;
250 } 250 }
251 251
252 if (paintInvalidationContainer == this) 252 if (paintInvalidationContainer == this)
253 return; 253 return;
254 254
255 if (mode & TraverseDocumentBoundaries) { 255 if (mode & TraverseDocumentBoundaries) {
256 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { 256 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) {
257 transformState.move(-frame()->view()->scrollOffset()); 257 transformState.move(-frame()->view()->scrollOffset());
258 if (parentDocRenderer->isBox()) 258 if (parentDocRenderer->isBox())
259 transformState.move(toRenderBox(parentDocRenderer)->contentBoxOf fset()); 259 transformState.move(toRenderBox(parentDocRenderer)->contentBoxOf fset());
260 parentDocRenderer->mapLocalToContainer(paintInvalidationContainer, t ransformState, mode, wasFixed, paintInvalidationState); 260 parentDocRenderer->mapLocalToContainer(paintInvalidationContainer, t ransformState, mode, wasFixed, paintInvalidationState);
261 return; 261 return;
262 } 262 }
263 } 263 }
264 } 264 }
265 265
266 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const 266 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const
267 { 267 {
268 LayoutSize offsetForFixedPosition; 268 LayoutSize offsetForFixedPosition;
269 LayoutSize offset; 269 LayoutSize offset;
270 RenderObject* container = 0; 270 RenderObject* container = 0;
271 271
272 if (m_frameView) 272 if (m_frameView)
273 offsetForFixedPosition = LayoutSize(m_frameView->scrollOffsetForFixedPos ition()); 273 offsetForFixedPosition = LayoutSize(m_frameView->scrollOffsetForViewport ConstrainedObjects());
274 274
275 if (geometryMap.mapCoordinatesFlags() & TraverseDocumentBoundaries) { 275 if (geometryMap.mapCoordinatesFlags() & TraverseDocumentBoundaries) {
276 if (RenderPart* parentDocRenderer = frame()->ownerRenderer()) { 276 if (RenderPart* parentDocRenderer = frame()->ownerRenderer()) {
277 offset = -LayoutSize(m_frameView->scrollOffset()); 277 offset = -LayoutSize(m_frameView->scrollOffset());
278 offset += parentDocRenderer->contentBoxOffset(); 278 offset += parentDocRenderer->contentBoxOffset();
279 container = parentDocRenderer; 279 container = parentDocRenderer;
280 } 280 }
281 } 281 }
282 282
283 // If a container was specified, and was not 0 or the RenderView, then we 283 // If a container was specified, and was not 0 or the RenderView, then we
284 // should have found it by now unless we're traversing to a parent document. 284 // should have found it by now unless we're traversing to a parent document.
285 ASSERT_ARG(ancestorToStopAt, !ancestorToStopAt || ancestorToStopAt == this | | container); 285 ASSERT_ARG(ancestorToStopAt, !ancestorToStopAt || ancestorToStopAt == this | | container);
286 286
287 if ((!ancestorToStopAt || container) && shouldUseTransformFromContainer(cont ainer)) { 287 if ((!ancestorToStopAt || container) && shouldUseTransformFromContainer(cont ainer)) {
288 TransformationMatrix t; 288 TransformationMatrix t;
289 getTransformFromContainer(container, LayoutSize(), t); 289 getTransformFromContainer(container, LayoutSize(), t);
290 geometryMap.push(this, t, false, false, false, true, offsetForFixedPosit ion); 290 geometryMap.push(this, t, false, false, false, true, offsetForFixedPosit ion);
291 } else { 291 } else {
292 geometryMap.push(this, offset, false, false, false, false, offsetForFixe dPosition); 292 geometryMap.push(this, offset, false, false, false, false, offsetForFixe dPosition);
293 } 293 }
294 294
295 return container; 295 return container;
296 } 296 }
297 297
298 void RenderView::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformStat e& transformState) const 298 void RenderView::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformStat e& transformState) const
299 { 299 {
300 if (mode & IsFixed && m_frameView) 300 if (mode & IsFixed && m_frameView)
301 transformState.move(m_frameView->scrollOffsetForFixedPosition()); 301 transformState.move(m_frameView->scrollOffsetForViewportConstrainedObjec ts());
302 302
303 if (mode & UseTransforms && shouldUseTransformFromContainer(0)) { 303 if (mode & UseTransforms && shouldUseTransformFromContainer(0)) {
304 TransformationMatrix t; 304 TransformationMatrix t;
305 getTransformFromContainer(0, LayoutSize(), t); 305 getTransformFromContainer(0, LayoutSize(), t);
306 transformState.applyTransform(t); 306 transformState.applyTransform(t);
307 } 307 }
308 } 308 }
309 309
310 void RenderView::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layout Point&) const 310 void RenderView::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layout Point&) const
311 { 311 {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 obj->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); 413 obj->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0);
414 } 414 }
415 } 415 }
416 416
417 void RenderView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst rainedPosition viewportConstraint) const 417 void RenderView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst rainedPosition viewportConstraint) const
418 { 418 {
419 if (viewportConstraint != IsFixedPosition) 419 if (viewportConstraint != IsFixedPosition)
420 return; 420 return;
421 421
422 if (m_frameView) { 422 if (m_frameView) {
423 rect.move(m_frameView->scrollOffsetForFixedPosition()); 423 rect.move(m_frameView->scrollOffsetForViewportConstrainedObjects());
424 424
425 // FIXME: Paint invalidation should happen after scroll updates, so ther e should be no pending scroll delta. 425 // FIXME: Paint invalidation should happen after scroll updates, so ther e should be no pending scroll delta.
426 // However, we still have paint invalidation during layout, so we can't ASSERT for now. crbug.com/434950. 426 // However, we still have paint invalidation during layout, so we can't ASSERT for now. crbug.com/434950.
427 // ASSERT(m_frameView->pendingScrollDelta().isZero()); 427 // ASSERT(m_frameView->pendingScrollDelta().isZero());
428 // If we have a pending scroll, invalidate the previous scroll position. 428 // If we have a pending scroll, invalidate the previous scroll position.
429 if (!m_frameView->pendingScrollDelta().isZero()) 429 if (!m_frameView->pendingScrollDelta().isZero())
430 rect.move(-LayoutSize(m_frameView->pendingScrollDelta())); 430 rect.move(-LayoutSize(m_frameView->pendingScrollDelta()));
431 } 431 }
432 } 432 }
433 433
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 return viewWidth(IncludeScrollbars) / scale; 975 return viewWidth(IncludeScrollbars) / scale;
976 } 976 }
977 977
978 double RenderView::layoutViewportHeight() const 978 double RenderView::layoutViewportHeight() const
979 { 979 {
980 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 980 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
981 return viewHeight(IncludeScrollbars) / scale; 981 return viewHeight(IncludeScrollbars) / scale;
982 } 982 }
983 983
984 } // namespace blink 984 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayerClipper.cpp ('k') | Source/web/FindInPageCoordinates.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698