OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "config.h" | 26 #include "config.h" |
27 #include "MockPagePopupDriver.h" | 27 #include "MockPagePopupDriver.h" |
28 | 28 |
29 #include "CSSPropertyNames.h" | 29 #include "CSSPropertyNames.h" |
30 #include "CSSValueKeywords.h" | 30 #include "CSSValueKeywords.h" |
31 #include "core/html/HTMLIFrameElement.h" | 31 #include "core/html/HTMLIFrameElement.h" |
32 #include "core/loader/DocumentLoader.h" | 32 #include "core/loader/DocumentLoader.h" |
33 #include "core/loader/DocumentWriter.h" | 33 #include "core/loader/DocumentWriter.h" |
34 #include "core/loader/FrameLoader.h" | 34 #include "core/loader/FrameLoader.h" |
35 #include "core/page/Frame.h" | 35 #include "core/page/Frame.h" |
| 36 #include "core/page/FrameView.h" |
36 #include "core/page/PagePopup.h" | 37 #include "core/page/PagePopup.h" |
37 #include "core/page/PagePopupClient.h" | 38 #include "core/page/PagePopupClient.h" |
38 #include "core/page/PagePopupController.h" | 39 #include "core/page/PagePopupController.h" |
39 #include "core/platform/Timer.h" | 40 #include "core/platform/Timer.h" |
40 | 41 |
41 namespace WebCore { | 42 namespace WebCore { |
42 | 43 |
43 class MockPagePopup : public PagePopup, public RefCounted<MockPagePopup> { | 44 class MockPagePopup : public PagePopup, public RefCounted<MockPagePopup> { |
44 public: | 45 public: |
45 static PassRefPtr<MockPagePopup> create(PagePopupClient*, const IntRect& ori
ginBoundsInRootView, Frame*); | 46 static PassRefPtr<MockPagePopup> create(PagePopupClient*, const IntRect& ori
ginBoundsInRootView, Frame*); |
(...skipping 21 matching lines...) Expand all Loading... |
67 m_iframe->setInlineStyleProperty(CSSPropertyLeft, originBoundsInRootView.x()
, CSSPrimitiveValue::CSS_PX, true); | 68 m_iframe->setInlineStyleProperty(CSSPropertyLeft, originBoundsInRootView.x()
, CSSPrimitiveValue::CSS_PX, true); |
68 m_iframe->setInlineStyleProperty(CSSPropertyTop, originBoundsInRootView.maxY
(), CSSPrimitiveValue::CSS_PX, true); | 69 m_iframe->setInlineStyleProperty(CSSPropertyTop, originBoundsInRootView.maxY
(), CSSPrimitiveValue::CSS_PX, true); |
69 if (document->body()) | 70 if (document->body()) |
70 document->body()->appendChild(m_iframe.get(), ASSERT_NO_EXCEPTION, Attac
hLazily); | 71 document->body()->appendChild(m_iframe.get(), ASSERT_NO_EXCEPTION, Attac
hLazily); |
71 Frame* contentFrame = m_iframe->contentFrame(); | 72 Frame* contentFrame = m_iframe->contentFrame(); |
72 DocumentWriter* writer = contentFrame->loader()->activeDocumentLoader()->beg
inWriting("text/html", "UTF-8"); | 73 DocumentWriter* writer = contentFrame->loader()->activeDocumentLoader()->beg
inWriting("text/html", "UTF-8"); |
73 const char scriptToSetUpPagePopupController[] = "<script>window.pagePopupCon
troller = parent.internals.pagePopupController;</script>"; | 74 const char scriptToSetUpPagePopupController[] = "<script>window.pagePopupCon
troller = parent.internals.pagePopupController;</script>"; |
74 writer->addData(scriptToSetUpPagePopupController, sizeof(scriptToSetUpPagePo
pupController)); | 75 writer->addData(scriptToSetUpPagePopupController, sizeof(scriptToSetUpPagePo
pupController)); |
75 m_popupClient->writeDocument(*writer); | 76 m_popupClient->writeDocument(*writer); |
76 contentFrame->loader()->activeDocumentLoader()->endWriting(writer); | 77 contentFrame->loader()->activeDocumentLoader()->endWriting(writer); |
| 78 document->view()->updateLayoutAndStyleIfNeededRecursive(); |
77 } | 79 } |
78 | 80 |
79 PassRefPtr<MockPagePopup> MockPagePopup::create(PagePopupClient* client, const I
ntRect& originBoundsInRootView, Frame* mainFrame) | 81 PassRefPtr<MockPagePopup> MockPagePopup::create(PagePopupClient* client, const I
ntRect& originBoundsInRootView, Frame* mainFrame) |
80 { | 82 { |
81 return adoptRef(new MockPagePopup(client, originBoundsInRootView, mainFrame)
); | 83 return adoptRef(new MockPagePopup(client, originBoundsInRootView, mainFrame)
); |
82 } | 84 } |
83 | 85 |
84 void MockPagePopup::closeLater() | 86 void MockPagePopup::closeLater() |
85 { | 87 { |
86 ref(); | 88 ref(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 { | 134 { |
133 if (!popup || popup != m_mockPagePopup.get()) | 135 if (!popup || popup != m_mockPagePopup.get()) |
134 return; | 136 return; |
135 m_mockPagePopup->closeLater(); | 137 m_mockPagePopup->closeLater(); |
136 m_mockPagePopup.clear(); | 138 m_mockPagePopup.clear(); |
137 m_pagePopupController->clearPagePopupClient(); | 139 m_pagePopupController->clearPagePopupClient(); |
138 m_pagePopupController.clear(); | 140 m_pagePopupController.clear(); |
139 } | 141 } |
140 | 142 |
141 } | 143 } |
OLD | NEW |