Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 1982943002: Drag images should paint descendants that are painting siblings of the dragged element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayerPaintingInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/LocalFrame.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index ab8078288b9368808d1db8f783d5c55c3ac60220..57b8c522eae0d0b15831df6be49b3e0006c6d619 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -626,9 +626,34 @@ PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node)
FloatRect boundingBox = layer->layoutObject()->absoluteToLocalQuad(FloatQuad(absoluteBoundingBox), UseTransforms).boundingBox();
DragImageBuilder dragImageBuilder(this, boundingBox, &node);
{
- PaintLayerPaintingInfo paintingInfo(layer, LayoutRect(boundingBox), GlobalPaintFlattenCompositingLayers, LayoutSize(), 0);
- PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTransform | PaintLayerUncachedClipRects;
- PaintLayerPainter(*layer).paintLayer(dragImageBuilder.context(), paintingInfo, flags);
+ // If our enclosing layer is not a stacking context, there could be descendant stacked
+ // contents that are painted by our parent stacking context, i.e. being painting sibling
+ // of our enclosing layer. Collect those descendants here.
+ Vector<PaintLayer*> descendantStackedContents;
+ if (!layer->stackingNode()->isStackingContext()) {
+ for (LayoutObject* curr = layoutObject->nextInPreOrder(layoutObject); curr;) {
+ if (curr->isBoxModelObject() && toLayoutBoxModelObject(curr)->hasSelfPaintingLayer()) {
+ descendantStackedContents.append(toLayoutBoxModelObject(curr)->layer());
+ curr = curr->nextInPreOrderAfterChildren(layoutObject);
+ continue;
+ }
+ curr = curr->nextInPreOrder(layoutObject);
+ }
+ std::stable_sort(descendantStackedContents.begin(), descendantStackedContents.end(),
+ [](PaintLayer* first, PaintLayer* second) { return first->stackingNode()->zIndex() < second->stackingNode()->zIndex(); });
+ }
+
+ PaintLayerPaintingInfo paintingInfo(layer, LayoutRect(boundingBox), GlobalPaintFlattenCompositingLayers, LayoutSize());
+ PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerUncachedClipRects;
+
+ auto descendantStackedContentsIterator = descendantStackedContents.begin();
+ for (; descendantStackedContentsIterator != descendantStackedContents.end() && (*descendantStackedContentsIterator)->stackingNode()->zIndex() < 0; descendantStackedContentsIterator++)
+ PaintLayerPainter(**descendantStackedContentsIterator).paintLayer(dragImageBuilder.context(), paintingInfo, flags);
+
+ PaintLayerPainter(*layer).paintLayer(dragImageBuilder.context(), paintingInfo, flags | PaintLayerAppliedTransform);
trchen 2016/05/17 03:27:57 I felt we should also address pdr's comment on lin
+
+ for (; descendantStackedContentsIterator != descendantStackedContents.end(); descendantStackedContentsIterator++)
+ PaintLayerPainter(**descendantStackedContentsIterator).paintLayer(dragImageBuilder.context(), paintingInfo, flags);
}
return dragImageBuilder.createImage();
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayerPaintingInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698