OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 #include "core/CSSPropertyNames.h" | 46 #include "core/CSSPropertyNames.h" |
47 #include "core/HTMLNames.h" | 47 #include "core/HTMLNames.h" |
48 #include "core/css/PseudoStyleRequest.h" | 48 #include "core/css/PseudoStyleRequest.h" |
49 #include "core/dom/Document.h" | 49 #include "core/dom/Document.h" |
50 #include "core/dom/shadow/ShadowRoot.h" | 50 #include "core/dom/shadow/ShadowRoot.h" |
51 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" | 51 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" |
52 #include "core/frame/FrameView.h" | 52 #include "core/frame/FrameView.h" |
53 #include "core/frame/LocalFrame.h" | 53 #include "core/frame/LocalFrame.h" |
54 #include "core/frame/Settings.h" | 54 #include "core/frame/Settings.h" |
55 #include "core/html/HTMLFrameElement.h" | 55 #include "core/html/HTMLFrameElement.h" |
56 #include "core/layout/FragmentainerIterator.h" | |
56 #include "core/layout/HitTestRequest.h" | 57 #include "core/layout/HitTestRequest.h" |
57 #include "core/layout/HitTestResult.h" | 58 #include "core/layout/HitTestResult.h" |
58 #include "core/layout/HitTestingTransformState.h" | 59 #include "core/layout/HitTestingTransformState.h" |
59 #include "core/layout/LayoutFlowThread.h" | 60 #include "core/layout/LayoutFlowThread.h" |
60 #include "core/layout/LayoutInline.h" | 61 #include "core/layout/LayoutInline.h" |
61 #include "core/layout/LayoutPart.h" | 62 #include "core/layout/LayoutPart.h" |
62 #include "core/layout/LayoutReplica.h" | 63 #include "core/layout/LayoutReplica.h" |
63 #include "core/layout/LayoutTreeAsText.h" | 64 #include "core/layout/LayoutTreeAsText.h" |
64 #include "core/layout/LayoutView.h" | 65 #include "core/layout/LayoutView.h" |
65 #include "core/layout/compositing/CompositedLayerMapping.h" | 66 #include "core/layout/compositing/CompositedLayerMapping.h" |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1529 // The root layer is in the same fragmentation context as this layer, so we need to look | 1530 // The root layer is in the same fragmentation context as this layer, so we need to look |
1530 // inside it and subtract the offset between the fragmentation context a nd the root layer. | 1531 // inside it and subtract the offset between the fragmentation context a nd the root layer. |
1531 offsetOfPaginationLayerFromRoot = -rootLayer->visualOffsetFromAncestor(e nclosingPaginationLayer()); | 1532 offsetOfPaginationLayerFromRoot = -rootLayer->visualOffsetFromAncestor(e nclosingPaginationLayer()); |
1532 } else { | 1533 } else { |
1533 offsetOfPaginationLayerFromRoot = enclosingPaginationLayer()->visualOffs etFromAncestor(rootLayer); | 1534 offsetOfPaginationLayerFromRoot = enclosingPaginationLayer()->visualOffs etFromAncestor(rootLayer); |
1534 } | 1535 } |
1535 // Make the dirty rect relative to the fragmentation context (multicol conta iner, etc.). | 1536 // Make the dirty rect relative to the fragmentation context (multicol conta iner, etc.). |
1536 LayoutRect dirtyRectInMulticolContainer(dirtyRect); | 1537 LayoutRect dirtyRectInMulticolContainer(dirtyRect); |
1537 dirtyRectInMulticolContainer.move(enclosingPaginationLayer()->location() - o ffsetOfPaginationLayerFromRoot); | 1538 dirtyRectInMulticolContainer.move(enclosingPaginationLayer()->location() - o ffsetOfPaginationLayerFromRoot); |
1538 | 1539 |
1539 // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns | 1540 // Slice the layer into fragments. Each fragment needs to be processed (e.g. painted) |
1540 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box. | 1541 // separately. We pass enough information to walk a minimal number of fragme nts based on the |
1541 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInMulticolContainer); | 1542 // pages/columns that intersect the actual dirtyRect as well as the pages/co lumns that |
1542 | 1543 // intersect our layer's bounding box. |
1543 if (fragments.isEmpty()) | 1544 FragmentainerIterator iterator(*enclosingFlowThread, layerBoundingBoxInFlowT hread, dirtyRectInMulticolContainer); |
1545 if (iterator.atEnd()) | |
1544 return; | 1546 return; |
1545 | 1547 |
1546 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents. | 1548 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents. |
1547 ClipRect ancestorClipRect = dirtyRect; | 1549 ClipRect ancestorClipRect = dirtyRect; |
1548 if (const PaintLayer* paginationParentLayer = enclosingPaginationLayer()->pa rent()) { | 1550 if (const PaintLayer* paginationParentLayer = enclosingPaginationLayer()->pa rent()) { |
1549 const PaintLayer* ancestorLayer = rootLayerIsInsidePaginationLayer ? pag inationParentLayer : rootLayer; | 1551 const PaintLayer* ancestorLayer = rootLayerIsInsidePaginationLayer ? pag inationParentLayer : rootLayer; |
1550 ClipRectsContext clipRectsContext(ancestorLayer, clipRectsCacheSlot, ove rlayScrollbarClipBehavior); | 1552 ClipRectsContext clipRectsContext(ancestorLayer, clipRectsCacheSlot, ove rlayScrollbarClipBehavior); |
1551 if (respectOverflowClip == IgnoreOverflowClip) | 1553 if (respectOverflowClip == IgnoreOverflowClip) |
1552 clipRectsContext.setIgnoreOverflowClip(); | 1554 clipRectsContext.setIgnoreOverflowClip(); |
1553 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR ect(clipRectsContext); | 1555 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR ect(clipRectsContext); |
1554 if (rootLayerIsInsidePaginationLayer) | 1556 if (rootLayerIsInsidePaginationLayer) |
1555 ancestorClipRect.moveBy(-rootLayer->visualOffsetFromAncestor(ancesto rLayer)); | 1557 ancestorClipRect.moveBy(-rootLayer->visualOffsetFromAncestor(ancesto rLayer)); |
1556 ancestorClipRect.intersect(dirtyRect); | 1558 ancestorClipRect.intersect(dirtyRect); |
1557 } | 1559 } |
1558 | 1560 |
1559 const LayoutSize subPixelAccumulationIfNeeded = offsetFromRoot ? subPixelAcc umulation : LayoutSize(); | 1561 const LayoutSize subPixelAccumulationIfNeeded = offsetFromRoot ? subPixelAcc umulation : LayoutSize(); |
1560 for (size_t i = 0; i < fragments.size(); ++i) { | 1562 for (; !iterator.atEnd(); iterator.advance()) { |
1561 PaintLayerFragment& fragment = fragments.at(i); | 1563 PaintLayerFragment fragment; |
1564 fragment.paginationOffset = toLayoutPoint(iterator.paginationOffset()); | |
1565 fragment.paginationClip = iterator.clipRectInFlowThread(); | |
1562 | 1566 |
1563 // Set our four rects with all clipping applied that was internal to the flow thread. | 1567 // Set our four rects with all clipping applied that was internal to the flow thread. |
1564 fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, f oregroundRectInFlowThread); | 1568 fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, f oregroundRectInFlowThread); |
1565 | 1569 |
1566 // Shift to the root-relative physical position used when painting the f low thread in this fragment. | 1570 // Shift to the root-relative physical position used when painting the f low thread in this fragment. |
1567 fragment.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromR oot + subPixelAccumulationIfNeeded); | 1571 fragment.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromR oot + subPixelAccumulationIfNeeded); |
1568 | 1572 |
1569 // Intersect the fragment with our ancestor's background clip so that e. g., columns in an overflow:hidden block are | 1573 // Intersect the fragment with our ancestor's background clip so that e. g., columns in an overflow:hidden block are |
1570 // properly clipped by the overflow. | 1574 // properly clipped by the overflow. |
1571 fragment.intersect(ancestorClipRect.rect()); | 1575 fragment.intersect(ancestorClipRect.rect()); |
1572 | 1576 |
1573 // Now intersect with our pagination clip. This will typically mean we'r e just intersecting the dirty rect with the column | 1577 // Now intersect with our pagination clip. This will typically mean we'r e just intersecting the dirty rect with the column |
1574 // clip, so the column clip ends up being all we apply. | 1578 // clip, so the column clip ends up being all we apply. |
1575 fragment.intersect(fragment.paginationClip); | 1579 fragment.intersect(fragment.paginationClip); |
1580 | |
1581 // TODO(mstensho): Don't add empty fragments. We've always done that in some cases, but it | |
eae
2016/09/08 08:15:03
This comment seems to suggest that we shouldn't ad
mstensho (USE GERRIT)
2016/09/08 08:59:51
Done.
| |
1582 // should be possible to instruct the fragmentainer iterator to filter t hose out. | |
1583 fragments.append(fragment); | |
1576 } | 1584 } |
1577 } | 1585 } |
1578 | 1586 |
1579 static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject) | 1587 static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject) |
1580 { | 1588 { |
1581 FrameView* frameView = layoutObject->document().view(); | 1589 FrameView* frameView = layoutObject->document().view(); |
1582 if (!frameView) | 1590 if (!frameView) |
1583 return LayoutRect(); | 1591 return LayoutRect(); |
1584 | 1592 |
1585 return LayoutRect(frameView->visibleContentRect()); | 1593 return LayoutRect(frameView->visibleContentRect()); |
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2958 | 2966 |
2959 void showLayerTree(const blink::LayoutObject* layoutObject) | 2967 void showLayerTree(const blink::LayoutObject* layoutObject) |
2960 { | 2968 { |
2961 if (!layoutObject) { | 2969 if (!layoutObject) { |
2962 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2970 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2963 return; | 2971 return; |
2964 } | 2972 } |
2965 showLayerTree(layoutObject->enclosingLayer()); | 2973 showLayerTree(layoutObject->enclosingLayer()); |
2966 } | 2974 } |
2967 #endif | 2975 #endif |
OLD | NEW |