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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 resultSize.setHeight(floorf(resultSize.width() * ratio)); | 544 resultSize.setHeight(floorf(resultSize.width() * ratio)); |
545 } else { | 545 } else { |
546 ASSERT(fabs(originalSize.height()) > numeric_limits<float>::epsilon()); | 546 ASSERT(fabs(originalSize.height()) > numeric_limits<float>::epsilon()); |
547 float ratio = originalSize.width() / originalSize.height(); | 547 float ratio = originalSize.width() / originalSize.height(); |
548 resultSize.setHeight(floorf(expectedSize.height())); | 548 resultSize.setHeight(floorf(expectedSize.height())); |
549 resultSize.setWidth(floorf(resultSize.height() * ratio)); | 549 resultSize.setWidth(floorf(resultSize.height() * ratio)); |
550 } | 550 } |
551 return resultSize; | 551 return resultSize; |
552 } | 552 } |
553 | 553 |
554 void Frame::injectUserScripts(UserScriptInjectionTime injectionTime) | |
555 { | |
556 if (!m_page) | |
557 return; | |
558 | |
559 if (loader()->stateMachine()->creatingInitialEmptyDocument()) | |
560 return; | |
561 | |
562 // Walk the hashtable. Inject by world. | |
563 const UserScriptMap* userScripts = m_page->group().userScripts(); | |
564 if (!userScripts) | |
565 return; | |
566 UserScriptMap::const_iterator end = userScripts->end(); | |
567 for (UserScriptMap::const_iterator it = userScripts->begin(); it != end; ++i
t) | |
568 injectUserScriptsForWorld(it->key.get(), *it->value, injectionTime); | |
569 } | |
570 | |
571 void Frame::injectUserScriptsForWorld(DOMWrapperWorld* world, const UserScriptVe
ctor& userScripts, UserScriptInjectionTime injectionTime) | |
572 { | |
573 if (userScripts.isEmpty()) | |
574 return; | |
575 | |
576 Document* doc = document(); | |
577 if (!doc) | |
578 return; | |
579 | |
580 Vector<ScriptSourceCode> sourceCode; | |
581 unsigned count = userScripts.size(); | |
582 for (unsigned i = 0; i < count; ++i) { | |
583 UserScript* script = userScripts[i].get(); | |
584 if (script->injectedFrames() == InjectInTopFrameOnly && ownerElement()) | |
585 continue; | |
586 | |
587 if (script->injectionTime() == injectionTime && UserContentURLPattern::m
atchesPatterns(doc->url(), script->whitelist(), script->blacklist())) | |
588 m_script.evaluateInWorld(ScriptSourceCode(script->source(), script->
url()), world); | |
589 } | |
590 } | |
591 | |
592 RenderView* Frame::contentRenderer() const | 554 RenderView* Frame::contentRenderer() const |
593 { | 555 { |
594 return document() ? document()->renderView() : 0; | 556 return document() ? document()->renderView() : 0; |
595 } | 557 } |
596 | 558 |
597 RenderPart* Frame::ownerRenderer() const | 559 RenderPart* Frame::ownerRenderer() const |
598 { | 560 { |
599 HTMLFrameOwnerElement* ownerElement = m_ownerElement; | 561 HTMLFrameOwnerElement* ownerElement = m_ownerElement; |
600 if (!ownerElement) | 562 if (!ownerElement) |
601 return 0; | 563 return 0; |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); | 1008 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); |
1047 buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.ma
xY())); | 1009 buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.ma
xY())); |
1048 | 1010 |
1049 m_view->paintContents(buffer->context(), paintingRect); | 1011 m_view->paintContents(buffer->context(), paintingRect); |
1050 | 1012 |
1051 RefPtr<Image> image = buffer->copyImage(); | 1013 RefPtr<Image> image = buffer->copyImage(); |
1052 return createDragImageFromImage(image.get()); | 1014 return createDragImageFromImage(image.get()); |
1053 } | 1015 } |
1054 | 1016 |
1055 } // namespace WebCore | 1017 } // namespace WebCore |
OLD | NEW |