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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // Ditto when not in compositing mode. | 316 // Ditto when not in compositing mode. |
317 if (!usesCompositing()) | 317 if (!usesCompositing()) |
318 return LayoutBlockFlow::visualOverflowRect(); | 318 return LayoutBlockFlow::visualOverflowRect(); |
319 | 319 |
320 // In normal compositing mode, LayoutView doesn't actually apply clipping | 320 // In normal compositing mode, LayoutView doesn't actually apply clipping |
321 // on its descendants. Instead their visual overflow is propagated to | 321 // on its descendants. Instead their visual overflow is propagated to |
322 // compositor()->m_rootContentLayer for accelerated scrolling. | 322 // compositor()->m_rootContentLayer for accelerated scrolling. |
323 return LayoutRect(documentRect()); | 323 return LayoutRect(documentRect()); |
324 } | 324 } |
325 | 325 |
326 void LayoutView::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transf
ormState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintI
nvalidationState* paintInvalidationState) const | 326 void LayoutView::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transf
ormState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const |
327 { | 327 { |
328 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); | 328 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); |
329 | 329 |
330 if (!ancestor && mode & UseTransforms && shouldUseTransformFromContainer(0))
{ | 330 if (!ancestor && mode & UseTransforms && shouldUseTransformFromContainer(0))
{ |
331 TransformationMatrix t; | 331 TransformationMatrix t; |
332 getTransformFromContainer(0, LayoutSize(), t); | 332 getTransformFromContainer(0, LayoutSize(), t); |
333 transformState.applyTransform(t); | 333 transformState.applyTransform(t); |
334 } | 334 } |
335 | 335 |
336 if ((mode & IsFixed) && m_frameView) { | 336 if ((mode & IsFixed) && m_frameView) { |
337 transformState.move(toIntSize(m_frameView->scrollPosition())); | 337 transformState.move(toIntSize(m_frameView->scrollPosition())); |
338 if (hasOverflowClip()) | 338 if (hasOverflowClip()) |
339 transformState.move(scrolledContentOffset()); | 339 transformState.move(scrolledContentOffset()); |
340 // IsFixed flag is only applicable within this LayoutView. | 340 // IsFixed flag is only applicable within this LayoutView. |
341 mode &= ~IsFixed; | 341 mode &= ~IsFixed; |
342 } | 342 } |
343 | 343 |
344 if (ancestor == this) | 344 if (ancestor == this) |
345 return; | 345 return; |
346 | 346 |
347 if (mode & TraverseDocumentBoundaries) { | 347 if (mode & TraverseDocumentBoundaries) { |
348 if (LayoutPart* parentDocLayoutObject = frame()->ownerLayoutObject()) { | 348 if (LayoutPart* parentDocLayoutObject = frame()->ownerLayoutObject()) { |
349 transformState.move(-frame()->view()->scrollOffset()); | 349 if (!(mode & DontApplyFrameScrollOffsetAndClip)) |
| 350 transformState.move(-frame()->view()->scrollOffset()); |
350 transformState.move(parentDocLayoutObject->contentBoxOffset()); | 351 transformState.move(parentDocLayoutObject->contentBoxOffset()); |
351 | 352 |
352 parentDocLayoutObject->mapLocalToAncestor(ancestor, transformState,
mode, wasFixed, paintInvalidationState); | 353 parentDocLayoutObject->mapLocalToAncestor(ancestor, transformState,
mode, wasFixed); |
353 } | 354 } |
354 } | 355 } |
355 } | 356 } |
356 | 357 |
357 const LayoutObject* LayoutView::pushMappingToContainer(const LayoutBoxModelObjec
t* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 358 const LayoutObject* LayoutView::pushMappingToContainer(const LayoutBoxModelObjec
t* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
358 { | 359 { |
359 LayoutSize offsetForFixedPosition; | 360 LayoutSize offsetForFixedPosition; |
360 LayoutSize offset; | 361 LayoutSize offset; |
361 LayoutObject* container = nullptr; | 362 LayoutObject* container = nullptr; |
362 | 363 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 438 |
438 void LayoutView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) | 439 void LayoutView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) |
439 { | 440 { |
440 ASSERT(!needsLayout()); | 441 ASSERT(!needsLayout()); |
441 | 442 |
442 // We specifically need to issue paint invalidations for the viewRect since
other layoutObjects | 443 // We specifically need to issue paint invalidations for the viewRect since
other layoutObjects |
443 // short-circuit on full-paint invalidation. | 444 // short-circuit on full-paint invalidation. |
444 LayoutRect dirtyRect = viewRect(); | 445 LayoutRect dirtyRect = viewRect(); |
445 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { | 446 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { |
446 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidati
onState.paintInvalidationContainer(); | 447 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidati
onState.paintInvalidationContainer(); |
447 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationCo
ntainer, dirtyRect, &paintInvalidationState); | 448 paintInvalidationState.mapLocalRectToPaintInvalidationBacking(dirtyRect)
; |
448 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Pai
ntInvalidationFull); | 449 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Pai
ntInvalidationFull); |
449 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation
Container, paintInvalidationState, PaintInvalidationFull); | 450 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation
Container, paintInvalidationState, PaintInvalidationFull); |
450 } | 451 } |
451 LayoutBlock::invalidateTreeIfNeeded(paintInvalidationState); | 452 LayoutBlock::invalidateTreeIfNeeded(paintInvalidationState); |
452 } | 453 } |
453 | 454 |
454 static void setShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(Lay
outObject* object) | 455 static void setShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(Lay
outObject* object) |
455 { | 456 { |
456 object->setShouldDoFullPaintInvalidation(); | 457 object->setShouldDoFullPaintInvalidation(); |
457 for (LayoutObject* child = object->slowFirstChild(); child; child = child->n
extSibling()) { | 458 for (LayoutObject* child = object->slowFirstChild(); child; child = child->n
extSibling()) { |
(...skipping 10 matching lines...) Expand all Loading... |
468 { | 469 { |
469 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 470 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
470 | 471 |
471 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. | 472 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. |
472 DisableCompositingQueryAsserts disabler; | 473 DisableCompositingQueryAsserts disabler; |
473 | 474 |
474 if (compositor()->inCompositingMode()) | 475 if (compositor()->inCompositingMode()) |
475 compositor()->fullyInvalidatePaint(); | 476 compositor()->fullyInvalidatePaint(); |
476 } | 477 } |
477 | 478 |
478 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect, const PaintInvalidationState* invalidationState) const | 479 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect) const |
479 { | 480 { |
480 mapToVisibleRectInAncestorSpace(ancestor, rect, IsNotFixedPosition, invalida
tionState); | 481 mapToVisibleRectInAncestorSpace(ancestor, rect, 0); |
481 } | 482 } |
482 | 483 |
483 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect, ViewportConstrainedPosition viewportConstraint, | 484 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect, MapCoordinatesFlags mode) const |
484 const PaintInvalidationState* paintInvalidationState) const | |
485 { | 485 { |
486 if (document().printing()) | 486 if (document().printing()) |
487 return; | 487 return; |
488 | 488 |
489 // TODO(chrishtr): fix PaintInvalidationState offsets for LayoutViews. | |
490 | |
491 if (style()->isFlippedBlocksWritingMode()) { | 489 if (style()->isFlippedBlocksWritingMode()) { |
492 // We have to flip by hand since the view's logical height has not been
determined. We | 490 // 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. | 491 // can use the viewport width and height. |
494 if (style()->isHorizontalWritingMode()) | 492 if (style()->isHorizontalWritingMode()) |
495 rect.setY(viewHeight() - rect.maxY()); | 493 rect.setY(viewHeight() - rect.maxY()); |
496 else | 494 else |
497 rect.setX(viewWidth() - rect.maxX()); | 495 rect.setX(viewWidth() - rect.maxX()); |
498 } | 496 } |
499 | 497 |
500 adjustViewportConstrainedOffset(rect, viewportConstraint); | 498 if (mode & IsFixed) |
| 499 adjustOffsetForFixedPosition(rect); |
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; |
509 | 508 |
510 Element* owner = document().ownerElement(); | 509 Element* owner = document().ownerElement(); |
511 if (!owner) | 510 if (!owner) |
512 return; | 511 return; |
513 | 512 |
514 if (LayoutBox* obj = owner->layoutBox()) { | 513 if (LayoutBox* obj = owner->layoutBox()) { |
515 if (!paintInvalidationState || !paintInvalidationState->viewClippingAndS
crollOffsetDisabled()) { | 514 if (!(mode & DontApplyFrameScrollOffsetAndClip)) { |
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 rect.intersect(viewRectangle); |
519 | 518 |
520 // Adjust for scroll offset of the view. | 519 // Adjust for scroll offset of the view. |
521 rect.moveBy(-viewRectangle.location()); | 520 rect.moveBy(-viewRectangle.location()); |
522 } | 521 } |
523 | 522 |
524 // Adjust for frame border. | 523 // Adjust for frame border. |
525 rect.move(obj->contentBoxOffset()); | 524 rect.move(obj->contentBoxOffset()); |
526 obj->mapToVisibleRectInAncestorSpace(ancestor, rect, 0); | 525 obj->mapToVisibleRectInAncestorSpace(ancestor, rect); |
527 } | 526 } |
528 } | 527 } |
529 | 528 |
530 void LayoutView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst
rainedPosition viewportConstraint) const | 529 void LayoutView::adjustOffsetForFixedPosition(LayoutRect& rect) const |
531 { | 530 { |
532 if (viewportConstraint != IsFixedPosition) | |
533 return; | |
534 | |
535 if (m_frameView) { | 531 if (m_frameView) { |
536 rect.move(toIntSize(m_frameView->scrollPosition())); | 532 rect.move(toIntSize(m_frameView->scrollPosition())); |
537 if (hasOverflowClip()) | 533 if (hasOverflowClip()) |
538 rect.move(scrolledContentOffset()); | 534 rect.move(scrolledContentOffset()); |
539 | 535 |
540 // FIXME: Paint invalidation should happen after scroll updates, so ther
e should be no pending scroll delta. | 536 // FIXME: Paint invalidation should happen after scroll updates, so ther
e should be no pending scroll delta. |
541 // However, we still have paint invalidation during layout, so we can't
ASSERT for now. crbug.com/434950. | 537 // However, we still have paint invalidation during layout, so we can't
ASSERT for now. crbug.com/434950. |
542 // ASSERT(m_frameView->pendingScrollDelta().isZero()); | 538 // ASSERT(m_frameView->pendingScrollDelta().isZero()); |
543 // If we have a pending scroll, invalidate the previous scroll position. | 539 // If we have a pending scroll, invalidate the previous scroll position. |
544 if (!m_frameView->pendingScrollDelta().isZero()) | 540 if (!m_frameView->pendingScrollDelta().isZero()) |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 | 1026 |
1031 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize&
delta) | 1027 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize&
delta) |
1032 { | 1028 { |
1033 if (!frameView()) | 1029 if (!frameView()) |
1034 return ScrollResult(); | 1030 return ScrollResult(); |
1035 | 1031 |
1036 return frame()->applyScrollDelta(granularity, delta, false); | 1032 return frame()->applyScrollDelta(granularity, delta, false); |
1037 } | 1033 } |
1038 | 1034 |
1039 } // namespace blink | 1035 } // namespace blink |
OLD | NEW |