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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 if (!m_host) | 612 if (!m_host) |
| 613 return 0; | 613 return 0; |
| 614 | 614 |
| 615 double ratio = m_host->deviceScaleFactor(); | 615 double ratio = m_host->deviceScaleFactor(); |
| 616 ratio *= pageZoomFactor(); | 616 ratio *= pageZoomFactor(); |
| 617 return ratio; | 617 return ratio; |
| 618 } | 618 } |
| 619 | 619 |
| 620 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) | 620 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) |
| 621 { | 621 { |
| 622 m_view->updateLifecycleToCompositingCleanPlusScrolling(); | 622 // TODO(wangxianzhu): Don't need synchronized painting. |
|
pdr.
2016/04/13 22:11:02
Nit: Don't -> Doesn't.
I'm learning about this co
Xianzhu
2016/04/13 22:51:45
Done.
| |
| 623 m_view->updateAllLifecyclePhases(); | |
| 623 LayoutObject* layoutObject = node.layoutObject(); | 624 LayoutObject* layoutObject = node.layoutObject(); |
| 624 if (!layoutObject) | 625 if (!layoutObject) |
| 625 return nullptr; | 626 return nullptr; |
| 626 | 627 |
| 627 // Paint starting at the nearest self painting layer, clipped to the object itself. | 628 // Paint starting at the nearest self painting layer, clipped to the object itself. |
| 628 // TODO(pdr): This will also paint the content behind the object if the obje ct contains | 629 // TODO(pdr): This will also paint the content behind the object if the obje ct contains |
| 629 // transparency but the layer is opaque. We could directly call layoutObject ->paint(...) | 630 // transparency but the layer is opaque. We could directly call layoutObject ->paint(...) |
| 630 // (see ObjectPainter::paintAllPhasesAtomically) but this would skip self-pa inting children. | 631 // (see ObjectPainter::paintAllPhasesAtomically) but this would skip self-pa inting children. |
| 631 PaintLayer* layer = layoutObject->enclosingLayer()->enclosingSelfPaintingLay er(); | 632 PaintLayer* layer = layoutObject->enclosingLayer()->enclosingSelfPaintingLay er(); |
| 632 IntRect absoluteBoundingBox = layoutObject->absoluteBoundingBoxRectIncluding Descendants(); | 633 IntRect absoluteBoundingBox = layoutObject->absoluteBoundingBoxRectIncluding Descendants(); |
| 633 FloatRect boundingBox = layer->layoutObject()->absoluteToLocalQuad(FloatQuad (absoluteBoundingBox), UseTransforms).boundingBox(); | 634 FloatRect boundingBox = layer->layoutObject()->absoluteToLocalQuad(FloatQuad (absoluteBoundingBox), UseTransforms).boundingBox(); |
| 634 DragImageBuilder dragImageBuilder(this, boundingBox, &node); | 635 DragImageBuilder dragImageBuilder(this, boundingBox, &node); |
| 635 { | 636 { |
| 636 PaintLayerPaintingInfo paintingInfo(layer, LayoutRect(boundingBox), Glob alPaintFlattenCompositingLayers, LayoutSize(), 0); | 637 PaintLayerPaintingInfo paintingInfo(layer, LayoutRect(boundingBox), Glob alPaintFlattenCompositingLayers, LayoutSize(), 0); |
| 637 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr ansform | PaintLayerUncachedClipRects; | 638 PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTr ansform | PaintLayerUncachedClipRects; |
| 638 PaintLayerPainter(*layer).paintLayer(dragImageBuilder.context(), paintin gInfo, flags); | 639 PaintLayerPainter(*layer).paintLayer(dragImageBuilder.context(), paintin gInfo, flags); |
| 639 } | 640 } |
| 640 return dragImageBuilder.createImage(); | 641 return dragImageBuilder.createImage(); |
| 641 } | 642 } |
| 642 | 643 |
| 643 PassOwnPtr<DragImage> LocalFrame::dragImageForSelection(float opacity) | 644 PassOwnPtr<DragImage> LocalFrame::dragImageForSelection(float opacity) |
| 644 { | 645 { |
| 645 if (!selection().isRange()) | 646 if (!selection().isRange()) |
| 646 return nullptr; | 647 return nullptr; |
| 647 | 648 |
| 648 m_view->updateLifecycleToCompositingCleanPlusScrolling(); | 649 // TODO(wangxianzhu): Don't need synchronized painting. |
| 650 m_view->updateAllLifecyclePhases(); | |
| 649 ASSERT(document()->isActive()); | 651 ASSERT(document()->isActive()); |
| 650 | 652 |
| 651 FloatRect paintingRect = FloatRect(selection().bounds()); | 653 FloatRect paintingRect = FloatRect(selection().bounds()); |
| 652 DragImageBuilder dragImageBuilder(this, paintingRect, nullptr, opacity); | 654 DragImageBuilder dragImageBuilder(this, paintingRect, nullptr, opacity); |
| 653 GlobalPaintFlags paintFlags = GlobalPaintSelectionOnly | GlobalPaintFlattenC ompositingLayers; | 655 GlobalPaintFlags paintFlags = GlobalPaintSelectionOnly | GlobalPaintFlattenC ompositingLayers; |
| 654 m_view->paintContents(dragImageBuilder.context(), paintFlags, enclosingIntRe ct(paintingRect)); | 656 m_view->paintContents(dragImageBuilder.context(), paintFlags, enclosingIntRe ct(paintingRect)); |
| 655 return dragImageBuilder.createImage(); | 657 return dragImageBuilder.createImage(); |
| 656 } | 658 } |
| 657 | 659 |
| 658 String LocalFrame::selectedText() const | 660 String LocalFrame::selectedText() const |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 858 { | 860 { |
| 859 m_frame->disableNavigation(); | 861 m_frame->disableNavigation(); |
| 860 } | 862 } |
| 861 | 863 |
| 862 FrameNavigationDisabler::~FrameNavigationDisabler() | 864 FrameNavigationDisabler::~FrameNavigationDisabler() |
| 863 { | 865 { |
| 864 m_frame->enableNavigation(); | 866 m_frame->enableNavigation(); |
| 865 } | 867 } |
| 866 | 868 |
| 867 } // namespace blink | 869 } // namespace blink |
| OLD | NEW |