| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 { | 472 { |
| 473 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 473 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
| 474 | 474 |
| 475 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. | 475 // The only way we know how to hit these ASSERTS below this point is via the
Chromium OS login screen. |
| 476 DisableCompositingQueryAsserts disabler; | 476 DisableCompositingQueryAsserts disabler; |
| 477 | 477 |
| 478 if (compositor()->inCompositingMode()) | 478 if (compositor()->inCompositingMode()) |
| 479 compositor()->fullyInvalidatePaint(); | 479 compositor()->fullyInvalidatePaint(); |
| 480 } | 480 } |
| 481 | 481 |
| 482 bool LayoutView::mapContentRectToFrameSpace(const LayoutBox* contentObject, Layo
utRect& rect, VisualRectFlags visualRectFlags) const |
| 483 { |
| 484 if (document().settings() && document().settings()->rootLayerScrolls()) |
| 485 return true; |
| 486 |
| 487 if (contentObject && contentObject->styleRef().position() == FixedPosition) |
| 488 adjustOffsetForFixedPosition(rect); |
| 489 |
| 490 // Intersect the viewport with the paint invalidation rect. |
| 491 LayoutRect viewRectangle = viewRect(); |
| 492 if (visualRectFlags & EdgeInclusive) { |
| 493 if (!rect.inclusiveIntersect(viewRectangle)) |
| 494 return false; |
| 495 } else { |
| 496 rect.intersect(viewRectangle); |
| 497 if (rect.isEmpty()) |
| 498 return false; |
| 499 } |
| 500 |
| 501 // Adjust for scroll offset of the view. |
| 502 rect.moveBy(-viewRectangle.location()); |
| 503 return true; |
| 504 } |
| 505 |
| 482 bool LayoutView::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ance
stor, LayoutRect& rect, VisualRectFlags visualRectFlags) const | 506 bool LayoutView::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ance
stor, LayoutRect& rect, VisualRectFlags visualRectFlags) const |
| 483 { | 507 { |
| 484 return mapToVisualRectInAncestorSpace(ancestor, rect, 0, visualRectFlags); | |
| 485 } | |
| 486 | |
| 487 bool LayoutView::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ance
stor, LayoutRect& rect, MapCoordinatesFlags mode, VisualRectFlags visualRectFlag
s) const | |
| 488 { | |
| 489 if (document().printing()) | 508 if (document().printing()) |
| 490 return true; | 509 return true; |
| 491 | 510 |
| 492 if (style()->isFlippedBlocksWritingMode()) { | 511 if (style()->isFlippedBlocksWritingMode()) { |
| 493 // We have to flip by hand since the view's logical width has not been d
etermined. We | 512 // We have to flip by hand since the view's logical width has not been d
etermined. We |
| 494 // can use the viewport width. | 513 // can use the viewport width. |
| 495 rect.setX(viewWidth() - rect.maxX()); | 514 rect.setX(viewWidth() - rect.maxX()); |
| 496 } | 515 } |
| 497 | 516 |
| 498 if (mode & IsFixed) | 517 ASSERT(!layer()->transform()); |
| 499 adjustOffsetForFixedPosition(rect); | |
| 500 | |
| 501 // Apply our transform if we have one (because of full page zooming). | |
| 502 if (!ancestor && layer() && layer()->transform()) | |
| 503 rect = layer()->transform()->mapRect(rect); | |
| 504 | 518 |
| 505 ASSERT(ancestor); | 519 ASSERT(ancestor); |
| 506 if (ancestor == this) | 520 if (ancestor == this) |
| 507 return true; | 521 return true; |
| 508 | 522 |
| 509 Element* owner = document().ownerElement(); | 523 if (LayoutPart* owner = frame()->ownerLayoutObject()) { |
| 510 if (!owner) | |
| 511 return true; | |
| 512 | |
| 513 if (LayoutBox* obj = owner->layoutBox()) { | |
| 514 if (!(mode & InputIsInFrameCoordinates)) { | |
| 515 // Intersect the viewport with the paint invalidation rect. | |
| 516 LayoutRect viewRectangle = viewRect(); | |
| 517 if (visualRectFlags & EdgeInclusive) { | |
| 518 if (!rect.inclusiveIntersect(viewRectangle)) | |
| 519 return false; | |
| 520 } else { | |
| 521 rect.intersect(viewRectangle); | |
| 522 } | |
| 523 | |
| 524 // Adjust for scroll offset of the view. | |
| 525 rect.moveBy(-viewRectangle.location()); | |
| 526 } | |
| 527 // Frames are painted at rounded-int position. Since we cannot efficient
ly compute the subpixel offset | 524 // Frames are painted at rounded-int position. Since we cannot efficient
ly compute the subpixel offset |
| 528 // of painting at this point in a a bottom-up walk, round to the enclosi
ng int rect, which will enclose | 525 // of painting at this point in a a bottom-up walk, round to the enclosi
ng int rect, which will enclose |
| 529 // the actual visible rect. | 526 // the actual visible rect. |
| 530 rect = LayoutRect(enclosingIntRect(rect)); | 527 rect = LayoutRect(enclosingIntRect(rect)); |
| 531 | 528 |
| 532 // Adjust for frame border. | 529 // Adjust for frame border. |
| 533 rect.move(obj->contentBoxOffset()); | 530 rect.move(owner->contentBoxOffset()); |
| 534 return obj->mapToVisualRectInAncestorSpace(ancestor, rect, visualRectFla
gs); | 531 return owner->mapToVisualRectInAncestorSpace(ancestor, rect, visualRectF
lags); |
| 535 } | 532 } |
| 536 | 533 |
| 537 return true; | 534 return true; |
| 538 } | 535 } |
| 539 | 536 |
| 540 void LayoutView::adjustOffsetForFixedPosition(LayoutRect& rect) const | 537 void LayoutView::adjustOffsetForFixedPosition(LayoutRect& rect) const |
| 541 { | 538 { |
| 542 if (m_frameView) { | 539 if (m_frameView) { |
| 543 rect.move(toIntSize(m_frameView->scrollPosition())); | 540 rect.move(toIntSize(m_frameView->scrollPosition())); |
| 544 if (hasOverflowClip()) | 541 if (hasOverflowClip()) |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 | 1032 |
| 1036 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize&
delta) | 1033 ScrollResult LayoutView::scroll(ScrollGranularity granularity, const FloatSize&
delta) |
| 1037 { | 1034 { |
| 1038 if (!frameView()) | 1035 if (!frameView()) |
| 1039 return ScrollResult(); | 1036 return ScrollResult(); |
| 1040 | 1037 |
| 1041 return frame()->applyScrollDelta(granularity, delta, false); | 1038 return frame()->applyScrollDelta(granularity, delta, false); |
| 1042 } | 1039 } |
| 1043 | 1040 |
| 1044 } // namespace blink | 1041 } // namespace blink |
| OLD | NEW |