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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 #include "MathMLNames.h" | 103 #include "MathMLNames.h" |
104 #include "SVGNames.h" | 104 #include "SVGNames.h" |
105 #include "XLinkNames.h" | 105 #include "XLinkNames.h" |
106 | 106 |
107 #if ENABLE(SVG) | 107 #if ENABLE(SVG) |
108 #include "SVGDocument.h" | 108 #include "SVGDocument.h" |
109 #include "SVGDocumentExtensions.h" | 109 #include "SVGDocumentExtensions.h" |
110 #endif | 110 #endif |
111 | 111 |
112 #if USE(TILED_BACKING_STORE) | |
113 #include "TiledBackingStore.h" | |
114 #endif | |
115 | |
116 using namespace std; | 112 using namespace std; |
117 | 113 |
118 namespace WebCore { | 114 namespace WebCore { |
119 | 115 |
120 using namespace HTMLNames; | 116 using namespace HTMLNames; |
121 | 117 |
122 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame")); | 118 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame")); |
123 | 119 |
124 static inline Frame* parentFromOwnerElement(HTMLFrameOwnerElement* ownerElement) | 120 static inline Frame* parentFromOwnerElement(HTMLFrameOwnerElement* ownerElement) |
125 { | 121 { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 HTMLNames::init(); | 164 HTMLNames::init(); |
169 QualifiedName::init(); | 165 QualifiedName::init(); |
170 MediaFeatureNames::init(); | 166 MediaFeatureNames::init(); |
171 SVGNames::init(); | 167 SVGNames::init(); |
172 XLinkNames::init(); | 168 XLinkNames::init(); |
173 MathMLNames::init(); | 169 MathMLNames::init(); |
174 XMLNSNames::init(); | 170 XMLNSNames::init(); |
175 XMLNames::init(); | 171 XMLNames::init(); |
176 WebKitFontFamilyNames::init(); | 172 WebKitFontFamilyNames::init(); |
177 | 173 |
178 if (!ownerElement) { | 174 if (ownerElement) { |
179 #if USE(TILED_BACKING_STORE) | |
180 // Top level frame only for now. | |
181 setTiledBackingStoreEnabled(page->settings()->tiledBackingStoreEnabled()
); | |
182 #endif | |
183 } else { | |
184 page->incrementSubframeCount(); | 175 page->incrementSubframeCount(); |
185 ownerElement->setContentFrame(this); | 176 ownerElement->setContentFrame(this); |
186 } | 177 } |
187 | 178 |
188 #ifndef NDEBUG | 179 #ifndef NDEBUG |
189 frameCounter.increment(); | 180 frameCounter.increment(); |
190 #endif | 181 #endif |
191 | 182 |
192 // Pause future ActiveDOMObjects if this frame is being created while the pa
ge is in a paused state. | 183 // Pause future ActiveDOMObjects if this frame is being created while the pa
ge is in a paused state. |
193 Frame* parent = parentFromOwnerElement(ownerElement); | 184 Frame* parent = parentFromOwnerElement(ownerElement); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 m_view->unscheduleRelayout(); | 254 m_view->unscheduleRelayout(); |
264 | 255 |
265 eventHandler()->clear(); | 256 eventHandler()->clear(); |
266 | 257 |
267 m_view = view; | 258 m_view = view; |
268 | 259 |
269 // Only one form submission is allowed per view of a part. | 260 // Only one form submission is allowed per view of a part. |
270 // Since this part may be getting reused as a result of being | 261 // Since this part may be getting reused as a result of being |
271 // pulled from the back/forward cache, reset this flag. | 262 // pulled from the back/forward cache, reset this flag. |
272 loader()->resetMultipleFormSubmissionProtection(); | 263 loader()->resetMultipleFormSubmissionProtection(); |
273 | |
274 #if USE(TILED_BACKING_STORE) | |
275 if (m_view && tiledBackingStore()) | |
276 m_view->setPaintsEntireContents(true); | |
277 #endif | |
278 } | 264 } |
279 | 265 |
280 void Frame::setDocument(PassRefPtr<Document> newDoc) | 266 void Frame::setDocument(PassRefPtr<Document> newDoc) |
281 { | 267 { |
282 ASSERT(!newDoc || newDoc->frame() == this); | 268 ASSERT(!newDoc || newDoc->frame() == this); |
283 if (m_doc && m_doc->attached() && !m_doc->inPageCache()) { | 269 if (m_doc && m_doc->attached() && !m_doc->inPageCache()) { |
284 // FIXME: We don't call willRemove here. Why is that OK? | 270 // FIXME: We don't call willRemove here. Why is that OK? |
285 m_doc->detach(); | 271 m_doc->detach(); |
286 } | 272 } |
287 | 273 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 if (isMainFrame) | 793 if (isMainFrame) |
808 frameView->setParentVisible(true); | 794 frameView->setParentVisible(true); |
809 | 795 |
810 if (ownerRenderer()) | 796 if (ownerRenderer()) |
811 ownerRenderer()->setWidget(frameView); | 797 ownerRenderer()->setWidget(frameView); |
812 | 798 |
813 if (HTMLFrameOwnerElement* owner = ownerElement()) | 799 if (HTMLFrameOwnerElement* owner = ownerElement()) |
814 view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOf
f); | 800 view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOf
f); |
815 } | 801 } |
816 | 802 |
817 #if USE(TILED_BACKING_STORE) | |
818 void Frame::setTiledBackingStoreEnabled(bool enabled) | |
819 { | |
820 if (!enabled) { | |
821 m_tiledBackingStore.clear(); | |
822 return; | |
823 } | |
824 if (m_tiledBackingStore) | |
825 return; | |
826 m_tiledBackingStore = adoptPtr(new TiledBackingStore(this)); | |
827 m_tiledBackingStore->setCommitTileUpdatesOnIdleEventLoop(true); | |
828 if (m_view) | |
829 m_view->setPaintsEntireContents(true); | |
830 } | |
831 | |
832 void Frame::tiledBackingStorePaintBegin() | |
833 { | |
834 if (!m_view) | |
835 return; | |
836 m_view->updateLayoutAndStyleIfNeededRecursive(); | |
837 m_view->flushDeferredRepaints(); | |
838 } | |
839 | |
840 void Frame::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect
) | |
841 { | |
842 if (!m_view) | |
843 return; | |
844 m_view->paintContents(context, rect); | |
845 } | |
846 | |
847 void Frame::tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea) | |
848 { | |
849 if (!m_page || !m_view) | |
850 return; | |
851 unsigned size = paintedArea.size(); | |
852 // Request repaint from the system | |
853 for (unsigned n = 0; n < size; ++n) | |
854 m_page->chrome()->invalidateContentsAndRootView(m_view->contentsToRootVi
ew(paintedArea[n]), false); | |
855 } | |
856 | |
857 IntRect Frame::tiledBackingStoreContentsRect() | |
858 { | |
859 if (!m_view) | |
860 return IntRect(); | |
861 return IntRect(IntPoint(), m_view->contentsSize()); | |
862 } | |
863 | |
864 IntRect Frame::tiledBackingStoreVisibleRect() | |
865 { | |
866 if (!m_page) | |
867 return IntRect(); | |
868 return m_page->chrome()->client()->visibleRectForTiledBackingStore(); | |
869 } | |
870 | |
871 Color Frame::tiledBackingStoreBackgroundColor() const | |
872 { | |
873 if (!m_view) | |
874 return Color(); | |
875 return m_view->baseBackgroundColor(); | |
876 } | |
877 #endif | |
878 | |
879 String Frame::layerTreeAsText(LayerTreeFlags flags) const | 803 String Frame::layerTreeAsText(LayerTreeFlags flags) const |
880 { | 804 { |
881 #if USE(ACCELERATED_COMPOSITING) | 805 #if USE(ACCELERATED_COMPOSITING) |
882 document()->updateLayout(); | 806 document()->updateLayout(); |
883 | 807 |
884 if (!contentRenderer()) | 808 if (!contentRenderer()) |
885 return String(); | 809 return String(); |
886 | 810 |
887 return contentRenderer()->compositor()->layerTreeAsText(flags); | 811 return contentRenderer()->compositor()->layerTreeAsText(flags); |
888 #else | 812 #else |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); | 1048 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); |
1125 buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.ma
xY())); | 1049 buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.ma
xY())); |
1126 | 1050 |
1127 m_view->paintContents(buffer->context(), paintingRect); | 1051 m_view->paintContents(buffer->context(), paintingRect); |
1128 | 1052 |
1129 RefPtr<Image> image = buffer->copyImage(); | 1053 RefPtr<Image> image = buffer->copyImage(); |
1130 return createDragImageFromImage(image.get()); | 1054 return createDragImageFromImage(image.get()); |
1131 } | 1055 } |
1132 | 1056 |
1133 } // namespace WebCore | 1057 } // namespace WebCore |
OLD | NEW |