Chromium Code Reviews| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 #include "public/web/WebActiveWheelFlingParameters.h" | 116 #include "public/web/WebActiveWheelFlingParameters.h" |
| 117 #include "public/web/WebAutofillClient.h" | 117 #include "public/web/WebAutofillClient.h" |
| 118 #include "public/web/WebFrameClient.h" | 118 #include "public/web/WebFrameClient.h" |
| 119 #include "public/web/WebHitTestResult.h" | 119 #include "public/web/WebHitTestResult.h" |
| 120 #include "public/web/WebInputElement.h" | 120 #include "public/web/WebInputElement.h" |
| 121 #include "public/web/WebMediaPlayerAction.h" | 121 #include "public/web/WebMediaPlayerAction.h" |
| 122 #include "public/web/WebNode.h" | 122 #include "public/web/WebNode.h" |
| 123 #include "public/web/WebPlugin.h" | 123 #include "public/web/WebPlugin.h" |
| 124 #include "public/web/WebPluginAction.h" | 124 #include "public/web/WebPluginAction.h" |
| 125 #include "public/web/WebRange.h" | 125 #include "public/web/WebRange.h" |
| 126 #include "public/web/WebSelection.h" | |
| 126 #include "public/web/WebTextInputInfo.h" | 127 #include "public/web/WebTextInputInfo.h" |
| 127 #include "public/web/WebViewClient.h" | 128 #include "public/web/WebViewClient.h" |
| 128 #include "public/web/WebWindowFeatures.h" | 129 #include "public/web/WebWindowFeatures.h" |
| 129 #include "web/CompositionUnderlineVectorBuilder.h" | 130 #include "web/CompositionUnderlineVectorBuilder.h" |
| 130 #include "web/ContextFeaturesClientImpl.h" | 131 #include "web/ContextFeaturesClientImpl.h" |
| 131 #include "web/DatabaseClientImpl.h" | 132 #include "web/DatabaseClientImpl.h" |
| 132 #include "web/FullscreenController.h" | 133 #include "web/FullscreenController.h" |
| 133 #include "web/GraphicsLayerFactoryChromium.h" | 134 #include "web/GraphicsLayerFactoryChromium.h" |
| 134 #include "web/LinkHighlight.h" | 135 #include "web/LinkHighlight.h" |
| 135 #include "web/PopupContainer.h" | 136 #include "web/PopupContainer.h" |
| (...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1711 } | 1712 } |
| 1712 | 1713 |
| 1713 void WebViewImpl::layout() | 1714 void WebViewImpl::layout() |
| 1714 { | 1715 { |
| 1715 TRACE_EVENT0("webkit", "WebViewImpl::layout"); | 1716 TRACE_EVENT0("webkit", "WebViewImpl::layout"); |
| 1716 PageWidgetDelegate::layout(m_page.get()); | 1717 PageWidgetDelegate::layout(m_page.get()); |
| 1717 updateLayerTreeBackgroundColor(); | 1718 updateLayerTreeBackgroundColor(); |
| 1718 | 1719 |
| 1719 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1720 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 1720 m_linkHighlights[i]->updateGeometry(); | 1721 m_linkHighlights[i]->updateGeometry(); |
| 1722 | |
| 1723 updateLayerTreeSelection(); | |
|
abarth-chromium
2014/06/13 21:38:15
This shouldn't be a separate set in WebViewImpl::l
jdduke (slow)
2014/06/24 18:22:07
Done.
| |
| 1721 } | 1724 } |
| 1722 | 1725 |
| 1723 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1726 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
| 1724 { | 1727 { |
| 1725 // This should only be used when compositing is not being used for this | 1728 // This should only be used when compositing is not being used for this |
| 1726 // WebView, and it is painting into the recording of its parent. | 1729 // WebView, and it is painting into the recording of its parent. |
| 1727 ASSERT(!isAcceleratedCompositingActive()); | 1730 ASSERT(!isAcceleratedCompositingActive()); |
| 1728 | 1731 |
| 1729 double paintStart = currentTime(); | 1732 double paintStart = currentTime(); |
| 1730 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); | 1733 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); |
| (...skipping 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4002 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos itor()->ensureRootTransformLayer(); | 4005 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos itor()->ensureRootTransformLayer(); |
| 4003 | 4006 |
| 4004 if (m_rootTransformLayer) { | 4007 if (m_rootTransformLayer) { |
| 4005 WebCore::TransformationMatrix transform; | 4008 WebCore::TransformationMatrix transform; |
| 4006 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); | 4009 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); |
| 4007 transform = transform.scale(m_rootLayerScale); | 4010 transform = transform.scale(m_rootLayerScale); |
| 4008 m_rootTransformLayer->setTransform(transform); | 4011 m_rootTransformLayer->setTransform(transform); |
| 4009 } | 4012 } |
| 4010 } | 4013 } |
| 4011 | 4014 |
| 4015 static bool computeCompositedLayerAndRect(Node* node, IntRect absoluteRect, int& layerId, WebRect& layerRect) | |
| 4016 { | |
| 4017 RenderLayer* renderLayer; | |
| 4018 GraphicsLayer* graphicsLayer; | |
| 4019 if (!RenderLayerCompositor::computeEnclosingCompositingLayer(node, renderLay er, graphicsLayer)) | |
| 4020 return false; | |
| 4021 | |
| 4022 ASSERT(renderLayer); | |
| 4023 ASSERT(graphicsLayer); | |
| 4024 | |
| 4025 absoluteRect.move(-graphicsLayer->offsetFromRenderer()); | |
| 4026 FloatQuad absoluteQuad(absoluteRect); | |
| 4027 FloatQuad layerQuad; | |
| 4028 RenderLayerCompositor::convertTargetSpaceQuadToCompositedLayer(absoluteQuad, node->renderer(), renderLayer->renderer(), layerQuad); | |
| 4029 | |
| 4030 layerRect = layerQuad.enclosingBoundingBox(); | |
| 4031 layerId = graphicsLayer->platformLayer()->id(); | |
| 4032 | |
| 4033 return true; | |
| 4034 } | |
|
abarth-chromium
2014/06/13 21:38:15
We won't need to do this work in the correct desig
jdduke (slow)
2014/06/24 18:22:07
How will we know this, and where is the correct tr
| |
| 4035 | |
| 4036 void WebViewImpl::updateLayerTreeSelection() | |
| 4037 { | |
| 4038 if (!m_layerTreeView || !settings()->compositedSelectionUpdatesEnabled()) | |
| 4039 return; | |
| 4040 | |
| 4041 const LocalFrame* frame = toLocalFrame(focusedWebCoreFrame()); | |
| 4042 if (!frame || !frame->selection().isCaretOrRange()) | |
| 4043 return m_layerTreeView->clearSelection(); | |
|
abarth-chromium
2014/06/13 21:38:15
Instead of polling blink_core to see whether !fram
jdduke (slow)
2014/06/24 18:22:07
Done.
| |
| 4044 | |
| 4045 FrameSelection& selection = frame->selection(); | |
| 4046 | |
| 4047 if (selection.isCaret()) { | |
| 4048 WebSelection webSelection; | |
| 4049 if (!computeCompositedLayerAndRect(selection.rootEditableElementOrDocume ntElement(), | |
| 4050 selection.absoluteCaretBounds(), | |
| 4051 webSelection.anchorLayerId, | |
| 4052 webSelection.anchorRectInLayer)) { | |
| 4053 return m_layerTreeView->clearSelection(); | |
| 4054 } | |
| 4055 | |
| 4056 webSelection.type = WebSelection::TypeInsertion; | |
| 4057 m_layerTreeView->registerSelection(webSelection); | |
| 4058 return; | |
| 4059 } | |
| 4060 | |
| 4061 RefPtrWillBeRawPtr<Range> selectedRange = selection.toNormalizedRange(); | |
| 4062 if (!selectedRange) | |
| 4063 return m_layerTreeView->clearSelection(); | |
| 4064 | |
| 4065 WebSelection webSelection; | |
| 4066 | |
| 4067 RefPtrWillBeRawPtr<Range> range(Range::create(selectedRange->startContainer( )->document(), | |
| 4068 selectedRange->startContainer(), | |
| 4069 selectedRange->startOffset(), | |
| 4070 selectedRange->startContainer(), | |
| 4071 selectedRange->startOffset())); | |
| 4072 IntRect anchor = frame->editor().firstRectForRange(range.get()); | |
| 4073 if (!computeCompositedLayerAndRect(selection.start().anchorNode(), | |
| 4074 anchor, | |
| 4075 webSelection.anchorLayerId, | |
| 4076 webSelection.anchorRectInLayer)) { | |
| 4077 return m_layerTreeView->clearSelection(); | |
| 4078 } | |
| 4079 | |
| 4080 range = Range::create(selectedRange->endContainer()->document(), | |
| 4081 selectedRange->endContainer(), | |
| 4082 selectedRange->endOffset(), | |
| 4083 selectedRange->endContainer(), | |
| 4084 selectedRange->endOffset()); | |
| 4085 IntRect focus = frame->editor().firstRectForRange(range.get()); | |
| 4086 if (!computeCompositedLayerAndRect(selection.end().anchorNode(), | |
| 4087 focus, | |
| 4088 webSelection.focusLayerId, | |
| 4089 webSelection.focusRectInLayer)) { | |
| 4090 return m_layerTreeView->clearSelection(); | |
| 4091 } | |
| 4092 | |
| 4093 webSelection.type = WebSelection::TypeSelection; | |
| 4094 webSelection.anchorDirection = selection.start().primaryDirection() == RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight; | |
| 4095 webSelection.focusDirection = selection.end().primaryDirection() == RTL ? We bTextDirectionRightToLeft : WebTextDirectionLeftToRight; | |
| 4096 webSelection.anchorIsFirst = selection.selection().isBaseFirst(); | |
| 4097 m_layerTreeView->registerSelection(webSelection); | |
| 4098 } | |
| 4099 | |
| 4012 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) | 4100 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) |
| 4013 { | 4101 { |
| 4014 HitTestResult touchHit = hitTestResultForWindowPos(position); | 4102 HitTestResult touchHit = hitTestResultForWindowPos(position); |
| 4015 | 4103 |
| 4016 if (touchHit.isContentEditable()) | 4104 if (touchHit.isContentEditable()) |
| 4017 return false; | 4105 return false; |
| 4018 | 4106 |
| 4019 Node* node = touchHit.innerNode(); | 4107 Node* node = touchHit.innerNode(); |
| 4020 if (!node || !node->isTextNode()) | 4108 if (!node || !node->isTextNode()) |
| 4021 return false; | 4109 return false; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4103 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4191 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
| 4104 | 4192 |
| 4105 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4193 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4106 return false; | 4194 return false; |
| 4107 | 4195 |
| 4108 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4196 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4109 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4197 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 4110 } | 4198 } |
| 4111 | 4199 |
| 4112 } // namespace blink | 4200 } // namespace blink |
| OLD | NEW |