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 20 matching lines...) Expand all Loading... |
31 #include "config.h" | 31 #include "config.h" |
32 #include "WebViewImpl.h" | 32 #include "WebViewImpl.h" |
33 | 33 |
34 #include "AXObjectCache.h" | 34 #include "AXObjectCache.h" |
35 #include "ActivePlatformGestureAnimation.h" | 35 #include "ActivePlatformGestureAnimation.h" |
36 #include "AutofillPopupMenuClient.h" | 36 #include "AutofillPopupMenuClient.h" |
37 #include "BackForwardListChromium.h" | 37 #include "BackForwardListChromium.h" |
38 #include "CSSStyleSelector.h" | 38 #include "CSSStyleSelector.h" |
39 #include "CSSValueKeywords.h" | 39 #include "CSSValueKeywords.h" |
40 #include "Chrome.h" | 40 #include "Chrome.h" |
| 41 #include "Color.h" |
41 #include "ColorSpace.h" | 42 #include "ColorSpace.h" |
42 #include "CompositionUnderlineVectorBuilder.h" | 43 #include "CompositionUnderlineVectorBuilder.h" |
43 #include "ContextMenu.h" | 44 #include "ContextMenu.h" |
44 #include "ContextMenuController.h" | 45 #include "ContextMenuController.h" |
45 #include "ContextMenuItem.h" | 46 #include "ContextMenuItem.h" |
46 #include "Cursor.h" | 47 #include "Cursor.h" |
47 #include "DOMUtilitiesPrivate.h" | 48 #include "DOMUtilitiesPrivate.h" |
48 #include "DeviceOrientationClientProxy.h" | 49 #include "DeviceOrientationClientProxy.h" |
49 #include "Document.h" | 50 #include "Document.h" |
50 #include "DocumentLoader.h" | 51 #include "DocumentLoader.h" |
(...skipping 3155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3206 IntRect dirtyRect = view->windowToContents(rect); | 3207 IntRect dirtyRect = view->windowToContents(rect); |
3207 updateLayerTreeViewport(); | 3208 updateLayerTreeViewport(); |
3208 m_nonCompositedContentHost->invalidateRect(dirtyRect); | 3209 m_nonCompositedContentHost->invalidateRect(dirtyRect); |
3209 } | 3210 } |
3210 | 3211 |
3211 NonCompositedContentHost* WebViewImpl::nonCompositedContentHost() | 3212 NonCompositedContentHost* WebViewImpl::nonCompositedContentHost() |
3212 { | 3213 { |
3213 return m_nonCompositedContentHost.get(); | 3214 return m_nonCompositedContentHost.get(); |
3214 } | 3215 } |
3215 | 3216 |
| 3217 void WebViewImpl::setBackgroundColor(const WebCore::Color& color) |
| 3218 { |
| 3219 WebCore::Color documentBackgroundColor = color.isValid() ? color : WebCore::
Color::white; |
| 3220 WebColor webDocumentBackgroundColor = documentBackgroundColor.rgb(); |
| 3221 m_nonCompositedContentHost->setBackgroundColor(documentBackgroundColor); |
| 3222 m_layerTreeView.setBackgroundColor(webDocumentBackgroundColor); |
| 3223 } |
| 3224 |
3216 #if ENABLE(REQUEST_ANIMATION_FRAME) | 3225 #if ENABLE(REQUEST_ANIMATION_FRAME) |
3217 void WebViewImpl::scheduleAnimation() | 3226 void WebViewImpl::scheduleAnimation() |
3218 { | 3227 { |
3219 if (isAcceleratedCompositingActive()) { | 3228 if (isAcceleratedCompositingActive()) { |
3220 if (CCProxy::hasImplThread()) { | 3229 if (CCProxy::hasImplThread()) { |
3221 ASSERT(!m_layerTreeView.isNull()); | 3230 ASSERT(!m_layerTreeView.isNull()); |
3222 m_layerTreeView.setNeedsAnimate(); | 3231 m_layerTreeView.setNeedsAnimate(); |
3223 } else | 3232 } else |
3224 m_client->scheduleAnimation(); | 3233 m_client->scheduleAnimation(); |
3225 } else | 3234 } else |
(...skipping 15 matching lines...) Expand all Loading... |
3241 Page* page = m_webViewImpl->page(); | 3250 Page* page = m_webViewImpl->page(); |
3242 if (!page) | 3251 if (!page) |
3243 return; | 3252 return; |
3244 FrameView* view = page->mainFrame()->view(); | 3253 FrameView* view = page->mainFrame()->view(); |
3245 view->paintContents(&context, contentRect); | 3254 view->paintContents(&context, contentRect); |
3246 double paintEnd = currentTime(); | 3255 double paintEnd = currentTime(); |
3247 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (pa
intEnd - paintStart); | 3256 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (pa
intEnd - paintStart); |
3248 PlatformSupport::histogramCustomCounts("Renderer4.AccelRootPaintDuration
MS", (paintEnd - paintStart) * 1000, 0, 120, 30); | 3257 PlatformSupport::histogramCustomCounts("Renderer4.AccelRootPaintDuration
MS", (paintEnd - paintStart) * 1000, 0, 120, 30); |
3249 PlatformSupport::histogramCustomCounts("Renderer4.AccelRootPaintMegapixP
erSecond", pixelsPerSec / 1000000, 10, 210, 30); | 3258 PlatformSupport::histogramCustomCounts("Renderer4.AccelRootPaintMegapixP
erSecond", pixelsPerSec / 1000000, 10, 210, 30); |
3250 | 3259 |
3251 m_webViewImpl->nonCompositedContentHost()->setBackgroundColor(view->docu
mentBackgroundColor()); | 3260 m_webViewImpl->setBackgroundColor(view->documentBackgroundColor()); |
3252 | |
3253 } | 3261 } |
3254 | 3262 |
3255 private: | 3263 private: |
3256 explicit WebViewImplContentPainter(WebViewImpl* webViewImpl) | 3264 explicit WebViewImplContentPainter(WebViewImpl* webViewImpl) |
3257 : m_webViewImpl(webViewImpl) | 3265 : m_webViewImpl(webViewImpl) |
3258 { | 3266 { |
3259 } | 3267 } |
3260 | 3268 |
3261 WebViewImpl* m_webViewImpl; | 3269 WebViewImpl* m_webViewImpl; |
3262 }; | 3270 }; |
(...skipping 26 matching lines...) Expand all Loading... |
3289 layerTreeViewSettings.showFPSCounter = settings()->showFPSCounter(); | 3297 layerTreeViewSettings.showFPSCounter = settings()->showFPSCounter(); |
3290 layerTreeViewSettings.showPlatformLayerTree = settings()->showPlatformLa
yerTree(); | 3298 layerTreeViewSettings.showPlatformLayerTree = settings()->showPlatformLa
yerTree(); |
3291 | 3299 |
3292 layerTreeViewSettings.perTilePainting = page()->settings()->perTileDrawi
ngEnabled(); | 3300 layerTreeViewSettings.perTilePainting = page()->settings()->perTileDrawi
ngEnabled(); |
3293 layerTreeViewSettings.partialSwapEnabled = page()->settings()->partialSw
apEnabled(); | 3301 layerTreeViewSettings.partialSwapEnabled = page()->settings()->partialSw
apEnabled(); |
3294 layerTreeViewSettings.threadedAnimationEnabled = page()->settings()->thr
eadedAnimationEnabled(); | 3302 layerTreeViewSettings.threadedAnimationEnabled = page()->settings()->thr
eadedAnimationEnabled(); |
3295 | 3303 |
3296 m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImp
lContentPainter::create(this)); | 3304 m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImp
lContentPainter::create(this)); |
3297 m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->show
DebugBorders()); | 3305 m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->show
DebugBorders()); |
3298 | 3306 |
3299 if (page() && page()->mainFrame()->view()) | |
3300 m_nonCompositedContentHost->setBackgroundColor(page()->mainFrame()->
view()->documentBackgroundColor()); | |
3301 | |
3302 m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings); | 3307 m_layerTreeView.initialize(this, m_rootLayer, layerTreeViewSettings); |
3303 if (!m_layerTreeView.isNull()) { | 3308 if (!m_layerTreeView.isNull()) { |
3304 m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_min
imumPageScaleFactor, m_maximumPageScaleFactor); | 3309 m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_min
imumPageScaleFactor, m_maximumPageScaleFactor); |
3305 updateLayerTreeViewport(); | 3310 updateLayerTreeViewport(); |
3306 m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier
()); | 3311 m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier
()); |
3307 m_isAcceleratedCompositingActive = true; | 3312 m_isAcceleratedCompositingActive = true; |
3308 m_compositorCreationFailed = false; | 3313 m_compositorCreationFailed = false; |
3309 if (m_pageOverlays) | 3314 if (m_pageOverlays) |
3310 m_pageOverlays->update(); | 3315 m_pageOverlays->update(); |
3311 } else { | 3316 } else { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3536 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); | 3541 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); |
3537 | 3542 |
3538 if (page()) | 3543 if (page()) |
3539 page()->pointerLockController()->dispatchLockedMouseEvent( | 3544 page()->pointerLockController()->dispatchLockedMouseEvent( |
3540 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), | 3545 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), |
3541 eventType); | 3546 eventType); |
3542 } | 3547 } |
3543 #endif | 3548 #endif |
3544 | 3549 |
3545 } // namespace WebKit | 3550 } // namespace WebKit |
OLD | NEW |