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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutView.cpp

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 years, 2 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) 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 mode &= ~IsFixed; 330 mode &= ~IsFixed;
331 } 331 }
332 332
333 if (ancestor == this) 333 if (ancestor == this)
334 return; 334 return;
335 335
336 if (mode & TraverseDocumentBoundaries) { 336 if (mode & TraverseDocumentBoundaries) {
337 LayoutPartItem parentDocLayoutItem = frame()->ownerLayoutItem(); 337 LayoutPartItem parentDocLayoutItem = frame()->ownerLayoutItem();
338 if (!parentDocLayoutItem.isNull()) { 338 if (!parentDocLayoutItem.isNull()) {
339 if (!(mode & InputIsInFrameCoordinates)) { 339 if (!(mode & InputIsInFrameCoordinates)) {
340 transformState.move(-frame()->view()->scrollOffset()); 340 transformState.move(LayoutSize(-frame()->view()->scrollOffset()));
341 } else { 341 } else {
342 // The flag applies to immediate LayoutView only. 342 // The flag applies to immediate LayoutView only.
343 mode &= ~InputIsInFrameCoordinates; 343 mode &= ~InputIsInFrameCoordinates;
344 } 344 }
345 345
346 transformState.move(parentDocLayoutItem.contentBoxOffset()); 346 transformState.move(parentDocLayoutItem.contentBoxOffset());
347 347
348 parentDocLayoutItem.mapLocalToAncestor(ancestor, transformState, mode); 348 parentDocLayoutItem.mapLocalToAncestor(ancestor, transformState, mode);
349 } 349 }
350 } 350 }
351 } 351 }
352 352
353 const LayoutObject* LayoutView::pushMappingToContainer( 353 const LayoutObject* LayoutView::pushMappingToContainer(
354 const LayoutBoxModelObject* ancestorToStopAt, 354 const LayoutBoxModelObject* ancestorToStopAt,
355 LayoutGeometryMap& geometryMap) const { 355 LayoutGeometryMap& geometryMap) const {
356 LayoutSize offsetForFixedPosition; 356 LayoutSize offsetForFixedPosition;
357 LayoutSize offset; 357 LayoutSize offset;
358 LayoutObject* container = nullptr; 358 LayoutObject* container = nullptr;
359 359
360 if (m_frameView) { 360 if (m_frameView) {
361 offsetForFixedPosition = 361 offsetForFixedPosition = LayoutSize(m_frameView->scrollOffset());
362 LayoutSize(LayoutSize(m_frameView->scrollOffset()));
363 if (hasOverflowClip()) 362 if (hasOverflowClip())
364 offsetForFixedPosition = LayoutSize(scrolledContentOffset()); 363 offsetForFixedPosition = LayoutSize(scrolledContentOffset());
365 } 364 }
366 365
367 if (geometryMap.getMapCoordinatesFlags() & TraverseDocumentBoundaries) { 366 if (geometryMap.getMapCoordinatesFlags() & TraverseDocumentBoundaries) {
368 if (LayoutPart* parentDocLayoutObject = toLayoutPart( 367 if (LayoutPart* parentDocLayoutObject = toLayoutPart(
369 LayoutAPIShim::layoutObjectFrom(frame()->ownerLayoutItem()))) { 368 LayoutAPIShim::layoutObjectFrom(frame()->ownerLayoutItem()))) {
370 offset = -LayoutSize(m_frameView->scrollOffset()); 369 offset = -LayoutSize(m_frameView->scrollOffset());
371 offset += parentDocLayoutObject->contentBoxOffset(); 370 offset += parentDocLayoutObject->contentBoxOffset();
372 container = parentDocLayoutObject; 371 container = parentDocLayoutObject;
(...skipping 23 matching lines...) Expand all
396 return; 395 return;
397 396
398 if (mode & TraverseDocumentBoundaries) { 397 if (mode & TraverseDocumentBoundaries) {
399 if (LayoutPart* parentDocLayoutObject = toLayoutPart( 398 if (LayoutPart* parentDocLayoutObject = toLayoutPart(
400 LayoutAPIShim::layoutObjectFrom(frame()->ownerLayoutItem()))) { 399 LayoutAPIShim::layoutObjectFrom(frame()->ownerLayoutItem()))) {
401 // A LayoutView is a containing block for fixed-position elements, so don' t carry this state across frames. 400 // A LayoutView is a containing block for fixed-position elements, so don' t carry this state across frames.
402 parentDocLayoutObject->mapAncestorToLocal(ancestor, transformState, 401 parentDocLayoutObject->mapAncestorToLocal(ancestor, transformState,
403 mode & ~IsFixed); 402 mode & ~IsFixed);
404 403
405 transformState.move(parentDocLayoutObject->contentBoxOffset()); 404 transformState.move(parentDocLayoutObject->contentBoxOffset());
406 transformState.move(-frame()->view()->scrollOffset()); 405 transformState.move(LayoutSize(-frame()->view()->scrollOffset()));
407 } 406 }
408 } else { 407 } else {
409 ASSERT(!ancestor); 408 ASSERT(!ancestor);
410 } 409 }
411 410
412 if (mode & IsFixed) 411 if (mode & IsFixed)
413 transformState.move(frame()->view()->scrollOffset()); 412 transformState.move(LayoutSize(frame()->view()->scrollOffset()));
414 } 413 }
415 414
416 void LayoutView::computeSelfHitTestRects(Vector<LayoutRect>& rects, 415 void LayoutView::computeSelfHitTestRects(Vector<LayoutRect>& rects,
417 const LayoutPoint&) const { 416 const LayoutPoint&) const {
418 // Record the entire size of the contents of the frame. Note that we don't jus t 417 // Record the entire size of the contents of the frame. Note that we don't jus t
419 // use the viewport size (containing block) here because we want to ensure thi s includes 418 // use the viewport size (containing block) here because we want to ensure thi s includes
420 // all children (so we can avoid walking them explicitly). 419 // all children (so we can avoid walking them explicitly).
421 rects.append( 420 rects.append(
422 LayoutRect(LayoutPoint::zero(), LayoutSize(frameView()->contentsSize()))); 421 LayoutRect(LayoutPoint::zero(), LayoutSize(frameView()->contentsSize())));
423 } 422 }
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 if (block) 1034 if (block)
1036 block->adjustChildDebugRect(rect); 1035 block->adjustChildDebugRect(rect);
1037 1036
1038 rect.setWidth(LayoutUnit(viewWidth(IncludeScrollbars))); 1037 rect.setWidth(LayoutUnit(viewWidth(IncludeScrollbars)));
1039 rect.setHeight(LayoutUnit(viewHeight(IncludeScrollbars))); 1038 rect.setHeight(LayoutUnit(viewHeight(IncludeScrollbars)));
1040 1039
1041 return rect; 1040 return rect;
1042 } 1041 }
1043 1042
1044 } // namespace blink 1043 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698