diff options
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/WebCorePrefixAndroid.h | 1 | ||||
-rw-r--r-- | WebCore/bindings/v8/custom/V8DatabaseCustom.cpp | 41 | ||||
-rw-r--r-- | WebCore/platform/android/RenderThemeAndroid.cpp | 6 | ||||
-rw-r--r-- | WebCore/platform/graphics/GraphicsContext.h | 2 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GraphicsContextAndroid.cpp | 13 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/ImageAndroid.cpp | 4 | ||||
-rw-r--r-- | WebCore/rendering/RenderBoxModelObject.cpp | 4 | ||||
-rw-r--r-- | WebCore/storage/Database.cpp | 60 |
8 files changed, 93 insertions, 38 deletions
diff --git a/WebCore/WebCorePrefixAndroid.h b/WebCore/WebCorePrefixAndroid.h index 901af5f..01e9b28 100644 --- a/WebCore/WebCorePrefixAndroid.h +++ b/WebCore/WebCorePrefixAndroid.h @@ -94,7 +94,6 @@ typedef unsigned char flex_uint8_t; // Converts ListBoxes to dropdown popup lists. #define ANDROID_LISTBOX_USES_MENU_LIST -#define ANDROID_ALLOW_TRANSPARENT_BACKGROUNDS #define ANDROID_HISTORY_CLIENT #define ANDROID_MULTIPLE_WINDOWS #define ANDROID_CSS_TAP_HIGHLIGHT_COLOR diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp index 300e829..cdcef31 100644 --- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp @@ -45,6 +45,45 @@ namespace WebCore { CALLBACK_FUNC_DECL(DatabaseChangeVersion) { INC_STATS("DOM.Database.changeVersion()"); + + if (args.Length() < 2) + return throwError("The old and new version strings are required.", V8Proxy::SyntaxError); + + if (!(args[0]->IsString() && args[1]->IsString())) + return throwError("The old and new versions must be strings."); + + Database* database = V8DOMWrapper::convertToNativeObject<Database>(V8ClassIndex::DATABASE, args.Holder()); + + Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); + if (!frame) + return v8::Undefined(); + + RefPtr<V8CustomSQLTransactionCallback> callback; + if (args.Length() > 2) { + if (!args[2]->IsObject()) + return throwError("changeVersion transaction callback must be of valid type."); + + callback = V8CustomSQLTransactionCallback::create(args[2], frame); + } + + RefPtr<V8CustomSQLTransactionErrorCallback> errorCallback; + if (args.Length() > 3) { + if (!args[3]->IsObject()) + return throwError("changeVersion error callback must be of valid type."); + + errorCallback = V8CustomSQLTransactionErrorCallback::create(args[3], frame); + } + + RefPtr<V8CustomVoidCallback> successCallback; + if (args.Length() > 4) { + if (!args[4]->IsObject()) + return throwError("changeVersion success callback must be of valid type."); + + successCallback = V8CustomVoidCallback::create(args[4], frame); + } + + database->changeVersion(toWebCoreString(args[0]), toWebCoreString(args[1]), callback.release(), errorCallback.release(), successCallback.release()); + return v8::Undefined(); } @@ -76,7 +115,7 @@ CALLBACK_FUNC_DECL(DatabaseTransaction) RefPtr<V8CustomVoidCallback> successCallback; if (args.Length() > 2) { - if (!args[1]->IsObject()) + if (!args[2]->IsObject()) return throwError("Transaction success callback must be of valid type."); successCallback = V8CustomVoidCallback::create(args[2], frame); diff --git a/WebCore/platform/android/RenderThemeAndroid.cpp b/WebCore/platform/android/RenderThemeAndroid.cpp index 0f419f5..aae8c48 100644 --- a/WebCore/platform/android/RenderThemeAndroid.cpp +++ b/WebCore/platform/android/RenderThemeAndroid.cpp @@ -259,12 +259,6 @@ static void adjustMenuListStyleCommon(RenderStyle* style, Element* e) { // Added to make room for our arrow. style->setPaddingRight(Length(RenderSkinCombo::extraWidth(), Fixed)); - // Code copied from RenderThemeMac.mm - // Makes sure that the text shows up on our treatment - bool isEnabled = true; - if (e) - isEnabled = e->isEnabledFormControl(); - style->setColor(isEnabled ? Color::black : Color::darkGray); } void RenderThemeAndroid::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element* e) const diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index b52344d..233c14c 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -204,6 +204,8 @@ namespace WebCore { void setCMYKAFillColor(float c, float m, float y, float k, float a); void setCMYKAStrokeColor(float c, float m, float y, float k, float a); + // initialize a paint for bitmaps + void setupBitmapPaint(SkPaint*); // initialize a paint for filling void setupFillPaint(SkPaint*); // initialize a paint for stroking diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index 34b709b..46ac9da 100644 --- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -247,6 +247,13 @@ public: paint->setColor(mState->applyAlpha(mState->mFillColor)); } + void setup_paint_bitmap(SkPaint* paint) const { + this->setup_paint_common(paint); + // we only want the global alpha for bitmaps, + // so just give applyAlpha opaque black + paint->setColor(mState->applyAlpha(0xFF000000)); + } + /* sets up the paint for stroking. Returns true if the style is really just a dash of squares (the size of the paint's stroke-width. */ @@ -831,10 +838,14 @@ void GraphicsContext::endTransparencyLayer() /////////////////////////////////////////////////////////////////////////// + void GraphicsContext::setupBitmapPaint(SkPaint* paint) { + m_data->setup_paint_bitmap(paint); + } + void GraphicsContext::setupFillPaint(SkPaint* paint) { m_data->setup_paint_fill(paint); } - + void GraphicsContext::setupStrokePaint(SkPaint* paint) { m_data->setup_paint_stroke(paint, NULL); } diff --git a/WebCore/platform/graphics/android/ImageAndroid.cpp b/WebCore/platform/graphics/android/ImageAndroid.cpp index 16a450f..177aa1f 100644 --- a/WebCore/platform/graphics/android/ImageAndroid.cpp +++ b/WebCore/platform/graphics/android/ImageAndroid.cpp @@ -224,7 +224,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, SkCanvas* canvas = ctxt->platformContext()->mCanvas; SkPaint paint; - ctxt->setupFillPaint(&paint); // need global alpha among other things + ctxt->setupBitmapPaint(&paint); // need global alpha among other things paint.setFilterBitmap(true); paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp)); fixPaintForBitmapsThatMaySeam(&paint); @@ -292,7 +292,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, SkCanvas* canvas = ctxt->platformContext()->mCanvas; SkPaint paint; - ctxt->setupFillPaint(&paint); // need global alpha among other things + ctxt->setupBitmapPaint(&paint); // need global alpha among other things SkShader* shader = SkShader::CreateBitmapShader(bitmap, SkShader::kRepeat_TileMode, diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp index 3a7ff71..2b05170 100644 --- a/WebCore/rendering/RenderBoxModelObject.cpp +++ b/WebCore/rendering/RenderBoxModelObject.cpp @@ -439,12 +439,8 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co context->setCompositeOperation(CompositeCopy); context->fillRect(rect, baseColor); context->restore(); -#ifdef ANDROID_ALLOW_TRANSPARENT_BACKGROUNDS - } -#else } else context->clearRect(rect); -#endif } if (bgColor.isValid() && bgColor.alpha() > 0) diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index 5504cb1..8118e76 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -89,6 +89,22 @@ static GuidVersionMap& guidToVersionMap() return map; } +// NOTE: Caller must lock guidMutex(). +static inline void updateGuidVersionMap(int guid, String newVersion) +{ + // Ensure the the mutex is locked. + ASSERT(!guidMutex().tryLock()); + + // Note: It is not safe to put an empty string into the guidToVersionMap() map. + // That's because the map is cross-thread, but empty strings are per-thread. + // The copy() function makes a version of the string you can use on the current + // thread, but we need a string we can keep in a cross-thread data structure. + // FIXME: This is a quite-awkward restriction to have to program with. + + // Map null string to empty string (see comment above). + guidToVersionMap().set(guid, newVersion.isEmpty() ? String() : newVersion.copy()); +} + typedef HashMap<int, HashSet<Database*>*> GuidDatabaseMap; static GuidDatabaseMap& guidToDatabaseMap() { @@ -178,20 +194,6 @@ Database::Database(Document* document, const String& name, const String& expecte Database::~Database() { - { - MutexLocker locker(guidMutex()); - - HashSet<Database*>* hashSet = guidToDatabaseMap().get(m_guid); - ASSERT(hashSet); - ASSERT(hashSet->contains(this)); - hashSet->remove(this); - if (hashSet->isEmpty()) { - guidToDatabaseMap().remove(m_guid); - delete hashSet; - guidToVersionMap().remove(m_guid); - } - } - if (m_document->databaseThread()) m_document->databaseThread()->unscheduleDatabaseTasks(this); @@ -278,6 +280,8 @@ static bool setTextValueInDatabase(SQLiteDatabase& db, const String& query, cons bool Database::setVersionInDatabase(const String& version) { + // The INSERT will replace an existing entry for the database with the new version number, due to the UNIQUE ON CONFLICT REPLACE + // clause in the CREATE statement (see Database::performOpenAndVerify()). DEFINE_STATIC_LOCAL(String, setVersionQuery, ("INSERT INTO " + databaseInfoTableName() + " (key, value) VALUES ('" + databaseVersionKey() + "', ?);")); m_databaseAuthorizer->disable(); @@ -331,6 +335,20 @@ void Database::close() m_sqliteDatabase.close(); m_document->databaseThread()->recordDatabaseClosed(this); m_opened = false; + + { + MutexLocker locker(guidMutex()); + + HashSet<Database*>* hashSet = guidToDatabaseMap().get(m_guid); + ASSERT(hashSet); + ASSERT(hashSet->contains(this)); + hashSet->remove(this); + if (hashSet->isEmpty()) { + guidToDatabaseMap().remove(m_guid); + delete hashSet; + guidToVersionMap().remove(m_guid); + } + } } } @@ -458,15 +476,9 @@ bool Database::performOpenAndVerify(ExceptionCode& e) { MutexLocker locker(guidMutex()); - // Note: It is not safe to put an empty string into the guidToVersionMap() map. - // That's because the map is cross-thread, but empty strings are per-thread. - // The copy() function makes a version of the string you can use on the current - // thread, but we need a string we can keep in a cross-thread data structure. - // FIXME: This is a quite-awkward restriction to have to program with. - GuidVersionMap::iterator entry = guidToVersionMap().find(m_guid); if (entry != guidToVersionMap().end()) { - // Map null string to empty string (see comment above). + // Map null string to empty string (see updateGuidVersionMap()). currentVersion = entry->second.isNull() ? String("") : entry->second; LOG(StorageAPI, "Current cached version for guid %i is %s", m_guid, currentVersion.ascii().data()); } else { @@ -488,8 +500,7 @@ bool Database::performOpenAndVerify(ExceptionCode& e) currentVersion = m_expectedVersion; } - // Map empty string to null string (see comment above). - guidToVersionMap().set(m_guid, currentVersion.isEmpty() ? String() : currentVersion.copy()); + updateGuidVersionMap(m_guid, currentVersion); } } @@ -619,6 +630,9 @@ Vector<String> Database::tableNames() void Database::setExpectedVersion(const String& version) { m_expectedVersion = version.copy(); + // Update the in memory database version map. + MutexLocker locker(guidMutex()); + updateGuidVersionMap(m_guid, version); } PassRefPtr<SecurityOrigin> Database::securityOriginCopy() const |