| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2010-2011 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 { | 205 { |
| 206 WebCore::FrameView* view = frameView(); | 206 WebCore::FrameView* view = frameView(); |
| 207 if (!view) | 207 if (!view) |
| 208 return; | 208 return; |
| 209 | 209 |
| 210 m_emulatedFrameSize = WebSize(width, height); | 210 m_emulatedFrameSize = WebSize(width, height); |
| 211 m_fitWindow = fitWindow; | 211 m_fitWindow = fitWindow; |
| 212 m_originalZoomFactor = 0; | 212 m_originalZoomFactor = 0; |
| 213 m_webView->setTextZoomFactor(textZoomFactor); | 213 m_webView->setTextZoomFactor(textZoomFactor); |
| 214 applySizeOverrideInternal(view, FitWindowAllowed); | 214 applySizeOverrideInternal(view, FitWindowAllowed); |
| 215 autoZoomPageToFitWidth(view->frame()); | 215 autoZoomPageToFitWidth(&view->frame()); |
| 216 | 216 |
| 217 m_webView->sendResizeEventAndRepaint(); | 217 m_webView->sendResizeEventAndRepaint(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void autoZoomPageToFitWidthOnNavigation(Frame* frame) | 220 void autoZoomPageToFitWidthOnNavigation(Frame* frame) |
| 221 { | 221 { |
| 222 FrameView* frameView = frame->view(); | 222 FrameView* frameView = frame->view(); |
| 223 applySizeOverrideInternal(frameView, FitWindowNotAllowed); | 223 applySizeOverrideInternal(frameView, FitWindowNotAllowed); |
| 224 m_originalZoomFactor = 0; | 224 m_originalZoomFactor = 0; |
| 225 applySizeOverrideInternal(frameView, FitWindowAllowed); | 225 applySizeOverrideInternal(frameView, FitWindowAllowed); |
| 226 autoZoomPageToFitWidth(frame); | 226 autoZoomPageToFitWidth(frame); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void autoZoomPageToFitWidth(Frame* frame) | 229 void autoZoomPageToFitWidth(Frame* frame) |
| 230 { | 230 { |
| 231 if (!frame) | |
| 232 return; | |
| 233 | |
| 234 frame->setTextZoomFactor(m_webView->textZoomFactor()); | 231 frame->setTextZoomFactor(m_webView->textZoomFactor()); |
| 235 ensureOriginalZoomFactor(frame->view()); | 232 ensureOriginalZoomFactor(frame->view()); |
| 236 Document* document = frame->document(); | 233 Document* document = frame->document(); |
| 237 float numerator = document->renderView() ? document->renderView()->viewW
idth() : frame->view()->contentsWidth(); | 234 float numerator = document->renderView() ? document->renderView()->viewW
idth() : frame->view()->contentsWidth(); |
| 238 float factor = m_originalZoomFactor * (numerator / m_emulatedFrameSize.w
idth); | 235 float factor = m_originalZoomFactor * (numerator / m_emulatedFrameSize.w
idth); |
| 239 frame->setPageAndTextZoomFactors(factor, m_webView->textZoomFactor()); | 236 frame->setPageAndTextZoomFactors(factor, m_webView->textZoomFactor()); |
| 240 document->styleResolverChanged(RecalcStyleImmediately); | 237 document->styleResolverChanged(RecalcStyleImmediately); |
| 241 document->updateLayout(); | 238 document->updateLayout(); |
| 242 } | 239 } |
| 243 | 240 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 { | 328 { |
| 332 WebSize scrollbarDimensions = forcedScrollbarDimensions(frameView); | 329 WebSize scrollbarDimensions = forcedScrollbarDimensions(frameView); |
| 333 | 330 |
| 334 WebSize effectiveEmulatedSize = (fitWindowFlag == FitWindowAllowed) ? sc
aledEmulatedFrameSize(frameView) : m_emulatedFrameSize; | 331 WebSize effectiveEmulatedSize = (fitWindowFlag == FitWindowAllowed) ? sc
aledEmulatedFrameSize(frameView) : m_emulatedFrameSize; |
| 335 int overrideWidth = effectiveEmulatedSize.width + scrollbarDimensions.wi
dth; | 332 int overrideWidth = effectiveEmulatedSize.width + scrollbarDimensions.wi
dth; |
| 336 int overrideHeight = effectiveEmulatedSize.height + scrollbarDimensions.
height; | 333 int overrideHeight = effectiveEmulatedSize.height + scrollbarDimensions.
height; |
| 337 | 334 |
| 338 if (IntSize(overrideWidth, overrideHeight) != frameView->size()) | 335 if (IntSize(overrideWidth, overrideHeight) != frameView->size()) |
| 339 frameView->resize(overrideWidth, overrideHeight); | 336 frameView->resize(overrideWidth, overrideHeight); |
| 340 | 337 |
| 341 Document* doc = frameView->frame()->document(); | 338 Document* doc = frameView->frame().document(); |
| 342 doc->styleResolverChanged(RecalcStyleImmediately); | 339 doc->styleResolverChanged(RecalcStyleImmediately); |
| 343 doc->updateLayout(); | 340 doc->updateLayout(); |
| 344 } | 341 } |
| 345 | 342 |
| 346 WebCore::FrameView* frameView() | 343 WebCore::FrameView* frameView() |
| 347 { | 344 { |
| 348 return m_webView->mainFrameImpl() ? m_webView->mainFrameImpl()->frameVie
w() : 0; | 345 return m_webView->mainFrameImpl() ? m_webView->mainFrameImpl()->frameVie
w() : 0; |
| 349 } | 346 } |
| 350 | 347 |
| 351 WebViewImpl* m_webView; | 348 WebViewImpl* m_webView; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 || commandName == InspectorBackendDispatcher::commandNames[InspectorBack
endDispatcher::kProfiler_getCPUProfileCmd] | 756 || commandName == InspectorBackendDispatcher::commandNames[InspectorBack
endDispatcher::kProfiler_getCPUProfileCmd] |
| 760 || commandName == InspectorBackendDispatcher::commandNames[InspectorBack
endDispatcher::kHeapProfiler_getHeapSnapshotCmd]; | 757 || commandName == InspectorBackendDispatcher::commandNames[InspectorBack
endDispatcher::kHeapProfiler_getHeapSnapshotCmd]; |
| 761 } | 758 } |
| 762 | 759 |
| 763 void WebDevToolsAgent::processPendingMessages() | 760 void WebDevToolsAgent::processPendingMessages() |
| 764 { | 761 { |
| 765 PageScriptDebugServer::shared().runPendingTasks(); | 762 PageScriptDebugServer::shared().runPendingTasks(); |
| 766 } | 763 } |
| 767 | 764 |
| 768 } // namespace WebKit | 765 } // namespace WebKit |
| OLD | NEW |