OLD | NEW |
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // Ditto when not in compositing mode. | 307 // Ditto when not in compositing mode. |
308 if (!usesCompositing()) | 308 if (!usesCompositing()) |
309 return LayoutBlockFlow::visualOverflowRect(); | 309 return LayoutBlockFlow::visualOverflowRect(); |
310 | 310 |
311 // In normal compositing mode, LayoutView doesn't actually apply clipping | 311 // In normal compositing mode, LayoutView doesn't actually apply clipping |
312 // on its descendants. Instead their visual overflow is propagated to | 312 // on its descendants. Instead their visual overflow is propagated to |
313 // compositor()->m_rootContentLayer for accelerated scrolling. | 313 // compositor()->m_rootContentLayer for accelerated scrolling. |
314 return LayoutRect(documentRect()); | 314 return LayoutRect(documentRect()); |
315 } | 315 } |
316 | 316 |
317 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati
onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was
Fixed, const PaintInvalidationState* paintInvalidationState) const | 317 void LayoutView::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transf
ormState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintI
nvalidationState* paintInvalidationState) const |
318 { | 318 { |
319 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); | 319 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); |
320 | 320 |
321 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor
mFromContainer(0)) { | 321 if (!ancestor && mode & UseTransforms && shouldUseTransformFromContainer(0))
{ |
322 TransformationMatrix t; | 322 TransformationMatrix t; |
323 getTransformFromContainer(0, LayoutSize(), t); | 323 getTransformFromContainer(0, LayoutSize(), t); |
324 transformState.applyTransform(t); | 324 transformState.applyTransform(t); |
325 } | 325 } |
326 | 326 |
327 if ((mode & IsFixed) && m_frameView) { | 327 if ((mode & IsFixed) && m_frameView) { |
328 transformState.move(toIntSize(m_frameView->scrollPosition())); | 328 transformState.move(toIntSize(m_frameView->scrollPosition())); |
329 if (hasOverflowClip()) | 329 if (hasOverflowClip()) |
330 transformState.move(scrolledContentOffset()); | 330 transformState.move(scrolledContentOffset()); |
331 // IsFixed flag is only applicable within this LayoutView. | 331 // IsFixed flag is only applicable within this LayoutView. |
332 mode &= ~IsFixed; | 332 mode &= ~IsFixed; |
333 } | 333 } |
334 | 334 |
335 if (paintInvalidationContainer == this) | 335 if (ancestor == this) |
336 return; | 336 return; |
337 | 337 |
338 if (mode & TraverseDocumentBoundaries) { | 338 if (mode & TraverseDocumentBoundaries) { |
339 if (LayoutPart* parentDocLayoutObject = frame()->ownerLayoutObject()) { | 339 if (LayoutPart* parentDocLayoutObject = frame()->ownerLayoutObject()) { |
340 transformState.move(-frame()->view()->scrollOffset()); | 340 transformState.move(-frame()->view()->scrollOffset()); |
341 transformState.move(parentDocLayoutObject->contentBoxOffset()); | 341 transformState.move(parentDocLayoutObject->contentBoxOffset()); |
342 | 342 |
343 parentDocLayoutObject->mapLocalToContainer(paintInvalidationContaine
r, transformState, mode, wasFixed, paintInvalidationState); | 343 parentDocLayoutObject->mapLocalToAncestor(ancestor, transformState,
mode, wasFixed, paintInvalidationState); |
344 } | 344 } |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 const LayoutObject* LayoutView::pushMappingToContainer(const LayoutBoxModelObjec
t* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 348 const LayoutObject* LayoutView::pushMappingToContainer(const LayoutBoxModelObjec
t* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
349 { | 349 { |
350 LayoutSize offsetForFixedPosition; | 350 LayoutSize offsetForFixedPosition; |
351 LayoutSize offset; | 351 LayoutSize offset; |
352 LayoutObject* container = nullptr; | 352 LayoutObject* container = nullptr; |
353 | 353 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 { | 451 { |
452 setShouldDoFullPaintInvalidation(); | 452 setShouldDoFullPaintInvalidation(); |
453 | 453 |
454 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. | 454 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. |
455 DisableCompositingQueryAsserts disabler; | 455 DisableCompositingQueryAsserts disabler; |
456 | 456 |
457 if (compositor()->inCompositingMode()) | 457 if (compositor()->inCompositingMode()) |
458 compositor()->fullyInvalidatePaint(); | 458 compositor()->fullyInvalidatePaint(); |
459 } | 459 } |
460 | 460 |
461 void LayoutView::mapToVisibleRectInContainerSpace(const LayoutBoxModelObject* pa
intInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* invali
dationState) const | 461 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect, const PaintInvalidationState* invalidationState) const |
462 { | 462 { |
463 mapToVisibleRectInContainerSpace(paintInvalidationContainer, rect, IsNotFixe
dPosition, invalidationState); | 463 mapToVisibleRectInAncestorSpace(ancestor, rect, IsNotFixedPosition, invalida
tionState); |
464 } | 464 } |
465 | 465 |
466 void LayoutView::mapToVisibleRectInContainerSpace(const LayoutBoxModelObject* pa
intInvalidationContainer, LayoutRect& rect, ViewportConstrainedPosition viewport
Constraint, const PaintInvalidationState* state) const | 466 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect, ViewportConstrainedPosition viewportConstraint, const P
aintInvalidationState* state) const |
467 { | 467 { |
468 if (document().printing()) | 468 if (document().printing()) |
469 return; | 469 return; |
470 | 470 |
471 if (style()->isFlippedBlocksWritingMode()) { | 471 if (style()->isFlippedBlocksWritingMode()) { |
472 // We have to flip by hand since the view's logical height has not been
determined. We | 472 // We have to flip by hand since the view's logical height has not been
determined. We |
473 // can use the viewport width and height. | 473 // can use the viewport width and height. |
474 if (style()->isHorizontalWritingMode()) | 474 if (style()->isHorizontalWritingMode()) |
475 rect.setY(viewHeight() - rect.maxY()); | 475 rect.setY(viewHeight() - rect.maxY()); |
476 else | 476 else |
477 rect.setX(viewWidth() - rect.maxX()); | 477 rect.setX(viewWidth() - rect.maxX()); |
478 } | 478 } |
479 | 479 |
480 adjustViewportConstrainedOffset(rect, viewportConstraint); | 480 adjustViewportConstrainedOffset(rect, viewportConstraint); |
481 | 481 |
482 // Apply our transform if we have one (because of full page zooming). | 482 // Apply our transform if we have one (because of full page zooming). |
483 if (!paintInvalidationContainer && layer() && layer()->transform()) | 483 if (!ancestor && layer() && layer()->transform()) |
484 rect = layer()->transform()->mapRect(rect); | 484 rect = layer()->transform()->mapRect(rect); |
485 | 485 |
486 ASSERT(paintInvalidationContainer); | 486 ASSERT(ancestor); |
487 if (paintInvalidationContainer == this) | 487 if (ancestor == this) |
488 return; | 488 return; |
489 | 489 |
490 Element* owner = document().ownerElement(); | 490 Element* owner = document().ownerElement(); |
491 if (!owner) | 491 if (!owner) |
492 return; | 492 return; |
493 | 493 |
494 if (LayoutBox* obj = owner->layoutBox()) { | 494 if (LayoutBox* obj = owner->layoutBox()) { |
495 if (!state || !state->viewClippingAndScrollOffsetDisabled()) { | 495 if (!state || !state->viewClippingAndScrollOffsetDisabled()) { |
496 // Intersect the viewport with the paint invalidation rect. | 496 // Intersect the viewport with the paint invalidation rect. |
497 LayoutRect viewRectangle = viewRect(); | 497 LayoutRect viewRectangle = viewRect(); |
498 rect.intersect(viewRectangle); | 498 rect.intersect(viewRectangle); |
499 | 499 |
500 // Adjust for scroll offset of the view. | 500 // Adjust for scroll offset of the view. |
501 rect.moveBy(-viewRectangle.location()); | 501 rect.moveBy(-viewRectangle.location()); |
502 } | 502 } |
503 | 503 |
504 // Adjust for frame border. | 504 // Adjust for frame border. |
505 rect.move(obj->contentBoxOffset()); | 505 rect.move(obj->contentBoxOffset()); |
506 obj->mapToVisibleRectInContainerSpace(paintInvalidationContainer, rect,
0); | 506 obj->mapToVisibleRectInAncestorSpace(ancestor, rect, 0); |
507 } | 507 } |
508 } | 508 } |
509 | 509 |
510 void LayoutView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst
rainedPosition viewportConstraint) const | 510 void LayoutView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst
rainedPosition viewportConstraint) const |
511 { | 511 { |
512 if (viewportConstraint != IsFixedPosition) | 512 if (viewportConstraint != IsFixedPosition) |
513 return; | 513 return; |
514 | 514 |
515 if (m_frameView) { | 515 if (m_frameView) { |
516 rect.move(toIntSize(m_frameView->scrollPosition())); | 516 rect.move(toIntSize(m_frameView->scrollPosition())); |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 } | 998 } |
999 | 999 |
1000 void LayoutView::sendMediaPositionChangeNotifications(const IntRect& visibleRect
) | 1000 void LayoutView::sendMediaPositionChangeNotifications(const IntRect& visibleRect
) |
1001 { | 1001 { |
1002 for (auto& media : m_mediaForPositionNotification) { | 1002 for (auto& media : m_mediaForPositionNotification) { |
1003 media->notifyPositionMayHaveChanged(visibleRect); | 1003 media->notifyPositionMayHaveChanged(visibleRect); |
1004 } | 1004 } |
1005 } | 1005 } |
1006 | 1006 |
1007 } // namespace blink | 1007 } // namespace blink |
OLD | NEW |