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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 frame->view()->setBaseBackgroundColor(backgroundColor); | 547 frame->view()->setBaseBackgroundColor(backgroundColor); |
548 frame->view()->setNodeToDraw(0); | 548 frame->view()->setNodeToDraw(0); |
549 } | 549 } |
550 | 550 |
551 LocalFrame* frame; | 551 LocalFrame* frame; |
552 Node* node; | 552 Node* node; |
553 PaintBehavior paintBehavior; | 553 PaintBehavior paintBehavior; |
554 Color backgroundColor; | 554 Color backgroundColor; |
555 }; | 555 }; |
556 | 556 |
557 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node* node) | 557 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) |
558 { | 558 { |
559 if (!node->renderer()) | 559 if (!node.renderer()) |
560 return nullptr; | 560 return nullptr; |
561 | 561 |
562 const ScopedFramePaintingState state(this, node); | 562 const ScopedFramePaintingState state(this, &node); |
| 563 |
| 564 m_view->updateLayoutAndStyleForPainting(); |
563 | 565 |
564 m_view->setPaintBehavior(state.paintBehavior | PaintBehaviorFlattenCompositi
ngLayers); | 566 m_view->setPaintBehavior(state.paintBehavior | PaintBehaviorFlattenCompositi
ngLayers); |
565 | 567 |
566 // When generating the drag image for an element, ignore the document backgr
ound. | 568 // When generating the drag image for an element, ignore the document backgr
ound. |
567 m_view->setBaseBackgroundColor(Color::transparent); | 569 m_view->setBaseBackgroundColor(Color::transparent); |
568 | 570 |
569 // Updating layout can tear everything down, so ref the LocalFrame and Node
to keep them alive. | 571 m_view->setNodeToDraw(&node); // Enable special sub-tree drawing mode. |
570 RefPtr<LocalFrame> frameProtector(this); | |
571 RefPtr<Node> nodeProtector(node); | |
572 m_view->updateLayoutAndStyleForPainting(); | |
573 | |
574 m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode. | |
575 | 572 |
576 // Document::updateLayout may have blown away the original RenderObject. | 573 // Document::updateLayout may have blown away the original RenderObject. |
577 RenderObject* renderer = node->renderer(); | 574 RenderObject* renderer = node.renderer(); |
578 if (!renderer) | 575 if (!renderer) |
579 return nullptr; | 576 return nullptr; |
580 | 577 |
581 LayoutRect topLevelRect; | 578 LayoutRect topLevelRect; |
582 IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLev
elRect)); | 579 IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLev
elRect)); |
583 | 580 |
584 ASSERT(document()->isActive()); | 581 ASSERT(document()->isActive()); |
585 float deviceScaleFactor = m_host->deviceScaleFactor(); | 582 float deviceScaleFactor = m_host->deviceScaleFactor(); |
586 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); | 583 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); |
587 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); | 584 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 { | 629 { |
633 if (!m_host) | 630 if (!m_host) |
634 return 0; | 631 return 0; |
635 | 632 |
636 double ratio = m_host->deviceScaleFactor(); | 633 double ratio = m_host->deviceScaleFactor(); |
637 ratio *= pageZoomFactor(); | 634 ratio *= pageZoomFactor(); |
638 return ratio; | 635 return ratio; |
639 } | 636 } |
640 | 637 |
641 } // namespace WebCore | 638 } // namespace WebCore |
OLD | NEW |