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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 1602513004: Remove PaintInfo's paintingRoot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "core/inspector/InstrumentingAgents.h" 53 #include "core/inspector/InstrumentingAgents.h"
54 #include "core/layout/HitTestResult.h" 54 #include "core/layout/HitTestResult.h"
55 #include "core/layout/LayoutView.h" 55 #include "core/layout/LayoutView.h"
56 #include "core/layout/compositing/PaintLayerCompositor.h" 56 #include "core/layout/compositing/PaintLayerCompositor.h"
57 #include "core/loader/FrameLoadRequest.h" 57 #include "core/loader/FrameLoadRequest.h"
58 #include "core/loader/FrameLoaderClient.h" 58 #include "core/loader/FrameLoaderClient.h"
59 #include "core/loader/NavigationScheduler.h" 59 #include "core/loader/NavigationScheduler.h"
60 #include "core/page/FocusController.h" 60 #include "core/page/FocusController.h"
61 #include "core/page/Page.h" 61 #include "core/page/Page.h"
62 #include "core/page/scrolling/ScrollingCoordinator.h" 62 #include "core/page/scrolling/ScrollingCoordinator.h"
63 #include "core/paint/ObjectPainter.h"
64 #include "core/paint/PaintInfo.h"
63 #include "core/paint/PaintLayer.h" 65 #include "core/paint/PaintLayer.h"
64 #include "core/paint/TransformRecorder.h" 66 #include "core/paint/TransformRecorder.h"
65 #include "core/svg/SVGDocumentExtensions.h" 67 #include "core/svg/SVGDocumentExtensions.h"
66 #include "platform/DragImage.h" 68 #include "platform/DragImage.h"
67 #include "platform/PluginScriptForbiddenScope.h" 69 #include "platform/PluginScriptForbiddenScope.h"
68 #include "platform/RuntimeEnabledFeatures.h" 70 #include "platform/RuntimeEnabledFeatures.h"
69 #include "platform/ScriptForbiddenScope.h" 71 #include "platform/ScriptForbiddenScope.h"
70 #include "platform/graphics/GraphicsContext.h" 72 #include "platform/graphics/GraphicsContext.h"
71 #include "platform/graphics/StaticBitmapImage.h" 73 #include "platform/graphics/StaticBitmapImage.h"
72 #include "platform/graphics/paint/ClipRecorder.h" 74 #include "platform/graphics/paint/ClipRecorder.h"
(...skipping 21 matching lines...) Expand all
94 { 96 {
95 ASSERT(!node || node->layoutObject()); 97 ASSERT(!node || node->layoutObject());
96 if (node) 98 if (node)
97 node->layoutObject()->updateDragState(true); 99 node->layoutObject()->updateDragState(true);
98 } 100 }
99 101
100 ~ScopedFramePaintingState() 102 ~ScopedFramePaintingState()
101 { 103 {
102 if (node && node->layoutObject()) 104 if (node && node->layoutObject())
103 node->layoutObject()->updateDragState(false); 105 node->layoutObject()->updateDragState(false);
104 frame->view()->setNodeToDraw(0);
105 } 106 }
106 107
107 RawPtrWillBeMember<LocalFrame> frame; 108 RawPtrWillBeMember<LocalFrame> frame;
108 RawPtrWillBeMember<Node> node; 109 RawPtrWillBeMember<Node> node;
109 }; 110 };
110 111
111 inline float parentPageZoomFactor(LocalFrame* frame) 112 inline float parentPageZoomFactor(LocalFrame* frame)
112 { 113 {
113 Frame* parent = frame->tree().parent(); 114 Frame* parent = frame->tree().parent();
114 if (!parent || !parent->isLocalFrame()) 115 if (!parent || !parent->isLocalFrame())
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 647 }
647 648
648 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) 649 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node)
649 { 650 {
650 if (!node.layoutObject()) 651 if (!node.layoutObject())
651 return nullptr; 652 return nullptr;
652 653
653 const ScopedFramePaintingState state(this, &node); 654 const ScopedFramePaintingState state(this, &node);
654 655
655 m_view->updateAllLifecyclePhases(); 656 m_view->updateAllLifecyclePhases();
656
657 m_view->setNodeToDraw(&node); // Enable special sub-tree drawing mode.
658
659 // Document::updateLayout may have blown away the original LayoutObject.
660 LayoutObject* layoutObject = node.layoutObject(); 657 LayoutObject* layoutObject = node.layoutObject();
661 if (!layoutObject) 658 if (!layoutObject)
662 return nullptr; 659 return nullptr;
663 660
664 IntRect rect; 661 // Directly paint boxes as if they are a stacking context.
662 if (layoutObject->isBox() && layoutObject->container()) {
663 IntRect boundingBox = layoutObject->absoluteBoundingBoxRectIncludingDesc endants();
664 LayoutPoint paintOffset = boundingBox.location();
665 paintOffset -= layoutObject->offsetFromContainer(layoutObject->container (), LayoutPoint());
665 666
667 float deviceScaleFactor = m_host->deviceScaleFactor();
668 boundingBox.scale(deviceScaleFactor);
669 SkPictureBuilder pictureBuilder(SkRect::MakeIWH(boundingBox.width(), bou ndingBox.height()));
670 {
671 PaintInfo paintInfo(pictureBuilder.context(), boundingBox, PaintPhas e::PaintPhaseForeground, GlobalPaintFlattenCompositingLayers, 0);
672
673 AffineTransform transform;
674 transform.scale(deviceScaleFactor, deviceScaleFactor);
675 transform.translate(-boundingBox.x(), -boundingBox.y());
676 TransformRecorder transformRecorder(pictureBuilder.context(), *this, transform);
chrishtr 2016/01/19 18:29:21 The code here looks like it duplicates paintIntoDr
pdr. 2016/01/19 23:29:21 Good idea. This required some invasive refactoring
677
678 ObjectPainter(*layoutObject).paintAsPseudoStackingContext(paintInfo, LayoutPoint(paintOffset));
679 }
680 RefPtr<const SkPicture> recording = pictureBuilder.endRecording();
681 RefPtr<SkImage> skImage = adoptRef(SkImage::NewFromPicture(recording.get (),
682 SkISize::Make(boundingBox.width(), boundingBox.height()), nullptr, n ullptr));
683 RefPtr<Image> image = StaticBitmapImage::create(skImage.release());
684 return DragImage::create(image.get(), LayoutObject::shouldRespectImageOr ientation(layoutObject), deviceScaleFactor, InterpolationHigh);
685 }
686
687 // FIXME(pdr): This will also paint the background if the object contains tr ansparency. We can
688 // directly call layoutObject->paint(...) (see: ObjectPainter::paintAsPseudo StackingContext) but
689 // painters are inconsistent about which transform space they expect (see: s vg, inlines, etc.)
666 return paintIntoDragImage(*layoutObject, LayoutObject::shouldRespectImageOri entation(layoutObject), 690 return paintIntoDragImage(*layoutObject, LayoutObject::shouldRespectImageOri entation(layoutObject),
667 GlobalPaintFlattenCompositingLayers, layoutObject->paintingRootRect(rect )); 691 GlobalPaintFlattenCompositingLayers, layoutObject->absoluteBoundingBoxRe ctIncludingDescendants());
668 } 692 }
669 693
670 PassOwnPtr<DragImage> LocalFrame::dragImageForSelection(float opacity) 694 PassOwnPtr<DragImage> LocalFrame::dragImageForSelection(float opacity)
671 { 695 {
672 if (!selection().isRange()) 696 if (!selection().isRange())
673 return nullptr; 697 return nullptr;
674 698
675 const ScopedFramePaintingState state(this, 0); 699 const ScopedFramePaintingState state(this, 0);
676 m_view->updateAllLifecyclePhases(); 700 m_view->updateAllLifecyclePhases();
677 701
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 { 912 {
889 m_frame->disableNavigation(); 913 m_frame->disableNavigation();
890 } 914 }
891 915
892 FrameNavigationDisabler::~FrameNavigationDisabler() 916 FrameNavigationDisabler::~FrameNavigationDisabler()
893 { 917 {
894 m_frame->enableNavigation(); 918 m_frame->enableNavigation();
895 } 919 }
896 920
897 } // namespace blink 921 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698