Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
| 6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
| 7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
| 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
| 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
| 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 | 619 |
| 620 // Paint starting at the nearest self painting layer, clipped to the object itself. | 620 // Paint starting at the nearest self painting layer, clipped to the object itself. |
| 621 // TODO(pdr): This will also paint the content behind the object if the obje ct contains | 621 // TODO(pdr): This will also paint the content behind the object if the obje ct contains |
| 622 // transparency but the layer is opaque. We could directly call layoutObject ->paint(...) | 622 // transparency but the layer is opaque. We could directly call layoutObject ->paint(...) |
| 623 // (see ObjectPainter::paintAllPhasesAtomically) but this would skip self-pa inting children. | 623 // (see ObjectPainter::paintAllPhasesAtomically) but this would skip self-pa inting children. |
| 624 PaintLayer* layer = layoutObject->enclosingLayer()->enclosingSelfPaintingLay er(); | 624 PaintLayer* layer = layoutObject->enclosingLayer()->enclosingSelfPaintingLay er(); |
| 625 IntRect absoluteBoundingBox = layoutObject->absoluteBoundingBoxRectIncluding Descendants(); | 625 IntRect absoluteBoundingBox = layoutObject->absoluteBoundingBoxRectIncluding Descendants(); |
| 626 FloatRect boundingBox = layer->layoutObject()->absoluteToLocalQuad(FloatQuad (absoluteBoundingBox), UseTransforms).boundingBox(); | 626 FloatRect boundingBox = layer->layoutObject()->absoluteToLocalQuad(FloatQuad (absoluteBoundingBox), UseTransforms).boundingBox(); |
| 627 DragImageBuilder dragImageBuilder(this, boundingBox, &node); | 627 DragImageBuilder dragImageBuilder(this, boundingBox, &node); |
| 628 { | 628 { |
| 629 PaintLayerPaintingInfo paintingInfo(layer, LayoutRect(boundingBox), Glob alPaintFlattenCompositingLayers, LayoutSize(), 0); | 629 // If our enclosing layer is not a stacking context, there could be desc endant stacked |
| 630 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr ansform | PaintLayerUncachedClipRects; | 630 // contents that are painted by our parent stacking context, i.e. being painting sibling |
| 631 PaintLayerPainter(*layer).paintLayer(dragImageBuilder.context(), paintin gInfo, flags); | 631 // of our enclosing layer. Collect those descendants here. |
| 632 Vector<PaintLayer*> descendantStackedContents; | |
| 633 if (!layer->stackingNode()->isStackingContext()) { | |
| 634 for (LayoutObject* curr = layoutObject->nextInPreOrder(layoutObject) ; curr;) { | |
| 635 if (curr->isBoxModelObject() && toLayoutBoxModelObject(curr)->ha sSelfPaintingLayer()) { | |
| 636 descendantStackedContents.append(toLayoutBoxModelObject(curr )->layer()); | |
| 637 curr = curr->nextInPreOrderAfterChildren(layoutObject); | |
| 638 continue; | |
| 639 } | |
| 640 curr = curr->nextInPreOrder(layoutObject); | |
| 641 } | |
| 642 std::stable_sort(descendantStackedContents.begin(), descendantStacke dContents.end(), | |
| 643 [](PaintLayer* first, PaintLayer* second) { return first->stacki ngNode()->zIndex() < second->stackingNode()->zIndex(); }); | |
| 644 } | |
| 645 | |
| 646 PaintLayerPaintingInfo paintingInfo(layer, LayoutRect(boundingBox), Glob alPaintFlattenCompositingLayers, LayoutSize()); | |
| 647 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerUncachedC lipRects; | |
| 648 | |
| 649 auto descendantStackedContentsIterator = descendantStackedContents.begi n(); | |
| 650 for (; descendantStackedContentsIterator != descendantStackedContents.en d() && (*descendantStackedContentsIterator)->stackingNode()->zIndex() < 0; desce ndantStackedContentsIterator++) | |
| 651 PaintLayerPainter(**descendantStackedContentsIterator).paintLayer(dr agImageBuilder.context(), paintingInfo, flags); | |
| 652 | |
| 653 PaintLayerPainter(*layer).paintLayer(dragImageBuilder.context(), paintin gInfo, flags | PaintLayerAppliedTransform); | |
|
trchen
2016/05/17 03:27:57
I felt we should also address pdr's comment on lin
| |
| 654 | |
| 655 for (; descendantStackedContentsIterator != descendantStackedContents.en d(); descendantStackedContentsIterator++) | |
| 656 PaintLayerPainter(**descendantStackedContentsIterator).paintLayer(dr agImageBuilder.context(), paintingInfo, flags); | |
| 632 } | 657 } |
| 633 return dragImageBuilder.createImage(); | 658 return dragImageBuilder.createImage(); |
| 634 } | 659 } |
| 635 | 660 |
| 636 PassOwnPtr<DragImage> LocalFrame::dragImageForSelection(float opacity) | 661 PassOwnPtr<DragImage> LocalFrame::dragImageForSelection(float opacity) |
| 637 { | 662 { |
| 638 if (!selection().isRange()) | 663 if (!selection().isRange()) |
| 639 return nullptr; | 664 return nullptr; |
| 640 | 665 |
| 641 m_view->updateAllLifecyclePhasesExceptPaint(); | 666 m_view->updateAllLifecyclePhasesExceptPaint(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 { | 832 { |
| 808 m_frame->disableNavigation(); | 833 m_frame->disableNavigation(); |
| 809 } | 834 } |
| 810 | 835 |
| 811 FrameNavigationDisabler::~FrameNavigationDisabler() | 836 FrameNavigationDisabler::~FrameNavigationDisabler() |
| 812 { | 837 { |
| 813 m_frame->enableNavigation(); | 838 m_frame->enableNavigation(); |
| 814 } | 839 } |
| 815 | 840 |
| 816 } // namespace blink | 841 } // namespace blink |
| OLD | NEW |