| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 namespace blink { | 78 namespace blink { |
| 79 | 79 |
| 80 using namespace HTMLNames; | 80 using namespace HTMLNames; |
| 81 | 81 |
| 82 namespace { | 82 namespace { |
| 83 | 83 |
| 84 struct ScopedFramePaintingState { | 84 struct ScopedFramePaintingState { |
| 85 ScopedFramePaintingState(LocalFrame* frame, Node* node) | 85 ScopedFramePaintingState(LocalFrame* frame, Node* node) |
| 86 : frame(frame) | 86 : frame(frame) |
| 87 , node(node) | 87 , node(node) |
| 88 , paintBehavior(frame->view()->paintBehavior()) | |
| 89 { | 88 { |
| 90 ASSERT(!node || node->layoutObject()); | 89 ASSERT(!node || node->layoutObject()); |
| 91 if (node) | 90 if (node) |
| 92 node->layoutObject()->updateDragState(true); | 91 node->layoutObject()->updateDragState(true); |
| 93 } | 92 } |
| 94 | 93 |
| 95 ~ScopedFramePaintingState() | 94 ~ScopedFramePaintingState() |
| 96 { | 95 { |
| 97 if (node && node->layoutObject()) | 96 if (node && node->layoutObject()) |
| 98 node->layoutObject()->updateDragState(false); | 97 node->layoutObject()->updateDragState(false); |
| 99 frame->view()->setPaintBehavior(paintBehavior); | |
| 100 frame->view()->setNodeToDraw(0); | 98 frame->view()->setNodeToDraw(0); |
| 99 // We reset the global paint flags as this is the end |
| 100 // of the paint phase. TODO(jchaffraix): We shouldn't |
| 101 // need this code. See the comment above GlobalPaintFlags. |
| 102 gGlobalPaintFlags = GlobalPaintNoFlag; |
| 101 } | 103 } |
| 102 | 104 |
| 103 LocalFrame* frame; | 105 LocalFrame* frame; |
| 104 Node* node; | 106 Node* node; |
| 105 PaintBehavior paintBehavior; | |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 inline float parentPageZoomFactor(LocalFrame* frame) | 109 inline float parentPageZoomFactor(LocalFrame* frame) |
| 109 { | 110 { |
| 110 Frame* parent = frame->tree().parent(); | 111 Frame* parent = frame->tree().parent(); |
| 111 if (!parent || !parent->isLocalFrame()) | 112 if (!parent || !parent->isLocalFrame()) |
| 112 return 1; | 113 return 1; |
| 113 return toLocalFrame(parent)->pageZoomFactor(); | 114 return toLocalFrame(parent)->pageZoomFactor(); |
| 114 } | 115 } |
| 115 | 116 |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 622 |
| 622 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) | 623 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) |
| 623 { | 624 { |
| 624 if (!node.layoutObject()) | 625 if (!node.layoutObject()) |
| 625 return nullptr; | 626 return nullptr; |
| 626 | 627 |
| 627 const ScopedFramePaintingState state(this, &node); | 628 const ScopedFramePaintingState state(this, &node); |
| 628 | 629 |
| 629 m_view->updateAllLifecyclePhases(); | 630 m_view->updateAllLifecyclePhases(); |
| 630 | 631 |
| 631 m_view->setPaintBehavior(state.paintBehavior | PaintBehaviorFlattenCompositi
ngLayers); | 632 gGlobalPaintFlags = GlobalPaintFlattenCompositingLayers; |
| 632 | 633 |
| 633 m_view->setNodeToDraw(&node); // Enable special sub-tree drawing mode. | 634 m_view->setNodeToDraw(&node); // Enable special sub-tree drawing mode. |
| 634 | 635 |
| 635 // Document::updateLayout may have blown away the original LayoutObject. | 636 // Document::updateLayout may have blown away the original LayoutObject. |
| 636 LayoutObject* layoutObject = node.layoutObject(); | 637 LayoutObject* layoutObject = node.layoutObject(); |
| 637 if (!layoutObject) | 638 if (!layoutObject) |
| 638 return nullptr; | 639 return nullptr; |
| 639 | 640 |
| 640 IntRect rect; | 641 IntRect rect; |
| 641 | 642 |
| 642 return paintIntoDragImage(*layoutObject, DisplayItem::ClipNodeImage, layoutO
bject->shouldRespectImageOrientation(), | 643 return paintIntoDragImage(*layoutObject, DisplayItem::ClipNodeImage, layoutO
bject->shouldRespectImageOrientation(), |
| 643 layoutObject->paintingRootRect(rect)); | 644 layoutObject->paintingRootRect(rect)); |
| 644 } | 645 } |
| 645 | 646 |
| 646 PassOwnPtr<DragImage> LocalFrame::dragImageForSelection() | 647 PassOwnPtr<DragImage> LocalFrame::dragImageForSelection() |
| 647 { | 648 { |
| 648 if (!selection().isRange()) | 649 if (!selection().isRange()) |
| 649 return nullptr; | 650 return nullptr; |
| 650 | 651 |
| 651 const ScopedFramePaintingState state(this, 0); | 652 const ScopedFramePaintingState state(this, 0); |
| 652 m_view->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorFlattenCo
mpositingLayers); | 653 gGlobalPaintFlags = GlobalPaintSelectionOnly | GlobalPaintFlattenCompositing
Layers; |
| 653 m_view->updateAllLifecyclePhases(); | 654 m_view->updateAllLifecyclePhases(); |
| 654 | 655 |
| 655 return paintIntoDragImage(*this, DisplayItem::ClipSelectionImage, DoNotRespe
ctImageOrientation, enclosingIntRect(selection().bounds())); | 656 return paintIntoDragImage(*this, DisplayItem::ClipSelectionImage, DoNotRespe
ctImageOrientation, enclosingIntRect(selection().bounds())); |
| 656 } | 657 } |
| 657 | 658 |
| 658 String LocalFrame::selectedText() const | 659 String LocalFrame::selectedText() const |
| 659 { | 660 { |
| 660 return selection().selectedText(); | 661 return selection().selectedText(); |
| 661 } | 662 } |
| 662 | 663 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 { | 845 { |
| 845 if (isLocalRoot()) | 846 if (isLocalRoot()) |
| 846 m_instrumentingAgents = InstrumentingAgents::create(); | 847 m_instrumentingAgents = InstrumentingAgents::create(); |
| 847 else | 848 else |
| 848 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; | 849 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; |
| 849 } | 850 } |
| 850 | 851 |
| 851 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); | 852 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); |
| 852 | 853 |
| 853 } // namespace blink | 854 } // namespace blink |
| OLD | NEW |