| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 PagePopupClient* m_popupClient; | 54 PagePopupClient* m_popupClient; |
| 55 RefPtr<HTMLIFrameElement> m_iframe; | 55 RefPtr<HTMLIFrameElement> m_iframe; |
| 56 Timer<MockPagePopup> m_closeTimer; | 56 Timer<MockPagePopup> m_closeTimer; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 inline MockPagePopup::MockPagePopup(PagePopupClient* client, const IntRect& orig
inBoundsInRootView, Frame* mainFrame) | 59 inline MockPagePopup::MockPagePopup(PagePopupClient* client, const IntRect& orig
inBoundsInRootView, Frame* mainFrame) |
| 60 : m_popupClient(client) | 60 : m_popupClient(client) |
| 61 , m_closeTimer(this, &MockPagePopup::close) | 61 , m_closeTimer(this, &MockPagePopup::close) |
| 62 { | 62 { |
| 63 Document* document = mainFrame->document(); | 63 Document* document = mainFrame->document(); |
| 64 m_iframe = HTMLIFrameElement::create(HTMLNames::iframeTag, document); | 64 ASSERT(document); |
| 65 m_iframe = HTMLIFrameElement::create(HTMLNames::iframeTag, *document); |
| 65 m_iframe->setIdAttribute("mock-page-popup"); | 66 m_iframe->setIdAttribute("mock-page-popup"); |
| 66 m_iframe->setInlineStyleProperty(CSSPropertyBorderWidth, 0.0, CSSPrimitiveVa
lue::CSS_PX); | 67 m_iframe->setInlineStyleProperty(CSSPropertyBorderWidth, 0.0, CSSPrimitiveVa
lue::CSS_PX); |
| 67 m_iframe->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute); | 68 m_iframe->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute); |
| 68 m_iframe->setInlineStyleProperty(CSSPropertyLeft, originBoundsInRootView.x()
, CSSPrimitiveValue::CSS_PX, true); | 69 m_iframe->setInlineStyleProperty(CSSPropertyLeft, originBoundsInRootView.x()
, CSSPrimitiveValue::CSS_PX, true); |
| 69 m_iframe->setInlineStyleProperty(CSSPropertyTop, originBoundsInRootView.maxY
(), CSSPrimitiveValue::CSS_PX, true); | 70 m_iframe->setInlineStyleProperty(CSSPropertyTop, originBoundsInRootView.maxY
(), CSSPrimitiveValue::CSS_PX, true); |
| 70 if (document->body()) | 71 if (document->body()) |
| 71 document->body()->appendChild(m_iframe.get()); | 72 document->body()->appendChild(m_iframe.get()); |
| 72 Frame* contentFrame = m_iframe->contentFrame(); | 73 Frame* contentFrame = m_iframe->contentFrame(); |
| 73 DocumentWriter* writer = contentFrame->loader()->activeDocumentLoader()->beg
inWriting("text/html", "UTF-8"); | 74 DocumentWriter* writer = contentFrame->loader()->activeDocumentLoader()->beg
inWriting("text/html", "UTF-8"); |
| 74 const char scriptToSetUpPagePopupController[] = "<script>window.pagePopupCon
troller = parent.internals.pagePopupController;</script>"; | 75 const char scriptToSetUpPagePopupController[] = "<script>window.pagePopupCon
troller = parent.internals.pagePopupController;</script>"; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 { | 134 { |
| 134 if (!popup || popup != m_mockPagePopup.get()) | 135 if (!popup || popup != m_mockPagePopup.get()) |
| 135 return; | 136 return; |
| 136 m_mockPagePopup->closeLater(); | 137 m_mockPagePopup->closeLater(); |
| 137 m_mockPagePopup.clear(); | 138 m_mockPagePopup.clear(); |
| 138 m_pagePopupController->clearPagePopupClient(); | 139 m_pagePopupController->clearPagePopupClient(); |
| 139 m_pagePopupController.clear(); | 140 m_pagePopupController.clear(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 } | 143 } |
| OLD | NEW |