diff options
27 files changed, 154 insertions, 194 deletions
diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h index 7c59f1b..a1db9d6 100644 --- a/Source/JavaScriptCore/wtf/Platform.h +++ b/Source/JavaScriptCore/wtf/Platform.h @@ -735,6 +735,7 @@ #define ENABLE_NO_LISTBOX_RENDERING 1 #define ENABLE_LINK_PREFETCH 1 #define ENABLE_WEB_TIMING 1 +#define ENABLE_MEDIA_CAPTURE 1 // Android ENABLE guards not present upstream #define ENABLE_COMPOSITED_FIXED_ELEMENTS 1 // FIXME: Rename to ENABLE_ANDROID_COMPOSITED_FIXED_ELEMENTS diff --git a/Source/WebCore/Android.derived.v8bindings.mk b/Source/WebCore/Android.derived.v8bindings.mk index 546cefe..509d21e 100644 --- a/Source/WebCore/Android.derived.v8bindings.mk +++ b/Source/WebCore/Android.derived.v8bindings.mk @@ -31,7 +31,7 @@ js_binding_scripts := \ $(LOCAL_PATH)/bindings/scripts/generate-bindings.pl # Add ACCELERATED_COMPOSITING=1 and ENABLE_3D_RENDERING=1 for layers support -FEATURE_DEFINES := ENABLE_ORIENTATION_EVENTS=1 ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_GEOLOCATION=1 ENABLE_CONNECTION=1 ENABLE_APPLICATION_INSTALLED=1 ENABLE_XPATH=1 ENABLE_XSLT=1 ENABLE_DEVICE_ORIENTATION=1 ENABLE_FILE_READER=1 ENABLE_BLOB=1 ENABLE_WEB_TIMING=1 +FEATURE_DEFINES := ENABLE_ORIENTATION_EVENTS=1 ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_GEOLOCATION=1 ENABLE_CONNECTION=1 ENABLE_APPLICATION_INSTALLED=1 ENABLE_XPATH=1 ENABLE_XSLT=1 ENABLE_DEVICE_ORIENTATION=1 ENABLE_FILE_READER=1 ENABLE_BLOB=1 ENABLE_WEB_TIMING=1 ENABLE_MEDIA_CAPTURE=1 # The defines above should be identical to those for JSC. FEATURE_DEFINES += V8_BINDING diff --git a/Source/WebCore/html/HTMLAttributeNames.in b/Source/WebCore/html/HTMLAttributeNames.in index 5e0fe7b..578f717 100644 --- a/Source/WebCore/html/HTMLAttributeNames.in +++ b/Source/WebCore/html/HTMLAttributeNames.in @@ -58,6 +58,7 @@ bgcolor bgproperties border bordercolor +capture cellpadding cellspacing char diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 2b262e4..36cdf51 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -1588,4 +1588,24 @@ void HTMLInputElement::handleBeforeTextInsertedEvent(Event* event) InputElement::handleBeforeTextInsertedEvent(m_data, this, this, event); } +#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE) +String HTMLInputElement::capture() const +{ + if (!isFileUpload()) { + // capture has no meaning on anything other than file pickers. + return String(); + } + + String capture = fastGetAttribute(captureAttr).lower(); + if (capture == "camera" + || capture == "camcorder" + || capture == "microphone" + || capture == "filesystem") + return capture; + // According to the HTML Media Capture specification, the invalid and + // missing default value is filesystem. + return "filesystem"; +} +#endif + } // namespace diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 2a98b13..58d86ac 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -200,6 +200,10 @@ public: void updateCheckedRadioButtons(); bool lastChangeWasUserEdit() const; + +#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE) + String capture() const; +#endif protected: HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser); diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl index f346e10..e1937e4 100644 --- a/Source/WebCore/html/HTMLInputElement.idl +++ b/Source/WebCore/html/HTMLInputElement.idl @@ -107,6 +107,9 @@ module html { attribute [Reflect, EnabledAtRuntime] boolean webkitGrammar; attribute [DontEnum] EventListener onwebkitspeechchange; #endif +#if defined(WTF_PLATFORM_ANDROID) && defined(ENABLE_MEDIA_CAPTURE) && ENABLE_MEDIA_CAPTURE + attribute [Reflect] DOMString capture; +#endif }; } diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index a737754..45450b5 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -3224,15 +3224,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) // When sending a touch cancel event, use empty touches and targetTouches lists. bool isTouchCancelEvent = (state == PlatformTouchPoint::TouchCancelled); RefPtr<TouchList>& effectiveTouches(isTouchCancelEvent ? emptyList : touches); -#if PLATFORM(ANDROID) - AtomicString stateName(eventNameForTouchPointState(static_cast<PlatformTouchPoint::State>(state))); - if (event.type() == TouchLongPress) - stateName = eventNames().touchlongpressEvent; - else if (event.type() == TouchDoubleTap) - stateName = eventNames().touchdoubletapEvent; -#else const AtomicString& stateName(eventNameForTouchPointState(static_cast<PlatformTouchPoint::State>(state))); -#endif const EventTargetSet& targetsForState = changedTouches[state].m_targets; for (EventTargetSet::const_iterator it = targetsForState.begin(); it != targetsForState.end(); ++it) { diff --git a/Source/WebCore/platform/FileChooser.h b/Source/WebCore/platform/FileChooser.h index ac5e0e6..6c382d1 100644 --- a/Source/WebCore/platform/FileChooser.h +++ b/Source/WebCore/platform/FileChooser.h @@ -50,6 +50,9 @@ public: virtual String acceptTypes() = 0; virtual void chooseIconForFiles(FileChooser*, const Vector<String>&) = 0; virtual ~FileChooserClient(); +#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE) + virtual String capture() = 0; +#endif }; class FileChooser : public RefCounted<FileChooser> { @@ -79,6 +82,10 @@ public: // Acceptable MIME types. It's an 'accept' attribute value of the corresponding INPUT element. String acceptTypes() const { return m_client ? m_client->acceptTypes() : String(); } +#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE) + String capture() const { return m_client ? m_client->capture() : String(); } +#endif + private: FileChooser(FileChooserClient*, const Vector<String>& initialFilenames); void initialize(); diff --git a/Source/WebCore/platform/PlatformTouchEvent.h b/Source/WebCore/platform/PlatformTouchEvent.h index 2ca7c99..f7524b4 100644 --- a/Source/WebCore/platform/PlatformTouchEvent.h +++ b/Source/WebCore/platform/PlatformTouchEvent.h @@ -52,10 +52,6 @@ enum TouchEventType { , TouchMove , TouchEnd , TouchCancel -#if PLATFORM(ANDROID) - , TouchLongPress - , TouchDoubleTap -#endif }; class PlatformTouchEvent { diff --git a/Source/WebCore/platform/graphics/android/fonts/GlyphMapAndroid.cpp b/Source/WebCore/platform/graphics/android/fonts/GlyphMapAndroid.cpp index a327b79..b9798e6 100644 --- a/Source/WebCore/platform/graphics/android/fonts/GlyphMapAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/fonts/GlyphMapAndroid.cpp @@ -44,12 +44,12 @@ namespace WebCore { #define NO_BREAK_SPACE_UNICHAR 0xA0 -static int substituteWithVerticalGlyphs(const FontPlatformData& platformData, uint16_t* glyphs, unsigned bufferLength) +static HB_Error substituteWithVerticalGlyphs(const FontPlatformData& platformData, uint16_t* glyphs, unsigned bufferLength) { HB_FaceRec_* hbFace = platformData.harfbuzzFace(); if (!hbFace->gsub) { // if there is no GSUB table, treat it as not covered - return 0Xffff; + return static_cast<HB_Error>(0Xffff); } HB_Buffer buffer; @@ -60,13 +60,19 @@ static int substituteWithVerticalGlyphs(const FontPlatformData& platformData, ui HB_UShort scriptIndex; HB_UShort featureIndex; - HB_GSUB_Select_Script(hbFace->gsub, HB_MAKE_TAG('D', 'F', 'L', 'T'), &scriptIndex); + HB_Error error = HB_GSUB_Select_Script(hbFace->gsub, HB_MAKE_TAG('D', 'F', 'L', 'T'), &scriptIndex); + if (error) { + if (error != HB_Err_Not_Covered) + return error; + scriptIndex = HB_Script_Common; // Set script to common script. + } + HB_GSUB_Select_Feature(hbFace->gsub, HB_MAKE_TAG('v', 'e', 'r', 't'), scriptIndex, 0xffff, &featureIndex); HB_GSUB_Add_Feature(hbFace->gsub, featureIndex, 1); HB_GSUB_Select_Feature(hbFace->gsub, HB_MAKE_TAG('v', 'r', 't', '2'), scriptIndex, 0xffff, &featureIndex); HB_GSUB_Add_Feature(hbFace->gsub, featureIndex, 1); - int error = HB_GSUB_Apply_String(hbFace->gsub, buffer); + error = HB_GSUB_Apply_String(hbFace->gsub, buffer); if (!error) { for (unsigned i = 0; i < bufferLength; ++i) glyphs[i] = static_cast<Glyph>(buffer->out_string[i].gindex); @@ -74,6 +80,14 @@ static int substituteWithVerticalGlyphs(const FontPlatformData& platformData, ui return error; } +static void convertToVerticalForms(UChar* src, UChar* dest, unsigned bufferLength) { + for (unsigned i = 0; i < bufferLength; ++i) { + dest[i] = VerticalTextMap::getVerticalForm(src[i]); + if (!dest[i]) + dest[i] = src[i]; + } +} + bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData) { if (SkUTF16_IsHighSurrogate(buffer[bufferLength-1])) { @@ -92,11 +106,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b if (fontData->platformData().orientation() == Vertical && !fontData->hasVerticalGlyphs()) { // Convert to vertical form if there is no vertical glyphs. - for (unsigned i = 0; i < bufferLength; ++i) { - vTextBuffer[i] = VerticalTextMap::getVerticalForm(buffer[i]); - if (!vTextBuffer[i]) - vTextBuffer[i] = buffer[i]; - } + convertToVerticalForms(buffer, vTextBuffer, bufferLength); textBuffer = vTextBuffer; } @@ -111,11 +121,22 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b for (unsigned i = 0; i < bufferLength; ++i) { if (!Font::isCJKIdeograph(textBuffer[i])) { lookVariants = true; - continue; + break; + } + } + if (lookVariants) { + if (substituteWithVerticalGlyphs(fontData->platformData(), glyphs, bufferLength)) { + // Convert text to vertical forms if substituteWithVerticalGlyphs() fails to access vert tables. + convertToVerticalForms(buffer, vTextBuffer, bufferLength); + textBuffer = vTextBuffer; + + unsigned count = paint.textToGlyphs(textBuffer, bufferLength << 1, glyphs); + if (count != length) { + SkDebugf("%s count != length\n", __FUNCTION__); + return false; + } } } - if (lookVariants) - substituteWithVerticalGlyphs(fontData->platformData(), glyphs, bufferLength); } unsigned allGlyphs = 0; // track if any of the glyphIDs are non-zero diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp index 81427b8..a02759d 100644 --- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp @@ -884,7 +884,8 @@ void LayerAndroid::onDraw(SkCanvas* canvas, SkScalar opacity, return; } - if (masksToBounds() || !m_content) + // only continue drawing if layer is drawable + if (!m_content && !m_imageCRC) return; // we just have this save/restore for opacity... diff --git a/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp b/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp index 26bd55d..9435065 100644 --- a/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp @@ -578,16 +578,6 @@ void GLUtils::createTextureWithBitmap(GLuint texture, const SkBitmap& bitmap, GL } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); - - // The following is a workaround -- remove when EGLImage texture upload is fixed. - GLuint fboID; - glGenFramebuffers(1, &fboID); - glBindFramebuffer(GL_FRAMEBUFFER, fboID); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); - glCheckFramebufferStatus(GL_FRAMEBUFFER); // should return GL_FRAMEBUFFER_COMPLETE - - glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO - glDeleteFramebuffers(1, &fboID); } void GLUtils::updateTextureWithBitmap(GLuint texture, const SkBitmap& bitmap, diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp index 3ed3aad..f0d9e58 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp @@ -30,6 +30,7 @@ #include "Surface.h" #include "AndroidLog.h" +#include "BaseLayerAndroid.h" #include "ClassTracker.h" #include "LayerAndroid.h" #include "GLWebViewState.h" @@ -140,6 +141,9 @@ void Surface::addLayer(LayerAndroid* layer, const TransformationMatrix& transfor m_unclippedArea.x(), m_unclippedArea.y(), m_unclippedArea.width(), m_unclippedArea.height()); } + + if (isBase()) + m_background = static_cast<BaseLayerAndroid*>(layer)->getBackgroundColor(); } IntRect Surface::visibleArea() @@ -250,6 +254,14 @@ bool Surface::isReady() return m_surfaceBacking->isReady(); } +bool Surface::isMissingContent() +{ + if (!m_surfaceBacking) + return true; + + return m_surfaceBacking->isMissingContent(); +} + IntRect Surface::computePrepareArea() { IntRect area; diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h index 756fabd..d197d43 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.h +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h @@ -53,6 +53,7 @@ public: bool drawGL(bool layerTilesDisabled); void swapTiles(); bool isReady(); + bool isMissingContent(); void computeTexturesAmount(TexturesResult* result); @@ -60,7 +61,6 @@ public: bool needsTexture() { return m_needsTexture; } bool hasText() { return m_hasText; } bool isBase(); - void setBackground(Color background) { m_background = background; } // TilePainter methods virtual bool paint(Tile* tile, SkCanvas* canvas); @@ -72,7 +72,6 @@ private: IntRect visibleArea(); IntRect unclippedArea(); bool singleLayer() { return m_layers.size() == 1; } - void updateBackground(const Color& background); bool useAggressiveRendering(); const TransformationMatrix* drawTransform(); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h index b04e462..ec01dbe 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h @@ -59,6 +59,11 @@ public: return !m_zooming && m_frontTexture->isReady() && m_scale > 0; } + bool isMissingContent() + { + return !m_zooming && m_frontTexture->isMissingContent(); + } + int nbTextures(IntRect& area, float scale) { // TODO: consider the zooming case for the backTexture diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp index cd5ceef..24e196b 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp @@ -63,11 +63,8 @@ SurfaceCollection::SurfaceCollection(LayerAndroid* layer) // set the layersurfaces' update count, to be drawn on painted tiles unsigned int updateCount = TilesManager::instance()->incWebkitContentUpdates(); - for (unsigned int i = 0; i < m_surfaces.size(); i++) { + for (unsigned int i = 0; i < m_surfaces.size(); i++) m_surfaces[i]->setUpdateCount(updateCount); - if (m_surfaces[i]->isBase()) - m_surfaces[i]->setBackground(getBackground()); - } #ifdef DEBUG_COUNT ClassTracker::instance()->increment("SurfaceCollection"); @@ -128,7 +125,7 @@ bool SurfaceCollection::drawGL(const SkRect& visibleRect) return needsRedraw; } -Color SurfaceCollection::getBackground() +Color SurfaceCollection::getBackgroundColor() { return static_cast<BaseLayerAndroid*>(m_compositedRoot)->getBackgroundColor(); } @@ -156,6 +153,16 @@ bool SurfaceCollection::isReady() return true; } +bool SurfaceCollection::isMissingBackgroundContent() +{ + if (!m_compositedRoot) + return true; + + // return true when the first surface is missing content (indicating the + // entire viewport isn't covered) + return m_surfaces[0]->isMissingContent(); +} + void SurfaceCollection::computeTexturesAmount(TexturesResult* result) { for (unsigned int i = 0; i < m_surfaces.size(); i++) diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h index 6450c9c..7dfe140 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h @@ -50,9 +50,10 @@ public: // Tiled painting methods (executed on groups) void prepareGL(const SkRect& visibleRect); bool drawGL(const SkRect& visibleRect); - Color getBackground(); + Color getBackgroundColor(); void swapTiles(); bool isReady(); + bool isMissingBackgroundContent(); void computeTexturesAmount(TexturesResult* result); // Recursive tree methods (animations, invals, etc) diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp index 91335c7..8c9cad5 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp @@ -224,6 +224,7 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, // =========================================================================== // Don't have a drawing collection, draw white background Color background = Color::white; + bool drawBackground = true; if (m_drawingCollection) { bool drawingReady = didCollectionSwap || m_drawingCollection->isReady(); @@ -245,17 +246,21 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, m_drawingCollection->evaluateAnimations(currentTime); ALOGV("drawing collection %p", m_drawingCollection); - background = m_drawingCollection->getBackground(); + background = m_drawingCollection->getBackgroundColor(); + drawBackground = m_drawingCollection->isMissingBackgroundContent(); } else if (m_paintingCollection) { // Use paintingCollection background color while tiles are not done painting. - background = m_paintingCollection->getBackground(); + background = m_paintingCollection->getBackgroundColor(); } // Start doing the actual GL drawing. - ALOGV("background is %x", background.rgb()); - // If background is opaque, we can safely and efficiently clear it here. - // Otherwise, we have to calculate all the missing tiles and blend the background. - GLUtils::clearBackgroundIfOpaque(&background); + if (drawBackground) { + ALOGV("background is %x", background.rgb()); + // If background is opaque, we can safely and efficiently clear it here. + // Otherwise, we have to calculate all the missing tiles and blend the background. + GLUtils::clearBackgroundIfOpaque(&background); + } + if (m_drawingCollection && m_drawingCollection->drawGL(visibleRect)) returnFlags |= uirenderer::DrawGlInfo::kStatusDraw; diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp index 2510d52..a58a1d2 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp @@ -274,8 +274,8 @@ int TileGrid::nbTextures(IntRect& area, float scale) } void TileGrid::drawGL(const IntRect& visibleArea, float opacity, - const TransformationMatrix* transform, - const Color* background) + const TransformationMatrix* transform, + const Color* background) { m_area = computeTilesArea(visibleArea, m_scale); if (m_area.width() == 0 || m_area.height() == 0) @@ -322,7 +322,8 @@ void TileGrid::drawGL(const IntRect& visibleArea, float opacity, drawn++; } - if (semiOpaqueBaseSurface) + // log tile information for base, high res tiles + if (m_isBaseSurface && background) TilesManager::instance()->getProfiler()->nextTile(tile, invScale, tileInView); } diff --git a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp index af19f30..a330b41 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp @@ -203,7 +203,6 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, TileTexture* destTex, GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { ALOGV("Error: glCheckFramebufferStatus failed"); - glBindFramebuffer(GL_FRAMEBUFFER, 0); return; } @@ -426,7 +425,6 @@ void TransferQueue::updateDirtyTiles() // dynamic switch possible. Moving this out from the loop can save some // milli-seconds. if (usedFboForUpload) { - glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO restoreGLState(); GLUtils::checkGlError("updateDirtyTiles"); } @@ -593,6 +591,7 @@ void TransferQueue::cleanupPendingDiscard() void TransferQueue::saveGLState() { + glGetIntegerv(GL_FRAMEBUFFER_BINDING, m_GLStateBeforeBlit.bufferId); glGetIntegerv(GL_VIEWPORT, m_GLStateBeforeBlit.viewport); glGetBooleanv(GL_SCISSOR_TEST, m_GLStateBeforeBlit.scissor); glGetBooleanv(GL_DEPTH_TEST, m_GLStateBeforeBlit.depth); @@ -616,6 +615,7 @@ void TransferQueue::setGLStateForCopy(int width, int height) void TransferQueue::restoreGLState() { + glBindFramebuffer(GL_FRAMEBUFFER, m_GLStateBeforeBlit.bufferId[0]); glViewport(m_GLStateBeforeBlit.viewport[0], m_GLStateBeforeBlit.viewport[1], m_GLStateBeforeBlit.viewport[2], diff --git a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h index 65ff116..d1024a4 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h +++ b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h @@ -40,6 +40,7 @@ class Tile; class TileTexture; struct GLState { + GLint bufferId[1]; GLint viewport[4]; GLboolean scissor[1]; GLboolean depth[1]; diff --git a/Source/WebCore/rendering/RenderFileUploadControl.cpp b/Source/WebCore/rendering/RenderFileUploadControl.cpp index 8056662..109d219 100644 --- a/Source/WebCore/rendering/RenderFileUploadControl.cpp +++ b/Source/WebCore/rendering/RenderFileUploadControl.cpp @@ -122,6 +122,13 @@ String RenderFileUploadControl::acceptTypes() return static_cast<HTMLInputElement*>(node())->accept(); } +#if ENABLE(MEDIA_CAPTURE) +String RenderFileUploadControl::capture() +{ + return static_cast<HTMLInputElement*>(node())->capture(); +} +#endif + void RenderFileUploadControl::chooseIconForFiles(FileChooser* chooser, const Vector<String>& filenames) { if (Chrome* chromePointer = chrome()) diff --git a/Source/WebCore/rendering/RenderFileUploadControl.h b/Source/WebCore/rendering/RenderFileUploadControl.h index e9fb7f0..b57260d 100644 --- a/Source/WebCore/rendering/RenderFileUploadControl.h +++ b/Source/WebCore/rendering/RenderFileUploadControl.h @@ -68,6 +68,9 @@ private: #endif String acceptTypes(); void chooseIconForFiles(FileChooser*, const Vector<String>&); +#if ENABLE(MEDIA_CAPTURE) + String capture(); +#endif Chrome* chrome() const; int maxFilenameWidth() const; diff --git a/Source/WebKit/android/jni/AndroidHitTestResult.cpp b/Source/WebKit/android/jni/AndroidHitTestResult.cpp index 9be5613..a135c42 100644 --- a/Source/WebKit/android/jni/AndroidHitTestResult.cpp +++ b/Source/WebKit/android/jni/AndroidHitTestResult.cpp @@ -141,9 +141,10 @@ void AndroidHitTestResult::buildHighlightRects() IntPoint frameOffset = m_webViewCore->convertGlobalContentToFrameContent(IntPoint(), frame); RenderObject* renderer = node->renderer(); Vector<FloatQuad> quads; - renderer->absoluteFocusRingQuads(quads); + if (renderer->isInline()) + renderer->absoluteFocusRingQuads(quads); if (!quads.size()) - renderer->absoluteQuads(quads); // No fancy rings, grab some backups + renderer->absoluteQuads(quads); // No fancy rings, grab a bounding box for (size_t i = 0; i < quads.size(); i++) { IntRect boundingBox = quads[i].enclosingBoundingBox(); boundingBox.move(-frameOffset.x(), -frameOffset.y()); diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index cdd484b..7da8103 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -457,7 +457,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_scrollTo = GetJMethod(env, clazz, "contentScrollTo", "(IIZZ)V"); m_javaGlue->m_contentDraw = GetJMethod(env, clazz, "contentDraw", "()V"); m_javaGlue->m_requestListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[I[I)V"); - m_javaGlue->m_openFileChooser = GetJMethod(env, clazz, "openFileChooser", "(Ljava/lang/String;)Ljava/lang/String;"); + m_javaGlue->m_openFileChooser = GetJMethod(env, clazz, "openFileChooser", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"); m_javaGlue->m_requestSingleListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[II)V"); m_javaGlue->m_jsAlert = GetJMethod(env, clazz, "jsAlert", "(Ljava/lang/String;Ljava/lang/String;)V"); m_javaGlue->m_jsConfirm = GetJMethod(env, clazz, "jsConfirm", "(Ljava/lang/String;Ljava/lang/String;)Z"); @@ -3008,11 +3008,19 @@ void WebViewCore::openFileChooser(PassRefPtr<WebCore::FileChooser> chooser) return; WTF::String acceptType = chooser->acceptTypes(); + WTF::String capture; + +#if ENABLE(MEDIA_CAPTURE) + capture = chooser->capture(); +#endif + jstring jAcceptType = wtfStringToJstring(env, acceptType, true); + jstring jCapture = wtfStringToJstring(env, capture, true); jstring jName = (jstring) env->CallObjectMethod( - javaObject.get(), m_javaGlue->m_openFileChooser, jAcceptType); + javaObject.get(), m_javaGlue->m_openFileChooser, jAcceptType, jCapture); checkException(env); env->DeleteLocalRef(jAcceptType); + env->DeleteLocalRef(jCapture); WTF::String wtfString = jstringToWtfString(env, jName); env->DeleteLocalRef(jName); @@ -3124,27 +3132,6 @@ void WebViewCore::chromeTakeFocus(FocusDirection direction) env->CallVoidMethod(javaObject.get(), m_javaGlue->m_chromeTakeFocus, direction); } -// For when the user clicks the trackball, presses dpad center, or types into an -// unfocused textfield. In the latter case, 'fake' will be true -void WebViewCore::click(WebCore::Frame* frame, WebCore::Node* node, bool fake) { - if (!node) { - WebCore::IntPoint pt = m_mousePos; - pt.move(m_scrollOffsetX, m_scrollOffsetY); - WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()-> - hitTestResultAtPoint(pt, false); - node = hitTestResult.innerNode(); - frame = node->document()->frame(); - } - if (node) { - EditorClientAndroid* client - = static_cast<EditorClientAndroid*>( - m_mainFrame->editor()->client()); - client->setShouldChangeSelectedRange(false); - handleMouseClick(frame, node, fake); - client->setShouldChangeSelectedRange(true); - } -} - #if USE(ACCELERATED_COMPOSITING) GraphicsLayerAndroid* WebViewCore::graphicsRootLayer() const { @@ -3199,14 +3186,6 @@ bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint type = WebCore::TouchEnd; defaultTouchState = WebCore::PlatformTouchPoint::TouchStationary; break; - case 0x100: // WebViewCore.ACTION_LONGPRESS - type = WebCore::TouchLongPress; - defaultTouchState = WebCore::PlatformTouchPoint::TouchPressed; - break; - case 0x200: // WebViewCore.ACTION_DOUBLETAP - type = WebCore::TouchDoubleTap; - defaultTouchState = WebCore::PlatformTouchPoint::TouchPressed; - break; default: // We do not support other kinds of touch event inside WebCore // at the moment. @@ -3240,31 +3219,6 @@ bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint return preventDefault; } -void WebViewCore::touchUp(int touchGeneration, - WebCore::Frame* frame, WebCore::Node* node, int x, int y) -{ - if (touchGeneration == 0) { - // m_mousePos should be set in getTouchHighlightRects() - WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(m_mousePos, false); - node = hitTestResult.innerNode(); - if (node) - frame = node->document()->frame(); - else - frame = 0; - } else { - if (m_touchGeneration > touchGeneration) - return; // short circuit if a newer touch has been generated - // This moves m_mousePos to the correct place, and handleMouseClick uses - // m_mousePos to determine where the click happens. - moveMouse(x, y); - m_lastGeneration = touchGeneration; - } - if (frame && validNode(m_mainFrame, frame, 0)) { - frame->loader()->resetMultipleFormSubmissionProtection(); - } - handleMouseClick(frame, node, false); -} - bool WebViewCore::performMouseClick() { WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, @@ -3298,38 +3252,6 @@ static bool shouldSuppressKeyboard(const WebCore::Node* node) { return false; } -// Common code for both clicking with the trackball and touchUp -// Also used when typing into a non-focused textfield to give the textfield focus, -// in which case, 'fake' is set to true -bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr, bool fake) -{ - bool valid = !framePtr || validNode(m_mainFrame, framePtr, nodePtr); - WebFrame* webFrame = WebFrame::getWebFrame(m_mainFrame); - if (valid && nodePtr) { - // Need to special case area tags because an image map could have an area element in the middle - // so when attempting to get the default, the point chosen would be follow the wrong link. - if (nodePtr->hasTagName(WebCore::HTMLNames::areaTag)) { - nodePtr->dispatchSimulatedClick(0, true, true); - return true; - } - } - if (!valid || !framePtr) - framePtr = m_mainFrame; - WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, - WebCore::MouseEventPressed, 1, false, false, false, false, - WTF::currentTime()); - // ignore the return from as it will return true if the hit point can trigger selection change - framePtr->eventHandler()->handleMousePressEvent(mouseDown); - WebCore::PlatformMouseEvent mouseUp(m_mousePos, m_mousePos, WebCore::LeftButton, - WebCore::MouseEventReleased, 1, false, false, false, false, - WTF::currentTime()); - bool handled = framePtr->eventHandler()->handleMouseReleaseEvent(mouseUp); - - WebCore::Node* focusNode = currentFocus(); - initializeTextInput(focusNode, fake); - return handled; -} - WebViewCore::InputType WebViewCore::getInputType(Node* node) { WebCore::RenderObject* renderer = node->renderer(); @@ -4479,16 +4401,6 @@ static jboolean Key(JNIEnv* env, jobject obj, jint nativeClass, jint keyCode, unichar, repeatCount, isDown, isShift, isAlt, isSym)); } -static void Click(JNIEnv* env, jobject obj, jint nativeClass, int framePtr, - int nodePtr, jboolean fake) -{ - WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); - ALOG_ASSERT(viewImpl, "viewImpl not set in Click"); - - viewImpl->click(reinterpret_cast<WebCore::Frame*>(framePtr), - reinterpret_cast<WebCore::Node*>(nodePtr), fake); -} - static void ContentInvalidateAll(JNIEnv* env, jobject obj, jint nativeClass) { reinterpret_cast<WebViewCore*>(nativeClass)->contentInvalidateAll(); @@ -4666,15 +4578,6 @@ static jboolean HandleTouchEvent(JNIEnv* env, jobject obj, jint nativeClass, return viewImpl->handleTouchEvent(action, ids, points, actionIndex, metaState); } -static void TouchUp(JNIEnv* env, jobject obj, jint nativeClass, - jint touchGeneration, jint frame, jint node, jint x, jint y) -{ - WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); - ALOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); - viewImpl->touchUp(touchGeneration, - (WebCore::Frame*) frame, (WebCore::Node*) node, x, y); -} - static bool MouseClick(JNIEnv* env, jobject obj, jint nativeClass) { WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); @@ -5064,8 +4967,6 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) FocusBoundsChanged } , { "nativeKey", "(IIIIZZZZ)Z", (void*) Key }, - { "nativeClick", "(IIIZ)V", - (void*) Click }, { "nativeContentInvalidateAll", "(I)V", (void*) ContentInvalidateAll }, { "nativeSendListBoxChoices", "(I[ZI)V", @@ -5099,9 +5000,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { { "nativeFindAddress", "(Ljava/lang/String;Z)Ljava/lang/String;", (void*) FindAddress }, { "nativeHandleTouchEvent", "(II[I[I[IIII)Z", - (void*) HandleTouchEvent }, - { "nativeTouchUp", "(IIIIII)V", - (void*) TouchUp }, + (void*) HandleTouchEvent }, { "nativeMouseClick", "(I)Z", (void*) MouseClick }, { "nativeRetrieveHref", "(III)Ljava/lang/String;", diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index 00b4bda..82a65cf 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -323,13 +323,6 @@ namespace android { void chromeTakeFocus(WebCore::FocusDirection direction); /** - * Handle (trackball) click event / dpad center press from Java. - * Also used when typing into an unfocused textfield, in which case 'fake' - * will be true. - */ - void click(WebCore::Frame* frame, WebCore::Node* node, bool fake); - - /** * Handle touch event */ bool handleTouchEvent(int action, WTF::Vector<int>& ids, @@ -337,19 +330,6 @@ namespace android { int actionIndex, int metaState); /** - * Handle motionUp event from the UI thread (called touchUp in the - * WebCore thread). - * @param touchGeneration Generation number for touches so we can ignore - * touches when a newer one has been generated. - * @param frame Pointer to Frame containing the node that was touched. - * @param node Pointer to Node that was touched. - * @param x x-position of the touch. - * @param y y-position of the touch. - */ - void touchUp(int touchGeneration, WebCore::Frame* frame, - WebCore::Node* node, int x, int y); - - /** * Clicks the mouse at its current location */ bool performMouseClick(); @@ -659,7 +639,6 @@ namespace android { * @param fake This is a fake mouse click, used to put a textfield into focus. Do not * open the IME. */ - bool handleMouseClick(WebCore::Frame*, WebCore::Node*, bool fake); WebCore::HTMLAnchorElement* retrieveAnchorElement(int x, int y); WebCore::HTMLElement* retrieveElement(int x, int y, const WebCore::QualifiedName& ); diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 44ad1c5..22598eb 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -711,13 +711,17 @@ class GLDrawFunctor : Functor { int titlebarHeight = webViewRect.height() - viewRect.height(); uirenderer::DrawGlInfo* info = reinterpret_cast<uirenderer::DrawGlInfo*>(data); - WebCore::IntRect localViewRect = viewRect; - if (info->isLayer) - localViewRect.move(-1 * localViewRect.x(), -1 * localViewRect.y()); - WebCore::IntRect clip(info->clipLeft, info->clipTop, info->clipRight - info->clipLeft, info->clipBottom - info->clipTop); + + WebCore::IntRect localViewRect = viewRect; + if (info->isLayer) { + // When webview is on a layer, we need to use the viewport relative + // to the FBO, rather than the screen(which will use viewRect). + localViewRect.setX(clip.x()); + localViewRect.setY(info->height - clip.y() - clip.height()); + } bool shouldDraw = (messageId == uirenderer::DrawGlInfo::kModeDraw); TilesManager::instance()->shader()->setWebViewMatrix(info->transform, info->isLayer); int returnFlags = (*wvInstance.*funcPtr)(localViewRect, &inval, webViewRect, |