Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-webkit: Commit

external/webkit


Commit MetaInfo

Revision11d5fbed7ec4d32acd929c3ea14720cb076b16e7 (tree)
Time2012-06-18 17:15:32
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Merge commit 'android-4.0.4_r2.1' into ics-x86

Change Summary

Incremental Difference

--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -130,8 +130,10 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const SkRegion& inval
130130 {
131131 if (!layer || isPictureAfterFirstLayout) {
132132 // TODO: move this into TreeManager
133+ m_zoomManager.swapPages(); // reset zoom state
133134 m_tiledPageA->discardTextures();
134135 m_tiledPageB->discardTextures();
136+ m_layersRenderingMode = kAllTextures;
135137 }
136138 if (layer) {
137139 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)
376378 int maxTextures = TilesManager::instance()->maxLayerTextureCount();
377379 LayersRenderingMode layersRenderingMode = m_layersRenderingMode;
378380
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+
379387 m_layersRenderingMode = kSingleSurfaceRendering;
380388 if (nbTexturesNeeded.fixed < maxTextures)
381389 m_layersRenderingMode = kFixedLayers;
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -963,11 +963,31 @@ void GraphicsLayerAndroid::syncMask()
963963 }
964964 }
965965
966-void GraphicsLayerAndroid::syncCompositingState()
966+void GraphicsLayerAndroid::gatherRootLayers(Vector<const RenderLayer*>& list)
967967 {
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+ }
970982
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+{
971991 updateScrollingLayers();
972992 updateFixedPosition();
973993 syncChildren();
@@ -977,6 +997,14 @@ void GraphicsLayerAndroid::syncCompositingState()
977997 repaint();
978998 }
979999
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+
9801008 void GraphicsLayerAndroid::notifyClientAnimationStarted()
9811009 {
9821010 for (unsigned int i = 0; i < m_children.size(); i++)
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h
@@ -116,7 +116,9 @@ public:
116116
117117 virtual void setZPosition(float);
118118
119+ void gatherRootLayers(Vector<const RenderLayer*>&);
119120 virtual void syncCompositingState();
121+ virtual void syncCompositingStateForThisLayerOnly();
120122 void notifyClientAnimationStarted();
121123
122124 LayerAndroid* contentLayer() { return m_contentLayer; }
--- a/Source/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp
@@ -113,7 +113,7 @@ TilesManager::TilesManager()
113113 m_tilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION);
114114 m_availableTilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION);
115115 m_pixmapsGenerationThread = new TexturesGenerator();
116- m_pixmapsGenerationThread->run("TexturesGenerator", android::PRIORITY_BACKGROUND);
116+ m_pixmapsGenerationThread->run("TexturesGenerator");
117117 }
118118
119119 void TilesManager::allocateTiles()
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -1561,6 +1561,16 @@ bool RenderBlock::handleRunInChild(RenderBox* child)
15611561
15621562 RenderBlock* currBlock = toRenderBlock(curr);
15631563
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+
15641574 // Remove the old child.
15651575 children()->removeChildNode(this, blockRunIn);
15661576
@@ -1569,16 +1579,11 @@ bool RenderBlock::handleRunInChild(RenderBox* child)
15691579 RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? runInNode : document());
15701580 inlineRunIn->setStyle(blockRunIn->style());
15711581
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
15761583 for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) {
15771584 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.
15821587 runInChild = nextSibling;
15831588 }
15841589
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1366,7 +1366,21 @@ bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const
13661366 return false;
13671367
13681368 // 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
13691382 return requiresCompositingLayer(layer) || layer->mustOverlapCompositedLayers() || (inCompositingMode() && layer->isRootLayer());
1383+#endif
13701384 }
13711385
13721386 #if PLATFORM(ANDROID)
--- a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -37,12 +37,15 @@
3737 #include "FrameLoader.h"
3838 #include "FrameView.h"
3939 #include "Geolocation.h"
40+#include "GraphicsLayerAndroid.h"
4041 #include "HTMLMediaElement.h"
4142 #include "HTMLNames.h"
4243 #include "Icon.h"
4344 #include "LayerAndroid.h"
4445 #include "Page.h"
4546 #include "PopupMenuAndroid.h"
47+#include "RenderLayer.h"
48+#include "RenderLayerCompositor.h"
4649 #include "ScriptController.h"
4750 #include "SearchPopupMenuAndroid.h"
4851 #include "WebCoreFrameBridge.h"
@@ -64,7 +67,21 @@ static unsigned long long tryToReclaimDatabaseQuota(SecurityOrigin* originNeedin
6467 WebCore::GraphicsLayer* ChromeClientAndroid::layersSync()
6568 {
6669 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())
6885 frameView->syncCompositingStateIncludingSubframes();
6986 }
7087 m_needsLayerSync = false;
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -101,6 +101,7 @@
101101 #include "RenderThemeAndroid.h"
102102 #include "RenderView.h"
103103 #include "ResourceRequest.h"
104+#include "RuntimeEnabledFeatures.h"
104105 #include "SchemeRegistry.h"
105106 #include "SelectionController.h"
106107 #include "Settings.h"
@@ -472,6 +473,12 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
472473 // initialisation.
473474 v8::V8::Initialize();
474475 #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);
475482 }
476483
477484 WebViewCore::~WebViewCore()
@@ -666,10 +673,20 @@ void WebViewCore::recordPictureSet(PictureSet* content)
666673 content->clear();
667674
668675 #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+ }
673690 #endif
674691
675692 content->setDimensions(width, height, &m_addInval);
@@ -693,23 +710,6 @@ void WebViewCore::recordPictureSet(PictureSet* content)
693710
694711 // Rebuild the pictureset (webkit repaint)
695712 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-
713713 } // WebViewCoreRecordTimeCounter
714714
715715 WebCore::Node* oldFocusNode = currentFocus();
Show on old repository browser