external/webkit
Revision | 11d5fbed7ec4d32acd929c3ea14720cb076b16e7 (tree) |
---|---|
Time | 2012-06-18 17:15:32 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
Merge commit 'android-4.0.4_r2.1' into ics-x86
@@ -130,8 +130,10 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const SkRegion& inval | ||
130 | 130 | { |
131 | 131 | if (!layer || isPictureAfterFirstLayout) { |
132 | 132 | // TODO: move this into TreeManager |
133 | + m_zoomManager.swapPages(); // reset zoom state | |
133 | 134 | m_tiledPageA->discardTextures(); |
134 | 135 | m_tiledPageB->discardTextures(); |
136 | + m_layersRenderingMode = kAllTextures; | |
135 | 137 | } |
136 | 138 | if (layer) { |
137 | 139 | XLOG("new base layer %p, (inval region empty %d) with child %p", layer, inval.isEmpty(), layer->getChild(0)); |
@@ -376,6 +378,12 @@ bool GLWebViewState::setLayersRenderingMode(TexturesResult& nbTexturesNeeded) | ||
376 | 378 | int maxTextures = TilesManager::instance()->maxLayerTextureCount(); |
377 | 379 | LayersRenderingMode layersRenderingMode = m_layersRenderingMode; |
378 | 380 | |
381 | + if (m_layersRenderingMode == kSingleSurfaceRendering) { | |
382 | + // only switch out of SingleSurface mode, if we have 2x needed textures | |
383 | + // to avoid changing too often | |
384 | + maxTextures /= 2; | |
385 | + } | |
386 | + | |
379 | 387 | m_layersRenderingMode = kSingleSurfaceRendering; |
380 | 388 | if (nbTexturesNeeded.fixed < maxTextures) |
381 | 389 | m_layersRenderingMode = kFixedLayers; |
@@ -963,11 +963,31 @@ void GraphicsLayerAndroid::syncMask() | ||
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | -void GraphicsLayerAndroid::syncCompositingState() | |
966 | +void GraphicsLayerAndroid::gatherRootLayers(Vector<const RenderLayer*>& list) | |
967 | 967 | { |
968 | - for (unsigned int i = 0; i < m_children.size(); i++) | |
969 | - m_children[i]->syncCompositingState(); | |
968 | + RenderLayer* renderLayer = renderLayerFromClient(m_client); | |
969 | + if (renderLayer) { | |
970 | + const RenderLayer* rootLayer = renderLayer->root(); | |
971 | + bool found = false; | |
972 | + for (unsigned int i = 0; i < list.size(); i++) { | |
973 | + const RenderLayer* current = list[i]; | |
974 | + if (current == rootLayer) { | |
975 | + found = true; | |
976 | + break; | |
977 | + } | |
978 | + } | |
979 | + if (!found) | |
980 | + list.append(rootLayer); | |
981 | + } | |
970 | 982 | |
983 | + for (unsigned int i = 0; i < m_children.size(); i++) { | |
984 | + GraphicsLayerAndroid* layer = static_cast<GraphicsLayerAndroid*>(m_children[i]); | |
985 | + layer->gatherRootLayers(list); | |
986 | + } | |
987 | +} | |
988 | + | |
989 | +void GraphicsLayerAndroid::syncCompositingStateForThisLayerOnly() | |
990 | +{ | |
971 | 991 | updateScrollingLayers(); |
972 | 992 | updateFixedPosition(); |
973 | 993 | syncChildren(); |
@@ -977,6 +997,14 @@ void GraphicsLayerAndroid::syncCompositingState() | ||
977 | 997 | repaint(); |
978 | 998 | } |
979 | 999 | |
1000 | +void GraphicsLayerAndroid::syncCompositingState() | |
1001 | +{ | |
1002 | + for (unsigned int i = 0; i < m_children.size(); i++) | |
1003 | + m_children[i]->syncCompositingState(); | |
1004 | + | |
1005 | + syncCompositingStateForThisLayerOnly(); | |
1006 | +} | |
1007 | + | |
980 | 1008 | void GraphicsLayerAndroid::notifyClientAnimationStarted() |
981 | 1009 | { |
982 | 1010 | for (unsigned int i = 0; i < m_children.size(); i++) |
@@ -116,7 +116,9 @@ public: | ||
116 | 116 | |
117 | 117 | virtual void setZPosition(float); |
118 | 118 | |
119 | + void gatherRootLayers(Vector<const RenderLayer*>&); | |
119 | 120 | virtual void syncCompositingState(); |
121 | + virtual void syncCompositingStateForThisLayerOnly(); | |
120 | 122 | void notifyClientAnimationStarted(); |
121 | 123 | |
122 | 124 | LayerAndroid* contentLayer() { return m_contentLayer; } |
@@ -113,7 +113,7 @@ TilesManager::TilesManager() | ||
113 | 113 | m_tilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); |
114 | 114 | m_availableTilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); |
115 | 115 | m_pixmapsGenerationThread = new TexturesGenerator(); |
116 | - m_pixmapsGenerationThread->run("TexturesGenerator", android::PRIORITY_BACKGROUND); | |
116 | + m_pixmapsGenerationThread->run("TexturesGenerator"); | |
117 | 117 | } |
118 | 118 | |
119 | 119 | void TilesManager::allocateTiles() |
@@ -1561,6 +1561,16 @@ bool RenderBlock::handleRunInChild(RenderBox* child) | ||
1561 | 1561 | |
1562 | 1562 | RenderBlock* currBlock = toRenderBlock(curr); |
1563 | 1563 | |
1564 | + // First we destroy any :before/:after content. It will be regenerated by the new inline. | |
1565 | + // Exception is if the run-in itself is generated. | |
1566 | + if (child->style()->styleType() != BEFORE && child->style()->styleType() != AFTER) { | |
1567 | + RenderObject* generatedContent; | |
1568 | + if (child->getCachedPseudoStyle(BEFORE) && (generatedContent = child->beforePseudoElementRenderer())) | |
1569 | + generatedContent->destroy(); | |
1570 | + if (child->getCachedPseudoStyle(AFTER) && (generatedContent = child->afterPseudoElementRenderer())) | |
1571 | + generatedContent->destroy(); | |
1572 | + } | |
1573 | + | |
1564 | 1574 | // Remove the old child. |
1565 | 1575 | children()->removeChildNode(this, blockRunIn); |
1566 | 1576 |
@@ -1569,16 +1579,11 @@ bool RenderBlock::handleRunInChild(RenderBox* child) | ||
1569 | 1579 | RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? runInNode : document()); |
1570 | 1580 | inlineRunIn->setStyle(blockRunIn->style()); |
1571 | 1581 | |
1572 | - bool runInIsGenerated = child->style()->styleType() == BEFORE || child->style()->styleType() == AFTER; | |
1573 | - | |
1574 | - // Move the nodes from the old child to the new child, but skip any :before/:after content. It has already | |
1575 | - // been regenerated by the new inline. | |
1582 | + // Move the nodes from the old child to the new child | |
1576 | 1583 | for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) { |
1577 | 1584 | RenderObject* nextSibling = runInChild->nextSibling(); |
1578 | - if (runInIsGenerated || (runInChild->style()->styleType() != BEFORE && runInChild->style()->styleType() != AFTER)) { | |
1579 | - blockRunIn->children()->removeChildNode(blockRunIn, runInChild, false); | |
1580 | - inlineRunIn->addChild(runInChild); // Use addChild instead of appendChildNode since it handles correct placement of the children relative to :after-generated content. | |
1581 | - } | |
1585 | + blockRunIn->children()->removeChildNode(blockRunIn, runInChild, false); | |
1586 | + inlineRunIn->addChild(runInChild); // Use addChild instead of appendChildNode since it handles correct placement of the children relative to :after-generated content. | |
1582 | 1587 | runInChild = nextSibling; |
1583 | 1588 | } |
1584 | 1589 |
@@ -1366,7 +1366,21 @@ bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const | ||
1366 | 1366 | return false; |
1367 | 1367 | |
1368 | 1368 | // The root layer always has a compositing layer, but it may not have backing. |
1369 | +#if PLATFORM(ANDROID) | |
1370 | + // If we do not have a root platform layer, don't use the | |
1371 | + // mustOverlapCompositedLayers() as a cue that this layer needs to be | |
1372 | + // composited -- the layers tree has been detached. | |
1373 | + // Otherwise we can end up in a cycle where updateBacking() switches composited | |
1374 | + // mode on because a layer has mustOverlapCompositedLayers() (by calling | |
1375 | + // enableCompositingMode()), while computeCompositingRequirements() will | |
1376 | + // (correctly) say that we do not need to be in composited mode and turns it | |
1377 | + // off, rince and repeat... | |
1378 | + return requiresCompositingLayer(layer) | |
1379 | + || (m_rootPlatformLayer && layer->mustOverlapCompositedLayers()) | |
1380 | + || (inCompositingMode() && layer->isRootLayer()); | |
1381 | +#else | |
1369 | 1382 | return requiresCompositingLayer(layer) || layer->mustOverlapCompositedLayers() || (inCompositingMode() && layer->isRootLayer()); |
1383 | +#endif | |
1370 | 1384 | } |
1371 | 1385 | |
1372 | 1386 | #if PLATFORM(ANDROID) |
@@ -37,12 +37,15 @@ | ||
37 | 37 | #include "FrameLoader.h" |
38 | 38 | #include "FrameView.h" |
39 | 39 | #include "Geolocation.h" |
40 | +#include "GraphicsLayerAndroid.h" | |
40 | 41 | #include "HTMLMediaElement.h" |
41 | 42 | #include "HTMLNames.h" |
42 | 43 | #include "Icon.h" |
43 | 44 | #include "LayerAndroid.h" |
44 | 45 | #include "Page.h" |
45 | 46 | #include "PopupMenuAndroid.h" |
47 | +#include "RenderLayer.h" | |
48 | +#include "RenderLayerCompositor.h" | |
46 | 49 | #include "ScriptController.h" |
47 | 50 | #include "SearchPopupMenuAndroid.h" |
48 | 51 | #include "WebCoreFrameBridge.h" |
@@ -64,7 +67,21 @@ static unsigned long long tryToReclaimDatabaseQuota(SecurityOrigin* originNeedin | ||
64 | 67 | WebCore::GraphicsLayer* ChromeClientAndroid::layersSync() |
65 | 68 | { |
66 | 69 | if (m_rootGraphicsLayer && m_needsLayerSync && m_webFrame) { |
67 | - if (FrameView* frameView = m_webFrame->page()->mainFrame()->view()) | |
70 | + // We may have more than one frame, so let's first update all of them | |
71 | + // (webkit may want to update the GraphicsLayer tree, and we do *not* want | |
72 | + // to find this out when we are painting, as it means we could be summarily | |
73 | + // deallocated while painting...) | |
74 | + GraphicsLayerAndroid* rootLayer = static_cast<GraphicsLayerAndroid*>(m_rootGraphicsLayer); | |
75 | + Vector<const RenderLayer*> listRootLayers; | |
76 | + rootLayer->gatherRootLayers(listRootLayers); | |
77 | + | |
78 | + for (unsigned int i = 0; i < listRootLayers.size(); i++) { | |
79 | + RenderLayer* layer = const_cast<RenderLayer*>(listRootLayers[i]); | |
80 | + layer->compositor()->updateCompositingLayers(); | |
81 | + } | |
82 | + | |
83 | + Frame* frame = m_webFrame->page()->mainFrame(); | |
84 | + if (FrameView* frameView = frame->view()) | |
68 | 85 | frameView->syncCompositingStateIncludingSubframes(); |
69 | 86 | } |
70 | 87 | m_needsLayerSync = false; |
@@ -101,6 +101,7 @@ | ||
101 | 101 | #include "RenderThemeAndroid.h" |
102 | 102 | #include "RenderView.h" |
103 | 103 | #include "ResourceRequest.h" |
104 | +#include "RuntimeEnabledFeatures.h" | |
104 | 105 | #include "SchemeRegistry.h" |
105 | 106 | #include "SelectionController.h" |
106 | 107 | #include "Settings.h" |
@@ -472,6 +473,12 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m | ||
472 | 473 | // initialisation. |
473 | 474 | v8::V8::Initialize(); |
474 | 475 | #endif |
476 | + | |
477 | + // Configure any RuntimeEnabled features that we need to change from their default now. | |
478 | + // See WebCore/bindings/generic/RuntimeEnabledFeatures.h | |
479 | + | |
480 | + // HTML5 History API | |
481 | + RuntimeEnabledFeatures::setPushStateEnabled(true); | |
475 | 482 | } |
476 | 483 | |
477 | 484 | WebViewCore::~WebViewCore() |
@@ -666,10 +673,20 @@ void WebViewCore::recordPictureSet(PictureSet* content) | ||
666 | 673 | content->clear(); |
667 | 674 | |
668 | 675 | #if USE(ACCELERATED_COMPOSITING) |
669 | - // Detects if the content size has changed | |
670 | - bool contentSizeChanged = false; | |
671 | - if (content->width() != width || content->height() != height) | |
672 | - contentSizeChanged = true; | |
676 | + // The invals are not always correct when the content size has changed. For | |
677 | + // now, let's just reset the inval so that it invalidates the entire content | |
678 | + // -- the pictureset will be fully repainted, tiles will be marked dirty and | |
679 | + // will have to be repainted. | |
680 | + | |
681 | + // FIXME: the webkit invals ought to have been enough... | |
682 | + if (content->width() != width || content->height() != height) { | |
683 | + SkIRect r; | |
684 | + r.fLeft = 0; | |
685 | + r.fTop = 0; | |
686 | + r.fRight = width; | |
687 | + r.fBottom = height; | |
688 | + m_addInval.setRect(r); | |
689 | + } | |
673 | 690 | #endif |
674 | 691 | |
675 | 692 | content->setDimensions(width, height, &m_addInval); |
@@ -693,23 +710,6 @@ void WebViewCore::recordPictureSet(PictureSet* content) | ||
693 | 710 | |
694 | 711 | // Rebuild the pictureset (webkit repaint) |
695 | 712 | rebuildPictureSet(content); |
696 | - | |
697 | -#if USE(ACCELERATED_COMPOSITING) | |
698 | - // We repainted the pictureset, but the invals are not always correct when | |
699 | - // the content size did change. For now, let's just reset the | |
700 | - // inval we will pass to the UI so that it invalidates the entire | |
701 | - // content -- tiles will be marked dirty and will have to be repainted. | |
702 | - // FIXME: the webkit invals ought to have been enough... | |
703 | - if (contentSizeChanged) { | |
704 | - SkIRect r; | |
705 | - r.fLeft = 0; | |
706 | - r.fTop = 0; | |
707 | - r.fRight = width; | |
708 | - r.fBottom = height; | |
709 | - m_addInval.setRect(r); | |
710 | - } | |
711 | -#endif | |
712 | - | |
713 | 713 | } // WebViewCoreRecordTimeCounter |
714 | 714 | |
715 | 715 | WebCore::Node* oldFocusNode = currentFocus(); |