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. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 455 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
456 | 456 |
457 // The only way we know how to hit these ASSERTS below this point is via the | 457 // The only way we know how to hit these ASSERTS below this point is via the |
458 // Chromium OS login screen. | 458 // Chromium OS login screen. |
459 DisableCompositingQueryAsserts disabler; | 459 DisableCompositingQueryAsserts disabler; |
460 | 460 |
461 if (compositor()->inCompositingMode()) | 461 if (compositor()->inCompositingMode()) |
462 compositor()->fullyInvalidatePaint(); | 462 compositor()->fullyInvalidatePaint(); |
463 } | 463 } |
464 | 464 |
465 bool LayoutView::mapToVisualRectInAncestorSpace( | 465 bool LayoutView::mapToVisualRectInAncestorSpaceInternal( |
466 const LayoutBoxModelObject* ancestor, | 466 const LayoutBoxModelObject* ancestor, |
467 LayoutRect& rect, | 467 TransformState& transformState, |
468 VisualRectFlags visualRectFlags) const { | 468 VisualRectFlags visualRectFlags) const { |
469 return mapToVisualRectInAncestorSpace(ancestor, rect, 0, visualRectFlags); | 469 return mapToVisualRectInAncestorSpaceInternal(ancestor, transformState, 0, |
| 470 visualRectFlags); |
470 } | 471 } |
471 | 472 |
472 bool LayoutView::mapToVisualRectInAncestorSpace( | 473 bool LayoutView::mapToVisualRectInAncestorSpaceInternal( |
473 const LayoutBoxModelObject* ancestor, | 474 const LayoutBoxModelObject* ancestor, |
474 LayoutRect& rect, | 475 TransformState& transformState, |
475 MapCoordinatesFlags mode, | 476 MapCoordinatesFlags mode, |
476 VisualRectFlags visualRectFlags) const { | 477 VisualRectFlags visualRectFlags) const { |
477 if (mode & IsFixed) | 478 if (mode & IsFixed) |
478 rect.move(offsetForFixedPosition(true)); | 479 transformState.move(offsetForFixedPosition(true)); |
479 | 480 |
480 // Apply our transform if we have one (because of full page zooming). | 481 // Apply our transform if we have one (because of full page zooming). |
481 if (layer() && layer()->transform()) | 482 if (layer() && layer()->transform()) { |
482 rect = layer()->transform()->mapRect(rect); | 483 transformState.applyTransform(layer()->currentTransform(), |
| 484 TransformState::FlattenTransform); |
| 485 } |
| 486 |
| 487 transformState.flatten(); |
483 | 488 |
484 if (ancestor == this) | 489 if (ancestor == this) |
485 return true; | 490 return true; |
486 | 491 |
487 Element* owner = document().localOwner(); | 492 Element* owner = document().localOwner(); |
488 if (!owner) | 493 if (!owner) { |
489 return frameView()->mapToVisualRectInTopFrameSpace(rect); | 494 LayoutRect rect(transformState.lastPlanarQuad().boundingBox()); |
| 495 bool retval = frameView()->mapToVisualRectInTopFrameSpace(rect); |
| 496 transformState.setQuad(FloatQuad(FloatRect(rect))); |
| 497 return retval; |
| 498 } |
490 | 499 |
491 if (LayoutBox* obj = owner->layoutBox()) { | 500 if (LayoutBox* obj = owner->layoutBox()) { |
| 501 LayoutRect rect(transformState.lastPlanarQuad().boundingBox()); |
492 if (!(mode & InputIsInFrameCoordinates)) { | 502 if (!(mode & InputIsInFrameCoordinates)) { |
493 // Intersect the viewport with the visual rect. | 503 // Intersect the viewport with the visual rect. |
494 LayoutRect viewRectangle = viewRect(); | 504 LayoutRect viewRectangle = viewRect(); |
495 if (visualRectFlags & EdgeInclusive) { | 505 if (visualRectFlags & EdgeInclusive) { |
496 if (!rect.inclusiveIntersect(viewRectangle)) | 506 if (!rect.inclusiveIntersect(viewRectangle)) { |
| 507 transformState.setQuad(FloatQuad(FloatRect(rect))); |
497 return false; | 508 return false; |
| 509 } |
498 } else { | 510 } else { |
499 rect.intersect(viewRectangle); | 511 rect.intersect(viewRectangle); |
500 } | 512 } |
501 | 513 |
502 // Adjust for scroll offset of the view. | 514 // Adjust for scroll offset of the view. |
503 rect.moveBy(-viewRectangle.location()); | 515 rect.moveBy(-viewRectangle.location()); |
504 } | 516 } |
505 // Frames are painted at rounded-int position. Since we cannot efficiently | 517 // Frames are painted at rounded-int position. Since we cannot efficiently |
506 // compute the subpixel offset of painting at this point in a a bottom-up | 518 // compute the subpixel offset of painting at this point in a a bottom-up |
507 // walk, round to the enclosing int rect, which will enclose the actual | 519 // walk, round to the enclosing int rect, which will enclose the actual |
508 // visible rect. | 520 // visible rect. |
509 rect = LayoutRect(enclosingIntRect(rect)); | 521 rect = LayoutRect(enclosingIntRect(rect)); |
510 | 522 |
511 // Adjust for frame border. | 523 // Adjust for frame border. |
512 rect.move(obj->contentBoxOffset()); | 524 rect.move(obj->contentBoxOffset()); |
513 return obj->mapToVisualRectInAncestorSpace(ancestor, rect, visualRectFlags); | 525 transformState.setQuad(FloatQuad(FloatRect(rect))); |
| 526 |
| 527 return obj->mapToVisualRectInAncestorSpaceInternal(ancestor, transformState, |
| 528 visualRectFlags); |
514 } | 529 } |
515 | 530 |
516 // This can happen, e.g., if the iframe element has display:none. | 531 // This can happen, e.g., if the iframe element has display:none. |
517 rect = LayoutRect(); | 532 transformState.setQuad(FloatQuad(FloatRect())); |
518 return false; | 533 return false; |
519 } | 534 } |
520 | 535 |
521 LayoutSize LayoutView::offsetForFixedPosition(bool includePendingScroll) const { | 536 LayoutSize LayoutView::offsetForFixedPosition(bool includePendingScroll) const { |
522 FloatSize adjustment; | 537 FloatSize adjustment; |
523 if (m_frameView) { | 538 if (m_frameView) { |
524 adjustment += m_frameView->getScrollOffset(); | 539 adjustment += m_frameView->getScrollOffset(); |
525 | 540 |
526 // FIXME: Paint invalidation should happen after scroll updates, so there | 541 // FIXME: Paint invalidation should happen after scroll updates, so there |
527 // should be no pending scroll delta. | 542 // should be no pending scroll delta. |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 bool LayoutView::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { | 1062 bool LayoutView::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { |
1048 // Frame scroll corner is painted using LayoutView as the display item client. | 1063 // Frame scroll corner is painted using LayoutView as the display item client. |
1049 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && | 1064 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && |
1050 (frameView()->horizontalScrollbar() || frameView()->verticalScrollbar())) | 1065 (frameView()->horizontalScrollbar() || frameView()->verticalScrollbar())) |
1051 return false; | 1066 return false; |
1052 | 1067 |
1053 return LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 1068 return LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize(); |
1054 } | 1069 } |
1055 | 1070 |
1056 } // namespace blink | 1071 } // namespace blink |
OLD | NEW |