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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 static inline float parentTextZoomFactor(Frame* frame) | 95 static inline float parentTextZoomFactor(Frame* frame) |
96 { | 96 { |
97 Frame* parent = frame->tree().parent(); | 97 Frame* parent = frame->tree().parent(); |
98 if (!parent) | 98 if (!parent) |
99 return 1; | 99 return 1; |
100 return parent->textZoomFactor(); | 100 return parent->textZoomFactor(); |
101 } | 101 } |
102 | 102 |
103 inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader
Client* frameLoaderClient) | 103 inline Frame::Frame(PassRefPtr<FrameInit> frameInit) |
104 : m_page(page) | 104 : m_page(frameInit->page()) |
105 , m_treeNode(this, parentFromOwnerElement(ownerElement)) | 105 , m_treeNode(this, parentFromOwnerElement(frameInit->ownerElement())) |
106 , m_loader(this, frameLoaderClient) | 106 , m_loader(this, frameInit->frameLoaderClient()) |
107 , m_navigationScheduler(this) | 107 , m_navigationScheduler(this) |
108 , m_ownerElement(ownerElement) | |
109 , m_script(adoptPtr(new ScriptController(this))) | 108 , m_script(adoptPtr(new ScriptController(this))) |
110 , m_editor(Editor::create(*this)) | 109 , m_editor(Editor::create(*this)) |
111 , m_spellChecker(SpellChecker::create(*this)) | 110 , m_spellChecker(SpellChecker::create(*this)) |
112 , m_selection(adoptPtr(new FrameSelection(this))) | 111 , m_selection(adoptPtr(new FrameSelection(this))) |
113 , m_eventHandler(adoptPtr(new EventHandler(this))) | 112 , m_eventHandler(adoptPtr(new EventHandler(this))) |
114 , m_animationController(adoptPtr(new AnimationController(this))) | 113 , m_animationController(adoptPtr(new AnimationController(this))) |
115 , m_inputMethodController(InputMethodController::create(*this)) | 114 , m_inputMethodController(InputMethodController::create(*this)) |
| 115 , m_frameInit(frameInit) |
116 , m_pageZoomFactor(parentPageZoomFactor(this)) | 116 , m_pageZoomFactor(parentPageZoomFactor(this)) |
117 , m_textZoomFactor(parentTextZoomFactor(this)) | 117 , m_textZoomFactor(parentTextZoomFactor(this)) |
118 #if ENABLE(ORIENTATION_EVENTS) | 118 #if ENABLE(ORIENTATION_EVENTS) |
119 , m_orientation(0) | 119 , m_orientation(0) |
120 #endif | 120 #endif |
121 , m_inViewSourceMode(false) | 121 , m_inViewSourceMode(false) |
122 { | 122 { |
123 ASSERT(page); | 123 ASSERT(m_page); |
124 | 124 |
125 if (ownerElement) { | 125 if (ownerElement()) { |
126 page->incrementSubframeCount(); | 126 m_page->incrementSubframeCount(); |
127 ownerElement->setContentFrame(*this); | 127 ownerElement()->setContentFrame(*this); |
128 } | 128 } |
129 | 129 |
130 #ifndef NDEBUG | 130 #ifndef NDEBUG |
131 frameCounter.increment(); | 131 frameCounter.increment(); |
132 #endif | 132 #endif |
133 } | 133 } |
134 | 134 |
135 PassRefPtr<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement,
FrameLoaderClient* client) | 135 PassRefPtr<Frame> Frame::create(PassRefPtr<FrameInit> frameInit) |
136 { | 136 { |
137 RefPtr<Frame> frame = adoptRef(new Frame(page, ownerElement, client)); | 137 RefPtr<Frame> frame = adoptRef(new Frame(frameInit)); |
138 if (!ownerElement) | 138 if (!frame->ownerElement()) |
139 page->setMainFrame(frame); | 139 frame->page()->setMainFrame(frame); |
140 InspectorInstrumentation::frameAttachedToParent(frame.get()); | 140 InspectorInstrumentation::frameAttachedToParent(frame.get()); |
141 return frame.release(); | 141 return frame.release(); |
142 } | 142 } |
143 | 143 |
144 Frame::~Frame() | 144 Frame::~Frame() |
145 { | 145 { |
146 setView(0); | 146 setView(0); |
147 loader().clear(ClearScriptObjects | ClearWindowObject); | 147 loader().clear(ClearScriptObjects | ClearWindowObject); |
148 | 148 |
149 // FIXME: We should not be doing all this work inside the destructor | 149 // FIXME: We should not be doing all this work inside the destructor |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return m_domWindow ? m_domWindow->document() : 0; | 282 return m_domWindow ? m_domWindow->document() : 0; |
283 } | 283 } |
284 | 284 |
285 RenderView* Frame::contentRenderer() const | 285 RenderView* Frame::contentRenderer() const |
286 { | 286 { |
287 return document() ? document()->renderView() : 0; | 287 return document() ? document()->renderView() : 0; |
288 } | 288 } |
289 | 289 |
290 RenderPart* Frame::ownerRenderer() const | 290 RenderPart* Frame::ownerRenderer() const |
291 { | 291 { |
292 HTMLFrameOwnerElement* ownerElement = m_ownerElement; | 292 if (!ownerElement()) |
293 if (!ownerElement) | |
294 return 0; | 293 return 0; |
295 RenderObject* object = ownerElement->renderer(); | 294 RenderObject* object = ownerElement()->renderer(); |
296 if (!object) | 295 if (!object) |
297 return 0; | 296 return 0; |
298 // FIXME: If <object> is ever fixed to disassociate itself from frames | 297 // FIXME: If <object> is ever fixed to disassociate itself from frames |
299 // that it has started but canceled, then this can turn into an ASSERT | 298 // that it has started but canceled, then this can turn into an ASSERT |
300 // since m_ownerElement would be 0 when the load is canceled. | 299 // since ownerElement() would be 0 when the load is canceled. |
301 // https://bugs.webkit.org/show_bug.cgi?id=18585 | 300 // https://bugs.webkit.org/show_bug.cgi?id=18585 |
302 if (!object->isRenderPart()) | 301 if (!object->isRenderPart()) |
303 return 0; | 302 return 0; |
304 return toRenderPart(object); | 303 return toRenderPart(object); |
305 } | 304 } |
306 | 305 |
307 void Frame::dispatchVisibilityStateChangeEvent() | 306 void Frame::dispatchVisibilityStateChangeEvent() |
308 { | 307 { |
309 if (document()) | 308 if (document()) |
310 document()->dispatchVisibilityStateChangeEvent(); | 309 document()->dispatchVisibilityStateChangeEvent(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 341 |
343 void Frame::detachFromPage() | 342 void Frame::detachFromPage() |
344 { | 343 { |
345 // We should never be detatching the page during a Layout. | 344 // We should never be detatching the page during a Layout. |
346 RELEASE_ASSERT(!m_view || !m_view->isInLayout()); | 345 RELEASE_ASSERT(!m_view || !m_view->isInLayout()); |
347 m_page = 0; | 346 m_page = 0; |
348 } | 347 } |
349 | 348 |
350 void Frame::disconnectOwnerElement() | 349 void Frame::disconnectOwnerElement() |
351 { | 350 { |
352 if (m_ownerElement) { | 351 if (ownerElement()) { |
353 if (Document* doc = document()) | 352 if (Document* doc = document()) |
354 doc->topDocument()->clearAXObjectCache(); | 353 doc->topDocument()->clearAXObjectCache(); |
355 m_ownerElement->clearContentFrame(); | 354 ownerElement()->clearContentFrame(); |
356 if (m_page) | 355 if (m_page) |
357 m_page->decrementSubframeCount(); | 356 m_page->decrementSubframeCount(); |
358 } | 357 } |
359 m_ownerElement = 0; | 358 m_frameInit->setOwnerElement(0); |
360 } | 359 } |
361 | 360 |
362 String Frame::documentTypeString() const | 361 String Frame::documentTypeString() const |
363 { | 362 { |
364 if (DocumentType* doctype = document()->doctype()) | 363 if (DocumentType* doctype = document()->doctype()) |
365 return createMarkup(doctype); | 364 return createMarkup(doctype); |
366 | 365 |
367 return String(); | 366 return String(); |
368 } | 367 } |
369 | 368 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 if (!m_page) | 676 if (!m_page) |
678 return 0; | 677 return 0; |
679 | 678 |
680 double ratio = m_page->deviceScaleFactor(); | 679 double ratio = m_page->deviceScaleFactor(); |
681 if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled()) | 680 if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled()) |
682 ratio *= pageZoomFactor(); | 681 ratio *= pageZoomFactor(); |
683 return ratio; | 682 return ratio; |
684 } | 683 } |
685 | 684 |
686 } // namespace WebCore | 685 } // namespace WebCore |
OLD | NEW |