| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 if (webInputEventKeyState & WebInputEvent::MetaKey) | 264 if (webInputEventKeyState & WebInputEvent::MetaKey) |
| 265 platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::
MetaKey; | 265 platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::
MetaKey; |
| 266 return platformEventKeyState; | 266 return platformEventKeyState; |
| 267 } | 267 } |
| 268 | 268 |
| 269 // WebView ---------------------------------------------------------------- | 269 // WebView ---------------------------------------------------------------- |
| 270 | 270 |
| 271 WebView* WebView::create(WebViewClient* client) | 271 WebView* WebView::create(WebViewClient* client) |
| 272 { | 272 { |
| 273 // Pass the WebViewImpl's self-reference to the caller. | 273 // Pass the WebViewImpl's self-reference to the caller. |
| 274 return WebViewImpl::create(client); |
| 275 } |
| 276 |
| 277 WebViewImpl* WebViewImpl::create(WebViewClient* client) |
| 278 { |
| 279 // Pass the WebViewImpl's self-reference to the caller. |
| 274 return adoptRef(new WebViewImpl(client)).leakRef(); | 280 return adoptRef(new WebViewImpl(client)).leakRef(); |
| 275 } | 281 } |
| 276 | 282 |
| 277 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) | 283 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) |
| 278 { | 284 { |
| 279 shouldUseExternalPopupMenus = useExternalPopupMenus; | 285 shouldUseExternalPopupMenus = useExternalPopupMenus; |
| 280 } | 286 } |
| 281 | 287 |
| 282 void WebView::updateVisitedLinkState(unsigned long long linkHash) | 288 void WebView::updateVisitedLinkState(unsigned long long linkHash) |
| 283 { | 289 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 307 } | 313 } |
| 308 | 314 |
| 309 void WebView::didExitModalLoop() | 315 void WebView::didExitModalLoop() |
| 310 { | 316 { |
| 311 ASSERT(pageGroupLoadDeferrerStack().size()); | 317 ASSERT(pageGroupLoadDeferrerStack().size()); |
| 312 | 318 |
| 313 delete pageGroupLoadDeferrerStack().last(); | 319 delete pageGroupLoadDeferrerStack().last(); |
| 314 pageGroupLoadDeferrerStack().removeLast(); | 320 pageGroupLoadDeferrerStack().removeLast(); |
| 315 } | 321 } |
| 316 | 322 |
| 323 void WebViewImpl::setMainFrame(WebFrame* frame) |
| 324 { |
| 325 // NOTE: The WebFrameImpl takes a reference to itself within |
| 326 // initializeAsMainFrame() and releases that reference once the |
| 327 // corresponding Frame is destroyed. |
| 328 toWebFrameImpl(frame)->initializeAsMainFrame(page()); |
| 329 } |
| 330 |
| 317 void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) | 331 void WebViewImpl::initializeMainFrame(WebFrameClient* frameClient) |
| 318 { | 332 { |
| 319 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame | 333 // NOTE: Previously, WebViewImpl was responsible for allocating its own |
| 320 // and releases that reference once the corresponding Frame is destroyed. | 334 // mainframe. This code is for supporting clients that have yet to move |
| 321 RefPtr<WebFrameImpl> frame = WebFrameImpl::create(frameClient); | 335 // to setMainFrame(). Though the setMainFrame() accepts a raw pointer, it |
| 322 | 336 // implicitly takes a refcount on the frame. Dropping our RefPtr here |
| 323 frame->initializeAsMainFrame(page()); | 337 // will effectively pass ownership to m_page. New users of WebViewImpl |
| 324 } | 338 // should call WebFrameImpl::create() to construct their own mainframe, |
| 325 | 339 // pass it into WebViewImpl::setMainFrame(), keep a pointer to the |
| 326 void WebViewImpl::initializeHelperPluginFrame(WebFrameClient* client) | 340 // mainframe, and call WebFrameImpl::close() on it when closing the |
| 327 { | 341 // WebViewImpl. |
| 328 RefPtr<WebFrameImpl> frame = WebFrameImpl::create(client); | 342 RefPtr<WebFrameImpl> frame = adoptRef(WebFrameImpl::create(frameClient)); |
| 343 setMainFrame(frame.get()); |
| 329 } | 344 } |
| 330 | 345 |
| 331 void WebViewImpl::setAutofillClient(WebAutofillClient* autofillClient) | 346 void WebViewImpl::setAutofillClient(WebAutofillClient* autofillClient) |
| 332 { | 347 { |
| 333 m_autofillClient = autofillClient; | 348 m_autofillClient = autofillClient; |
| 334 } | 349 } |
| 335 | 350 |
| 336 void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient) | 351 void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient) |
| 337 { | 352 { |
| 338 if (devToolsClient) | 353 if (devToolsClient) |
| (...skipping 3845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4184 // the initial viewport width. | 4199 // the initial viewport width. |
| 4185 // 2. The author has disabled viewport zoom. | 4200 // 2. The author has disabled viewport zoom. |
| 4186 | 4201 |
| 4187 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4202 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4188 | 4203 |
| 4189 return fixedLayoutSize().width == m_size.width | 4204 return fixedLayoutSize().width == m_size.width |
| 4190 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4205 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4191 } | 4206 } |
| 4192 | 4207 |
| 4193 } // namespace WebKit | 4208 } // namespace WebKit |
| OLD | NEW |