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

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

Issue 1817693002: Support edge-inclusive intersections in mapToVisibleRectInAncestorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer-idle-callback
Patch Set: more tests Created 4 years, 9 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 { 468 {
469 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); 469 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
470 470
471 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen. 471 // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen.
472 DisableCompositingQueryAsserts disabler; 472 DisableCompositingQueryAsserts disabler;
473 473
474 if (compositor()->inCompositingMode()) 474 if (compositor()->inCompositingMode())
475 compositor()->fullyInvalidatePaint(); 475 compositor()->fullyInvalidatePaint();
476 } 476 }
477 477
478 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc estor, LayoutRect& rect, const PaintInvalidationState* invalidationState) const 478 bool LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc estor, LayoutRect& rect, const PaintInvalidationState* invalidationState, Visibl eRectFlags visibleRectFlags) const
479 { 479 {
480 mapToVisibleRectInAncestorSpace(ancestor, rect, IsNotFixedPosition, invalida tionState); 480 return mapToVisibleRectInAncestorSpace(ancestor, rect, IsNotFixedPosition, i nvalidationState, visibleRectFlags);
481 } 481 }
482 482
483 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc estor, LayoutRect& rect, ViewportConstrainedPosition viewportConstraint, 483 bool LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc estor, LayoutRect& rect, ViewportConstrainedPosition viewportConstraint, const P aintInvalidationState* paintInvalidationState, VisibleRectFlags visibleRectFlags ) const
484 const PaintInvalidationState* paintInvalidationState) const
485 { 484 {
486 if (document().printing()) 485 if (document().printing())
487 return; 486 return true;
488 487
489 // TODO(chrishtr): fix PaintInvalidationState offsets for LayoutViews. 488 // TODO(chrishtr): fix PaintInvalidationState offsets for LayoutViews.
490 489
491 if (style()->isFlippedBlocksWritingMode()) { 490 if (style()->isFlippedBlocksWritingMode()) {
492 // We have to flip by hand since the view's logical height has not been determined. We 491 // We have to flip by hand since the view's logical height has not been determined. We
493 // can use the viewport width and height. 492 // can use the viewport width and height.
494 if (style()->isHorizontalWritingMode()) 493 if (style()->isHorizontalWritingMode())
495 rect.setY(viewHeight() - rect.maxY()); 494 rect.setY(viewHeight() - rect.maxY());
496 else 495 else
497 rect.setX(viewWidth() - rect.maxX()); 496 rect.setX(viewWidth() - rect.maxX());
498 } 497 }
499 498
500 adjustViewportConstrainedOffset(rect, viewportConstraint); 499 adjustViewportConstrainedOffset(rect, viewportConstraint);
501 500
502 // Apply our transform if we have one (because of full page zooming). 501 // Apply our transform if we have one (because of full page zooming).
503 if (!ancestor && layer() && layer()->transform()) 502 if (!ancestor && layer() && layer()->transform())
504 rect = layer()->transform()->mapRect(rect); 503 rect = layer()->transform()->mapRect(rect);
505 504
506 ASSERT(ancestor); 505 ASSERT(ancestor);
507 if (ancestor == this) 506 if (ancestor == this)
508 return; 507 return true;
509 508
510 Element* owner = document().ownerElement(); 509 Element* owner = document().ownerElement();
511 if (!owner) 510 if (!owner)
512 return; 511 return true;
513 512
514 if (LayoutBox* obj = owner->layoutBox()) { 513 if (LayoutBox* obj = owner->layoutBox()) {
515 if (!paintInvalidationState || !paintInvalidationState->viewClippingAndS crollOffsetDisabled()) { 514 if (!paintInvalidationState || !paintInvalidationState->viewClippingAndS crollOffsetDisabled()) {
516 // Intersect the viewport with the paint invalidation rect. 515 // Intersect the viewport with the paint invalidation rect.
517 LayoutRect viewRectangle = viewRect(); 516 LayoutRect viewRectangle = viewRect();
518 rect.intersect(viewRectangle); 517 if (visibleRectFlags & EdgeInclusive) {
518 if (!rect.inclusiveIntersect(viewRectangle))
519 return false;
520 } else {
521 rect.intersect(viewRectangle);
522 }
519 523
520 // Adjust for scroll offset of the view. 524 // Adjust for scroll offset of the view.
521 rect.moveBy(-viewRectangle.location()); 525 rect.moveBy(-viewRectangle.location());
522 } 526 }
523 527
524 // Adjust for frame border. 528 // Adjust for frame border.
525 rect.move(obj->contentBoxOffset()); 529 rect.move(obj->contentBoxOffset());
526 obj->mapToVisibleRectInAncestorSpace(ancestor, rect, 0); 530 return obj->mapToVisibleRectInAncestorSpace(ancestor, rect, 0, visibleRe ctFlags);
527 } 531 }
532
533 return true;
528 } 534 }
529 535
530 void LayoutView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst rainedPosition viewportConstraint) const 536 void LayoutView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst rainedPosition viewportConstraint) const
531 { 537 {
532 if (viewportConstraint != IsFixedPosition) 538 if (viewportConstraint != IsFixedPosition)
533 return; 539 return;
534 540
535 if (m_frameView) { 541 if (m_frameView) {
536 rect.move(toIntSize(m_frameView->scrollPosition())); 542 rect.move(toIntSize(m_frameView->scrollPosition()));
537 if (hasOverflowClip()) 543 if (hasOverflowClip())
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 1036
1031 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize& delta) 1037 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize& delta)
1032 { 1038 {
1033 if (!frameView()) 1039 if (!frameView())
1034 return ScrollResult(); 1040 return ScrollResult();
1035 1041
1036 return frame()->applyScrollDelta(granularity, delta, false); 1042 return frame()->applyScrollDelta(granularity, delta, false);
1037 } 1043 }
1038 1044
1039 } // namespace blink 1045 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.h ('k') | third_party/WebKit/Source/core/layout/PaintInvalidationState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698