| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 double m_start; | 81 double m_start; |
| 82 bool m_allowsChildFrameContent; | 82 bool m_allowsChildFrameContent; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace | 85 } // namespace |
| 86 | 86 |
| 87 bool LayoutView::s_viewClippingAndScrollOffsetDisabled = false; |
| 88 |
| 87 LayoutView::LayoutView(Document* document) | 89 LayoutView::LayoutView(Document* document) |
| 88 : LayoutBlockFlow(document) | 90 : LayoutBlockFlow(document) |
| 89 , m_frameView(document->view()) | 91 , m_frameView(document->view()) |
| 90 , m_selectionStart(nullptr) | 92 , m_selectionStart(nullptr) |
| 91 , m_selectionEnd(nullptr) | 93 , m_selectionEnd(nullptr) |
| 92 , m_selectionStartPos(-1) | 94 , m_selectionStartPos(-1) |
| 93 , m_selectionEndPos(-1) | 95 , m_selectionEndPos(-1) |
| 94 , m_pageLogicalHeight(0) | 96 , m_pageLogicalHeight(0) |
| 95 , m_pageLogicalHeightChanged(false) | 97 , m_pageLogicalHeightChanged(false) |
| 96 , m_layoutState(nullptr) | 98 , m_layoutState(nullptr) |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // Ditto when not in compositing mode. | 318 // Ditto when not in compositing mode. |
| 317 if (!usesCompositing()) | 319 if (!usesCompositing()) |
| 318 return LayoutBlockFlow::visualOverflowRect(); | 320 return LayoutBlockFlow::visualOverflowRect(); |
| 319 | 321 |
| 320 // In normal compositing mode, LayoutView doesn't actually apply clipping | 322 // In normal compositing mode, LayoutView doesn't actually apply clipping |
| 321 // on its descendants. Instead their visual overflow is propagated to | 323 // on its descendants. Instead their visual overflow is propagated to |
| 322 // compositor()->m_rootContentLayer for accelerated scrolling. | 324 // compositor()->m_rootContentLayer for accelerated scrolling. |
| 323 return LayoutRect(documentRect()); | 325 return LayoutRect(documentRect()); |
| 324 } | 326 } |
| 325 | 327 |
| 326 void LayoutView::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transf
ormState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintI
nvalidationState* paintInvalidationState) const | 328 void LayoutView::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transf
ormState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const |
| 327 { | 329 { |
| 328 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); | 330 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); |
| 329 | 331 |
| 330 if (!ancestor && mode & UseTransforms && shouldUseTransformFromContainer(0))
{ | 332 if (!ancestor && mode & UseTransforms && shouldUseTransformFromContainer(0))
{ |
| 331 TransformationMatrix t; | 333 TransformationMatrix t; |
| 332 getTransformFromContainer(0, LayoutSize(), t); | 334 getTransformFromContainer(0, LayoutSize(), t); |
| 333 transformState.applyTransform(t); | 335 transformState.applyTransform(t); |
| 334 } | 336 } |
| 335 | 337 |
| 336 if ((mode & IsFixed) && m_frameView) { | 338 if ((mode & IsFixed) && m_frameView) { |
| 337 transformState.move(toIntSize(m_frameView->scrollPosition())); | 339 transformState.move(toIntSize(m_frameView->scrollPosition())); |
| 338 if (hasOverflowClip()) | 340 if (hasOverflowClip()) |
| 339 transformState.move(scrolledContentOffset()); | 341 transformState.move(scrolledContentOffset()); |
| 340 // IsFixed flag is only applicable within this LayoutView. | 342 // IsFixed flag is only applicable within this LayoutView. |
| 341 mode &= ~IsFixed; | 343 mode &= ~IsFixed; |
| 342 } | 344 } |
| 343 | 345 |
| 344 if (ancestor == this) | 346 if (ancestor == this) |
| 345 return; | 347 return; |
| 346 | 348 |
| 347 if (mode & TraverseDocumentBoundaries) { | 349 if (mode & TraverseDocumentBoundaries) { |
| 348 if (LayoutPart* parentDocLayoutObject = frame()->ownerLayoutObject()) { | 350 if (LayoutPart* parentDocLayoutObject = frame()->ownerLayoutObject()) { |
| 349 transformState.move(-frame()->view()->scrollOffset()); | 351 if (!s_viewClippingAndScrollOffsetDisabled) |
| 352 transformState.move(-frame()->view()->scrollOffset()); |
| 350 transformState.move(parentDocLayoutObject->contentBoxOffset()); | 353 transformState.move(parentDocLayoutObject->contentBoxOffset()); |
| 351 | 354 |
| 352 parentDocLayoutObject->mapLocalToAncestor(ancestor, transformState,
mode, wasFixed, paintInvalidationState); | 355 parentDocLayoutObject->mapLocalToAncestor(ancestor, transformState,
mode, wasFixed); |
| 353 } | 356 } |
| 354 } | 357 } |
| 355 } | 358 } |
| 356 | 359 |
| 357 const LayoutObject* LayoutView::pushMappingToContainer(const LayoutBoxModelObjec
t* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 360 const LayoutObject* LayoutView::pushMappingToContainer(const LayoutBoxModelObjec
t* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
| 358 { | 361 { |
| 359 LayoutSize offsetForFixedPosition; | 362 LayoutSize offsetForFixedPosition; |
| 360 LayoutSize offset; | 363 LayoutSize offset; |
| 361 LayoutObject* container = nullptr; | 364 LayoutObject* container = nullptr; |
| 362 | 365 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 440 |
| 438 void LayoutView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) | 441 void LayoutView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) |
| 439 { | 442 { |
| 440 ASSERT(!needsLayout()); | 443 ASSERT(!needsLayout()); |
| 441 | 444 |
| 442 // We specifically need to issue paint invalidations for the viewRect since
other layoutObjects | 445 // We specifically need to issue paint invalidations for the viewRect since
other layoutObjects |
| 443 // short-circuit on full-paint invalidation. | 446 // short-circuit on full-paint invalidation. |
| 444 LayoutRect dirtyRect = viewRect(); | 447 LayoutRect dirtyRect = viewRect(); |
| 445 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { | 448 if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) { |
| 446 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidati
onState.paintInvalidationContainer(); | 449 const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidati
onState.paintInvalidationContainer(); |
| 447 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationCo
ntainer, dirtyRect, &paintInvalidationState); | 450 paintInvalidationState.mapLocalRectToPaintInvalidationBacking(dirtyRect)
; |
| 448 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Pai
ntInvalidationFull); | 451 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Pai
ntInvalidationFull); |
| 449 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation
Container, paintInvalidationState, PaintInvalidationFull); | 452 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation
Container, paintInvalidationState, PaintInvalidationFull); |
| 450 } | 453 } |
| 451 LayoutBlock::invalidateTreeIfNeeded(paintInvalidationState); | 454 LayoutBlock::invalidateTreeIfNeeded(paintInvalidationState); |
| 452 } | 455 } |
| 453 | 456 |
| 454 static void setShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(Lay
outObject* object) | 457 static void setShouldDoFullPaintInvalidationForViewAndAllDescendantsInternal(Lay
outObject* object) |
| 455 { | 458 { |
| 456 object->setShouldDoFullPaintInvalidation(); | 459 object->setShouldDoFullPaintInvalidation(); |
| 457 for (LayoutObject* child = object->slowFirstChild(); child; child = child->n
extSibling()) { | 460 for (LayoutObject* child = object->slowFirstChild(); child; child = child->n
extSibling()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 468 { | 471 { |
| 469 setShouldDoFullPaintInvalidation(); | 472 setShouldDoFullPaintInvalidation(); |
| 470 | 473 |
| 471 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. | 474 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. |
| 472 DisableCompositingQueryAsserts disabler; | 475 DisableCompositingQueryAsserts disabler; |
| 473 | 476 |
| 474 if (compositor()->inCompositingMode()) | 477 if (compositor()->inCompositingMode()) |
| 475 compositor()->fullyInvalidatePaint(); | 478 compositor()->fullyInvalidatePaint(); |
| 476 } | 479 } |
| 477 | 480 |
| 478 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect, const PaintInvalidationState* invalidationState) const | 481 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect) const |
| 479 { | 482 { |
| 480 mapToVisibleRectInAncestorSpace(ancestor, rect, IsNotFixedPosition, invalida
tionState); | 483 mapToVisibleRectInAncestorSpace(ancestor, rect, IsNotFixedPosition); |
| 481 } | 484 } |
| 482 | 485 |
| 483 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect, ViewportConstrainedPosition viewportConstraint, | 486 void LayoutView::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* anc
estor, LayoutRect& rect, ViewportConstrainedPosition viewportConstraint) const |
| 484 const PaintInvalidationState* paintInvalidationState) const | |
| 485 { | 487 { |
| 486 if (document().printing()) | 488 if (document().printing()) |
| 487 return; | 489 return; |
| 488 | 490 |
| 489 // TODO(chrishtr): fix PaintInvalidationState offsets for LayoutViews. | 491 // TODO(chrishtr): fix PaintInvalidationState offsets for LayoutViews. |
| 490 | 492 |
| 491 if (style()->isFlippedBlocksWritingMode()) { | 493 if (style()->isFlippedBlocksWritingMode()) { |
| 492 // We have to flip by hand since the view's logical height has not been
determined. We | 494 // 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. | 495 // can use the viewport width and height. |
| 494 if (style()->isHorizontalWritingMode()) | 496 if (style()->isHorizontalWritingMode()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 505 | 507 |
| 506 ASSERT(ancestor); | 508 ASSERT(ancestor); |
| 507 if (ancestor == this) | 509 if (ancestor == this) |
| 508 return; | 510 return; |
| 509 | 511 |
| 510 Element* owner = document().ownerElement(); | 512 Element* owner = document().ownerElement(); |
| 511 if (!owner) | 513 if (!owner) |
| 512 return; | 514 return; |
| 513 | 515 |
| 514 if (LayoutBox* obj = owner->layoutBox()) { | 516 if (LayoutBox* obj = owner->layoutBox()) { |
| 515 if (!paintInvalidationState || !paintInvalidationState->viewClippingAndS
crollOffsetDisabled()) { | 517 if (!s_viewClippingAndScrollOffsetDisabled) { |
| 516 // Intersect the viewport with the paint invalidation rect. | 518 // Intersect the viewport with the paint invalidation rect. |
| 517 LayoutRect viewRectangle = viewRect(); | 519 LayoutRect viewRectangle = viewRect(); |
| 518 rect.intersect(viewRectangle); | 520 rect.intersect(viewRectangle); |
| 519 | 521 |
| 520 // Adjust for scroll offset of the view. | 522 // Adjust for scroll offset of the view. |
| 521 rect.moveBy(-viewRectangle.location()); | 523 rect.moveBy(-viewRectangle.location()); |
| 522 } | 524 } |
| 523 | 525 |
| 524 // Adjust for frame border. | 526 // Adjust for frame border. |
| 525 rect.move(obj->contentBoxOffset()); | 527 rect.move(obj->contentBoxOffset()); |
| 526 obj->mapToVisibleRectInAncestorSpace(ancestor, rect, 0); | 528 obj->mapToVisibleRectInAncestorSpace(ancestor, rect); |
| 527 } | 529 } |
| 528 } | 530 } |
| 529 | 531 |
| 530 void LayoutView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst
rainedPosition viewportConstraint) const | 532 void LayoutView::adjustViewportConstrainedOffset(LayoutRect& rect, ViewportConst
rainedPosition viewportConstraint) const |
| 531 { | 533 { |
| 532 if (viewportConstraint != IsFixedPosition) | 534 if (viewportConstraint != IsFixedPosition) |
| 533 return; | 535 return; |
| 534 | 536 |
| 535 if (m_frameView) { | 537 if (m_frameView) { |
| 536 rect.move(toIntSize(m_frameView->scrollPosition())); | 538 rect.move(toIntSize(m_frameView->scrollPosition())); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 | 1032 |
| 1031 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize&
delta) | 1033 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize&
delta) |
| 1032 { | 1034 { |
| 1033 if (!frameView()) | 1035 if (!frameView()) |
| 1034 return ScrollResult(); | 1036 return ScrollResult(); |
| 1035 | 1037 |
| 1036 return frame()->applyScrollDelta(granularity, delta, false); | 1038 return frame()->applyScrollDelta(granularity, delta, false); |
| 1037 } | 1039 } |
| 1038 | 1040 |
| 1039 } // namespace blink | 1041 } // namespace blink |
| OLD | NEW |