diff options
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/dom/Document.cpp | 9 | ||||
-rw-r--r-- | Source/WebCore/dom/Document.h | 9 | ||||
-rw-r--r-- | Source/WebCore/html/HTMLBodyElement.cpp | 8 | ||||
-rw-r--r-- | Source/WebCore/html/HTMLMetaElement.cpp | 20 | ||||
-rw-r--r-- | Source/WebCore/platform/android/ScrollViewAndroid.cpp | 12 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/BaseTile.cpp | 67 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/BaseTile.h | 9 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/BaseTileTexture.cpp | 3 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp | 8 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/TilesManager.h | 4 |
10 files changed, 71 insertions, 78 deletions
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 60d3af1..7ba603b 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -695,10 +695,7 @@ void Document::setDocType(PassRefPtr<DocumentType> docType) if (m_docType && !ownerElement() && m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", false)) { // fit mobile sites directly in the screen - if (Frame *f = frame()) - f->settings()->setMetadataSettings("width", "device-width"); - if (FrameView* frameView = view()) - PlatformBridge::updateViewport(frameView); + processViewport("width=device-width"); } #endif } @@ -2729,9 +2726,9 @@ void Document::processArguments(const String& features, void* data, ArgumentsCal #ifdef ANDROID_META_SUPPORT if (frame()) frame()->settings()->setMetadataSettings(keyString, valueString); -#else - callback(keyString, valueString, this, data); #endif + if (callback && data) + callback(keyString, valueString, this, data); } } diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index 5ab6d77..179293c 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -794,11 +794,10 @@ public: void processViewport(const String& features); #ifdef ANDROID_META_SUPPORT - /** - * Handles viewport like <meta name = "viewport" content = "width = device-width"> - * or format-detection like <meta name = "format-detection" content = "telephone=no"> - */ - void processMetadataSettings(const String& content); + /** + * Handles format-detection like <meta name = "format-detection" content = "telephone=no"> + */ + void processMetadataSettings(const String& content); #endif // Returns the owning element in the parent document. diff --git a/Source/WebCore/html/HTMLBodyElement.cpp b/Source/WebCore/html/HTMLBodyElement.cpp index 9cf8730..0c93c95 100644 --- a/Source/WebCore/html/HTMLBodyElement.cpp +++ b/Source/WebCore/html/HTMLBodyElement.cpp @@ -206,13 +206,7 @@ void HTMLBodyElement::insertedIntoDocument() if (settings->viewportWidth() == -1 && (host.startsWith("m.") || host.startsWith("mobile.") || host.startsWith("wap.") || host.contains(".m.") || host.contains(".mobile." || host.contains(".wap.")))) { // fit mobile sites directly in the screen - settings->setMetadataSettings("width", "device-width"); - // update the meta data if it is the top document - if (!ownerElement) { - FrameView* view = document()->view(); - if (view) - PlatformBridge::updateViewport(view); - } + document()->processViewport("width=device-width"); } } #endif diff --git a/Source/WebCore/html/HTMLMetaElement.cpp b/Source/WebCore/html/HTMLMetaElement.cpp index d8d9fb3..cb7f4c0 100644 --- a/Source/WebCore/html/HTMLMetaElement.cpp +++ b/Source/WebCore/html/HTMLMetaElement.cpp @@ -75,30 +75,18 @@ void HTMLMetaElement::process() { if (!inDocument() || m_content.isNull()) return; + if (equalIgnoringCase(name(), "viewport")) + document()->processViewport(m_content); #ifdef ANDROID_META_SUPPORT // TODO: Evaluate whether to take upstreamed meta support - bool updateViewport = false; - if (equalIgnoringCase(name(), "viewport")) { - document()->processMetadataSettings(m_content); - updateViewport = true; - } else if (equalIgnoringCase(name(), "format-detection")) + else if (equalIgnoringCase(name(), "format-detection")) document()->processMetadataSettings(m_content); else if (((equalIgnoringCase(name(), "HandheldFriendly") && equalIgnoringCase(m_content, "true")) || equalIgnoringCase(name(), "MobileOptimized")) && document()->settings() && document()->settings()->viewportWidth() == -1) { // fit mobile sites directly in the screen - document()->settings()->setMetadataSettings("width", "device-width"); - updateViewport = true; + document()->processViewport("width=device-width"); } - // update the meta data if it is the top document - if (updateViewport && !document()->ownerElement()) { - FrameView* view = document()->view(); - if (view) - PlatformBridge::updateViewport(view); - } -#else - if (equalIgnoringCase(name(), "viewport")) - document()->processViewport(m_content); #endif #if ENABLE(ANDROID_INSTALLABLE_WEB_APPS) diff --git a/Source/WebCore/platform/android/ScrollViewAndroid.cpp b/Source/WebCore/platform/android/ScrollViewAndroid.cpp index f54e5ea..87c6a1f 100644 --- a/Source/WebCore/platform/android/ScrollViewAndroid.cpp +++ b/Source/WebCore/platform/android/ScrollViewAndroid.cpp @@ -68,32 +68,36 @@ IntSize ScrollView::platformContentsSize() const return m_contentsSize; } +static float getWebViewCoreScale(const ScrollView* view) { + return android::WebViewCore::getWebViewCore(view)->scale(); +} + int ScrollView::platformActualWidth() const { if (parent()) return width(); - return platformWidget()->visibleWidth(); + return platformWidget()->visibleWidth() * getWebViewCoreScale(this); } int ScrollView::platformActualHeight() const { if (parent()) return height(); - return platformWidget()->visibleHeight(); + return platformWidget()->visibleHeight() * getWebViewCoreScale(this); } int ScrollView::platformActualScrollX() const { if (parent()) return scrollX(); - return platformWidget()->visibleX(); + return platformWidget()->visibleX() * getWebViewCoreScale(this); } int ScrollView::platformActualScrollY() const { if (parent()) return scrollY(); - return platformWidget()->visibleY(); + return platformWidget()->visibleY() * getWebViewCoreScale(this); } void ScrollView::platformSetScrollPosition(const WebCore::IntPoint& pt) diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp index 70b98b0..ed2ad3e 100644 --- a/Source/WebCore/platform/graphics/android/BaseTile.cpp +++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp @@ -28,8 +28,8 @@ #if USE(ACCELERATED_COMPOSITING) -#include "RasterRenderer.h" #include "GLUtils.h" +#include "RasterRenderer.h" #include "TextureInfo.h" #include "TilesManager.h" @@ -64,15 +64,25 @@ BaseTile::BaseTile() , m_repaintPending(false) , m_usable(true) , m_lastDirtyPicture(0) - , m_fullRepaintA(true) - , m_fullRepaintB(true) , m_lastPaintedPicture(0) { #ifdef DEBUG_COUNT ClassTracker::instance()->increment("BaseTile"); #endif - m_currentDirtyArea = &m_dirtyAreaA; + m_currentDirtyAreaIndex = 0; m_renderer = new RasterRenderer(); + + // For EglImage Mode, the internal buffer should be 2. + // And for Async Surface Texture mode, this is 3. + if (TilesManager::instance()->getSharedTextureMode() == EglImageMode) + m_maxBufferNumber = 2; + else + m_maxBufferNumber = 3; + + m_dirtyArea = new SkRegion[m_maxBufferNumber]; + m_fullRepaint = new bool[m_maxBufferNumber]; + for (int i = 0; i < m_maxBufferNumber; i++) + m_fullRepaint[i] = true; } BaseTile::~BaseTile() @@ -82,6 +92,8 @@ BaseTile::~BaseTile() m_texture->release(this); delete m_renderer; + delete[] m_dirtyArea; + delete[] m_fullRepaint; #ifdef DEBUG_COUNT ClassTracker::instance()->decrement("BaseTile"); @@ -122,10 +134,10 @@ bool BaseTile::removeTexture(BaseTileTexture* texture) void BaseTile::fullInval() { - m_dirtyAreaA.setEmpty(); - m_dirtyAreaB.setEmpty(); - m_fullRepaintA = true; - m_fullRepaintB = true; + for (int i = 0; i < m_maxBufferNumber; i++) { + m_dirtyArea[i].setEmpty(); + m_fullRepaint[i] = true; + } m_dirty = true; } @@ -143,8 +155,8 @@ void BaseTile::markAsDirty(int unsigned pictureCount, { android::AutoMutex lock(m_atomicSync); m_lastDirtyPicture = pictureCount; - m_dirtyAreaA.op(dirtyArea, SkRegion::kUnion_Op); - m_dirtyAreaB.op(dirtyArea, SkRegion::kUnion_Op); + for (int i = 0; i < m_maxBufferNumber; i++) + m_dirtyArea[i].op(dirtyArea, SkRegion::kUnion_Op); m_dirty = true; } @@ -260,15 +272,14 @@ void BaseTile::paintBitmap() m_atomicSync.lock(); bool dirty = m_dirty; BaseTileTexture* texture = m_texture; - SkRegion dirtyArea = *m_currentDirtyArea; + SkRegion dirtyArea = m_dirtyArea[m_currentDirtyAreaIndex]; float scale = m_scale; const int x = m_x; const int y = m_y; m_atomicSync.unlock(); - if (!dirty || !texture) { + if (!dirty || !texture) return; - } TiledPage* tiledPage = m_page; @@ -299,12 +310,12 @@ void BaseTile::paintBitmap() SkRegion::Iterator cliperator(dirtyArea); bool fullRepaint = false; + // TODO: Implement the partial invalidate in Surface Texture Mode - if (((m_currentDirtyArea == &m_dirtyAreaA) && m_fullRepaintA) - || ((m_currentDirtyArea == &m_dirtyAreaB) && m_fullRepaintB) - || textureInfo->m_width != tileWidth - || textureInfo->m_height != tileHeight - || textureInfo->getSharedTextureMode() == SurfaceTextureMode) { + if (m_fullRepaint[m_currentDirtyAreaIndex] + || textureInfo->m_width != tileWidth + || textureInfo->m_height != tileHeight + || textureInfo->getSharedTextureMode() == SurfaceTextureMode) { fullRepaint = true; } @@ -379,12 +390,7 @@ void BaseTile::paintBitmap() m_lastPaintedPicture = pictureCount; // set the fullrepaint flags - - if ((m_currentDirtyArea == &m_dirtyAreaA) && m_fullRepaintA) - m_fullRepaintA = false; - - if ((m_currentDirtyArea == &m_dirtyAreaB) && m_fullRepaintB) - m_fullRepaintB = false; + m_fullRepaint[m_currentDirtyAreaIndex] = false; // The various checks to see if we are still dirty... @@ -394,18 +400,19 @@ void BaseTile::paintBitmap() m_dirty = true; if (fullRepaint) - m_currentDirtyArea->setEmpty(); + m_dirtyArea[m_currentDirtyAreaIndex].setEmpty(); else - m_currentDirtyArea->op(dirtyArea, SkRegion::kDifference_Op); + m_dirtyArea[m_currentDirtyAreaIndex].op(dirtyArea, SkRegion::kDifference_Op); - if (!m_currentDirtyArea->isEmpty()) + if (!m_dirtyArea[m_currentDirtyAreaIndex].isEmpty()) m_dirty = true; // Now we can swap the dirty areas + // TODO: For surface texture in Async mode, the index will be updated + // according to the current buffer just dequeued. + m_currentDirtyAreaIndex = (m_currentDirtyAreaIndex+1) % m_maxBufferNumber; - m_currentDirtyArea = m_currentDirtyArea == &m_dirtyAreaA ? &m_dirtyAreaB : &m_dirtyAreaA; - - if (!m_currentDirtyArea->isEmpty()) + if (!m_dirtyArea[m_currentDirtyAreaIndex].isEmpty()) m_dirty = true; if (!m_dirty) diff --git a/Source/WebCore/platform/graphics/android/BaseTile.h b/Source/WebCore/platform/graphics/android/BaseTile.h index 8a812f8..b5fc7ba 100644 --- a/Source/WebCore/platform/graphics/android/BaseTile.h +++ b/Source/WebCore/platform/graphics/android/BaseTile.h @@ -125,11 +125,10 @@ private: unsigned int m_lastDirtyPicture; // store the dirty region - SkRegion m_dirtyAreaA; - SkRegion m_dirtyAreaB; - bool m_fullRepaintA; - bool m_fullRepaintB; - SkRegion* m_currentDirtyArea; + SkRegion* m_dirtyArea; + bool* m_fullRepaint; + int m_maxBufferNumber; + int m_currentDirtyAreaIndex; // stores the id of the latest picture painted to the tile. If the id is 0 // then we know that the picture has not yet been painted an there is nothing diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp index 4d1dec1..f66019a 100644 --- a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp +++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp @@ -39,7 +39,8 @@ namespace WebCore { BaseTileTexture::BaseTileTexture(uint32_t w, uint32_t h) - : DoubleBufferedTexture(eglGetCurrentContext(), SurfaceTextureMode) + : DoubleBufferedTexture(eglGetCurrentContext(), + TilesManager::instance()->getSharedTextureMode()) , m_usedLevel(-1) , m_owner(0) , m_delayedReleaseOwner(0) diff --git a/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index 429a125..e015f5a 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -624,10 +624,10 @@ static void setrectForUnderline(SkRect* r, GraphicsContext* context, const Float if (lineThickness < 1) // Do we really need/want this? lineThickness = 1; #endif - r->fLeft = SkIntToScalar(point.x()); - r->fTop = SkIntToScalar(point.y() + yOffset); - r->fRight = r->fLeft + SkIntToScalar(width); - r->fBottom = r->fTop + SkFloatToScalar(lineThickness); + r->fLeft = point.x(); + r->fTop = point.y() + yOffset; + r->fRight = r->fLeft + width; + r->fBottom = r->fTop + lineThickness; } void GraphicsContext::drawLineForText(const FloatPoint& pt, float width, bool) diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h index 2ef9e66..fe53666 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.h +++ b/Source/WebCore/platform/graphics/android/TilesManager.h @@ -126,6 +126,10 @@ public: m_showVisualIndicator = showVisualIndicator; } + SharedTextureMode getSharedTextureMode() { + return SurfaceTextureMode; + } + private: TilesManager(); |