| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PaintLayerPainter.h" | 5 #include "core/paint/PaintLayerPainter.h" |
| 6 | 6 |
| 7 #include "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/paint/ClipPathClipper.h" | 9 #include "core/paint/ClipPathClipper.h" |
| 10 #include "core/paint/FilterPainter.h" | 10 #include "core/paint/FilterPainter.h" |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 641 |
| 642 LayoutView* view = m_paintLayer.layoutObject()->view(); | 642 LayoutView* view = m_paintLayer.layoutObject()->view(); |
| 643 unsigned pages = | 643 unsigned pages = |
| 644 ceilf(view->documentRect().height() / view->pageLogicalHeight()); | 644 ceilf(view->documentRect().height() / view->pageLogicalHeight()); |
| 645 | 645 |
| 646 // The fixed position object is offset from the top of the page, so remove | 646 // The fixed position object is offset from the top of the page, so remove |
| 647 // any scroll offset. | 647 // any scroll offset. |
| 648 LayoutPoint offsetFromRoot; | 648 LayoutPoint offsetFromRoot; |
| 649 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 649 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
| 650 LayoutSize offsetAdjustment = m_paintLayer.location() - offsetFromRoot; | 650 LayoutSize offsetAdjustment = m_paintLayer.location() - offsetFromRoot; |
| 651 layerFragments.append(singleFragmentIgnoredPagination); | 651 layerFragments.push_back(singleFragmentIgnoredPagination); |
| 652 layerFragments[0].paginationOffset += offsetAdjustment; | 652 layerFragments[0].paginationOffset += offsetAdjustment; |
| 653 layerFragments[0].layerBounds.move(offsetAdjustment); | 653 layerFragments[0].layerBounds.move(offsetAdjustment); |
| 654 | 654 |
| 655 LayoutPoint pageOffset(LayoutUnit(), view->pageLogicalHeight()); | 655 LayoutPoint pageOffset(LayoutUnit(), view->pageLogicalHeight()); |
| 656 for (unsigned i = 1; i < pages; i++) { | 656 for (unsigned i = 1; i < pages; i++) { |
| 657 PaintLayerFragment fragment = layerFragments[i - 1]; | 657 PaintLayerFragment fragment = layerFragments[i - 1]; |
| 658 fragment.paginationOffset += pageOffset; | 658 fragment.paginationOffset += pageOffset; |
| 659 fragment.layerBounds.moveBy(pageOffset); | 659 fragment.layerBounds.moveBy(pageOffset); |
| 660 layerFragments.append(fragment); | 660 layerFragments.push_back(fragment); |
| 661 } | 661 } |
| 662 } | 662 } |
| 663 | 663 |
| 664 PaintResult PaintLayerPainter::paintLayerWithTransform( | 664 PaintResult PaintLayerPainter::paintLayerWithTransform( |
| 665 GraphicsContext& context, | 665 GraphicsContext& context, |
| 666 const PaintLayerPaintingInfo& paintingInfo, | 666 const PaintLayerPaintingInfo& paintingInfo, |
| 667 PaintLayerFlags paintFlags) { | 667 PaintLayerFlags paintFlags) { |
| 668 TransformationMatrix layerTransform = | 668 TransformationMatrix layerTransform = |
| 669 m_paintLayer.renderableTransform(paintingInfo.getGlobalPaintFlags()); | 669 m_paintLayer.renderableTransform(paintingInfo.getGlobalPaintFlags()); |
| 670 // If the transform can't be inverted, then don't paint anything. | 670 // If the transform can't be inverted, then don't paint anything. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 683 if (!paginationLayer || isFixedPositionObjectInPagedMedia) { | 683 if (!paginationLayer || isFixedPositionObjectInPagedMedia) { |
| 684 // We don't need to collect any fragments in the regular way here. We have | 684 // We don't need to collect any fragments in the regular way here. We have |
| 685 // already calculated a clip rectangle for the ancestry if it was needed, | 685 // already calculated a clip rectangle for the ancestry if it was needed, |
| 686 // and clipping this layer is something that can be done further down the | 686 // and clipping this layer is something that can be done further down the |
| 687 // path, when the transform has been applied. | 687 // path, when the transform has been applied. |
| 688 PaintLayerFragment fragment; | 688 PaintLayerFragment fragment; |
| 689 fragment.backgroundRect = paintingInfo.paintDirtyRect; | 689 fragment.backgroundRect = paintingInfo.paintDirtyRect; |
| 690 if (isFixedPositionObjectInPagedMedia) | 690 if (isFixedPositionObjectInPagedMedia) |
| 691 repeatFixedPositionObjectInPages(fragment, paintingInfo, layerFragments); | 691 repeatFixedPositionObjectInPages(fragment, paintingInfo, layerFragments); |
| 692 else | 692 else |
| 693 layerFragments.append(fragment); | 693 layerFragments.push_back(fragment); |
| 694 } else { | 694 } else { |
| 695 // FIXME: This is a mess. Look closely at this code and the code in Layer | 695 // FIXME: This is a mess. Look closely at this code and the code in Layer |
| 696 // and fix any issues in it & refactor to make it obvious from code | 696 // and fix any issues in it & refactor to make it obvious from code |
| 697 // structure what it does and that it's correct. | 697 // structure what it does and that it's correct. |
| 698 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects) | 698 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects) |
| 699 ? UncachedClipRects | 699 ? UncachedClipRects |
| 700 : PaintingClipRects; | 700 : PaintingClipRects; |
| 701 ShouldRespectOverflowClipType respectOverflowClip = | 701 ShouldRespectOverflowClipType respectOverflowClip = |
| 702 shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()); | 702 shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()); |
| 703 // Calculate the transformed bounding box in the current coordinate space, | 703 // Calculate the transformed bounding box in the current coordinate space, |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 context, *layoutBox, PaintPhaseClippingMask)) | 1178 context, *layoutBox, PaintPhaseClippingMask)) |
| 1179 return; | 1179 return; |
| 1180 | 1180 |
| 1181 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); | 1181 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); |
| 1182 LayoutObjectDrawingRecorder drawingRecorder( | 1182 LayoutObjectDrawingRecorder drawingRecorder( |
| 1183 context, *layoutBox, PaintPhaseClippingMask, snappedClipRect); | 1183 context, *layoutBox, PaintPhaseClippingMask, snappedClipRect); |
| 1184 context.fillRect(snappedClipRect, Color::black); | 1184 context.fillRect(snappedClipRect, Color::black); |
| 1185 } | 1185 } |
| 1186 | 1186 |
| 1187 } // namespace blink | 1187 } // namespace blink |
| OLD | NEW |