Loading browser/locales/en-US/searchplugins/google.xml +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ <ShortName>Google</ShortName> <Description>Google Search</Description> <InputEncoding>UTF-8</InputEncoding> <Image width="16" height="16">data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bs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FRjBVgAAAABJRU5ErkJggg==</Image> <Url type="application/x-suggestions+json" method="GET" template="https://www.google.com/complete/search?client=firefox&q={searchTerms}"/> <Url type="text/html" method="GET" template="https://www.google.com/search"> #expand __GOOGLE_PARAMS__ Loading configure.in +2 −1 Original line number Diff line number Diff line dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*- dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4: dnl This Source Code Form is subject to the terms of the Mozilla Public Loading Loading @@ -197,7 +198,7 @@ if test -n "$gonkdir" ; then ;; esac CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera -I$gonkdir/system/media/wilhelm/include" CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera -I$gonkdir/system/media/wilhelm/include -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/dalvik/libnativehelper/include/nativehelper" CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS" CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS" dnl Add -llog by default, since we use it all over the place. Loading docshell/test/file_bug590573_1.html +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ <body onpopstate='opener.page1Popstate();' onload='opener.page1Load();' onpageshow='opener.page1PageShow();'> <div style='height:300%' id='div1'>This is a very tall div.</div> <div style='height:10000px' id='div1'>This is a very tall div.</div> </body> </html> dom/browser-element/BrowserElementScrolling.js +5 −27 Original line number Diff line number Diff line Loading @@ -206,42 +206,20 @@ const ContentPanning = { let metrics = data.json; let displayPort = metrics.displayPort; let screenWidth = metrics.screenSize.width; let screenHeight = metrics.screenSize.height; let compositionWidth = metrics.compositionBounds.width; let compositionHeight = metrics.compositionBounds.height; let x = metrics.x; let y = metrics.y; this._zoom = metrics.zoom; this._viewport = new Rect(x, y, screenWidth / metrics.zoom, screenHeight / metrics.zoom); compositionWidth / metrics.zoom, compositionHeight / metrics.zoom); this._cssPageRect = new Rect(metrics.cssPageRect.x, metrics.cssPageRect.y, metrics.cssPageRect.width, metrics.cssPageRect.height); let cwu = content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); if (this._screenWidth != screenWidth || this._screenHeight != screenHeight) { cwu.setCSSViewport(screenWidth, screenHeight); this._screenWidth = screenWidth; this._screenHeight = screenHeight; } // Set scroll position cwu.setScrollPositionClampingScrollPortSize( screenWidth / metrics.zoom, screenHeight / metrics.zoom); content.scrollTo(x, y); cwu.setResolution(displayPort.resolution, displayPort.resolution); let element = null; if (content.document && (element = content.document.documentElement)) { cwu.setDisplayPortForElement(displayPort.left, displayPort.top, displayPort.width, displayPort.height, element); } }, _recvDoubleTap: function(data) { Loading Loading @@ -272,7 +250,7 @@ const ContentPanning = { let cssPageRect = this._cssPageRect; let viewport = this._viewport; let bRect = new Rect(Math.max(cssPageRect.left, rect.x - margin), let bRect = new Rect(Math.max(cssPageRect.x, rect.x - margin), rect.y, rect.w + 2 * margin, rect.h); Loading dom/camera/AudioParameter.cpp 0 → 100644 +179 −0 Original line number Diff line number Diff line /* * Copyright (C) 2006-2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "AudioParameter" //#define LOG_NDEBUG 0 #include <utils/Log.h> #include <media/AudioParameter.h> namespace android { const char *AudioParameter::keyRouting = "routing"; const char *AudioParameter::keySamplingRate = "sampling_rate"; const char *AudioParameter::keyFormat = "format"; const char *AudioParameter::keyChannels = "channels"; const char *AudioParameter::keyFrameCount = "frame_count"; const char *AudioParameter::keyInputSource = "input_source"; AudioParameter::AudioParameter(const String8& keyValuePairs) { char *str = new char[keyValuePairs.length()+1]; mKeyValuePairs = keyValuePairs; strcpy(str, keyValuePairs.string()); char *pair = strtok(str, ";"); while (pair != NULL) { if (strlen(pair) != 0) { size_t eqIdx = strcspn(pair, "="); String8 key = String8(pair, eqIdx); String8 value; if (eqIdx == strlen(pair)) { value = String8(""); } else { value = String8(pair + eqIdx + 1); } if (mParameters.indexOfKey(key) < 0) { mParameters.add(key, value); } else { mParameters.replaceValueFor(key, value); } } else { LOGV("AudioParameter() cstor empty key value pair"); } pair = strtok(NULL, ";"); } delete[] str; } AudioParameter::~AudioParameter() { mParameters.clear(); } String8 AudioParameter::toString() { String8 str = String8(""); size_t size = mParameters.size(); for (size_t i = 0; i < size; i++) { str += mParameters.keyAt(i); str += "="; str += mParameters.valueAt(i); if (i < (size - 1)) str += ";"; } return str; } status_t AudioParameter::add(const String8& key, const String8& value) { if (mParameters.indexOfKey(key) < 0) { mParameters.add(key, value); return NO_ERROR; } else { mParameters.replaceValueFor(key, value); return ALREADY_EXISTS; } } status_t AudioParameter::addInt(const String8& key, const int value) { char str[12]; if (snprintf(str, 12, "%d", value) > 0) { String8 str8 = String8(str); return add(key, str8); } else { return BAD_VALUE; } } status_t AudioParameter::addFloat(const String8& key, const float value) { char str[23]; if (snprintf(str, 23, "%.10f", value) > 0) { String8 str8 = String8(str); return add(key, str8); } else { return BAD_VALUE; } } status_t AudioParameter::remove(const String8& key) { if (mParameters.indexOfKey(key) >= 0) { mParameters.removeItem(key); return NO_ERROR; } else { return BAD_VALUE; } } status_t AudioParameter::get(const String8& key, String8& value) { if (mParameters.indexOfKey(key) >= 0) { value = mParameters.valueFor(key); return NO_ERROR; } else { return BAD_VALUE; } } status_t AudioParameter::getInt(const String8& key, int& value) { String8 str8; status_t result = get(key, str8); value = 0; if (result == NO_ERROR) { int val; if (sscanf(str8.string(), "%d", &val) == 1) { value = val; } else { result = INVALID_OPERATION; } } return result; } status_t AudioParameter::getFloat(const String8& key, float& value) { String8 str8; status_t result = get(key, str8); value = 0; if (result == NO_ERROR) { float val; if (sscanf(str8.string(), "%f", &val) == 1) { value = val; } else { result = INVALID_OPERATION; } } return result; } status_t AudioParameter::getAt(size_t index, String8& key, String8& value) { if (mParameters.size() > index) { key = mParameters.keyAt(index); value = mParameters.valueAt(index); return NO_ERROR; } else { return BAD_VALUE; } } }; // namespace android Loading
browser/locales/en-US/searchplugins/google.xml +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ <ShortName>Google</ShortName> <Description>Google Search</Description> <InputEncoding>UTF-8</InputEncoding> <Image width="16" height="16">data:image/png;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%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA</Image> <Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABUUlEQVR42pWTzUsCYRCH9y9zu3SooCCkjhIRRLeIykXokiWCJ7PvDpZRlz6si1lIQZ3SQxQdOhREpgSm0JeQvfu0+i6I7LKLh4F5h5nnnRl+o6jTdHn8omAYbVqhXqvYFXcEBKFDwcoZZB8B4LkEB9cwGGmFKHb01A1EU9JXzfdvDYZi1lwLwBcVAIwsNWPesIwls7gDtB2Z7N9ujVe+IX2LO2AgItB1OL9vJqsmILDrOoK02IkBAdYy4FsQJC5h+VQCHQDWTqYSgo8fuHuRxS4Ae3stQ7UGE5ttAHqCUgfxC7m4ryrowOyeO6CxqHwZxtYFqtYc5+kNan/gDTsAeueEIRj7n/rmRQMwueUAGF0VAAT3rQBTC0Y3DoDOGbm00icML4oWHYSTgo0MFqjlmPpDgqMcFCuQf4erBzjOwXjcriu9qHg0uutO2+es6fl67T9ptebvFRjBVgAAAABJRU5ErkJggg==</Image> <Url type="application/x-suggestions+json" method="GET" template="https://www.google.com/complete/search?client=firefox&q={searchTerms}"/> <Url type="text/html" method="GET" template="https://www.google.com/search"> #expand __GOOGLE_PARAMS__ Loading
configure.in +2 −1 Original line number Diff line number Diff line dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*- dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4: dnl This Source Code Form is subject to the terms of the Mozilla Public Loading Loading @@ -197,7 +198,7 @@ if test -n "$gonkdir" ; then ;; esac CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera -I$gonkdir/system/media/wilhelm/include" CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera -I$gonkdir/system/media/wilhelm/include -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/dalvik/libnativehelper/include/nativehelper" CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS" CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS" dnl Add -llog by default, since we use it all over the place. Loading
docshell/test/file_bug590573_1.html +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ <body onpopstate='opener.page1Popstate();' onload='opener.page1Load();' onpageshow='opener.page1PageShow();'> <div style='height:300%' id='div1'>This is a very tall div.</div> <div style='height:10000px' id='div1'>This is a very tall div.</div> </body> </html>
dom/browser-element/BrowserElementScrolling.js +5 −27 Original line number Diff line number Diff line Loading @@ -206,42 +206,20 @@ const ContentPanning = { let metrics = data.json; let displayPort = metrics.displayPort; let screenWidth = metrics.screenSize.width; let screenHeight = metrics.screenSize.height; let compositionWidth = metrics.compositionBounds.width; let compositionHeight = metrics.compositionBounds.height; let x = metrics.x; let y = metrics.y; this._zoom = metrics.zoom; this._viewport = new Rect(x, y, screenWidth / metrics.zoom, screenHeight / metrics.zoom); compositionWidth / metrics.zoom, compositionHeight / metrics.zoom); this._cssPageRect = new Rect(metrics.cssPageRect.x, metrics.cssPageRect.y, metrics.cssPageRect.width, metrics.cssPageRect.height); let cwu = content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); if (this._screenWidth != screenWidth || this._screenHeight != screenHeight) { cwu.setCSSViewport(screenWidth, screenHeight); this._screenWidth = screenWidth; this._screenHeight = screenHeight; } // Set scroll position cwu.setScrollPositionClampingScrollPortSize( screenWidth / metrics.zoom, screenHeight / metrics.zoom); content.scrollTo(x, y); cwu.setResolution(displayPort.resolution, displayPort.resolution); let element = null; if (content.document && (element = content.document.documentElement)) { cwu.setDisplayPortForElement(displayPort.left, displayPort.top, displayPort.width, displayPort.height, element); } }, _recvDoubleTap: function(data) { Loading Loading @@ -272,7 +250,7 @@ const ContentPanning = { let cssPageRect = this._cssPageRect; let viewport = this._viewport; let bRect = new Rect(Math.max(cssPageRect.left, rect.x - margin), let bRect = new Rect(Math.max(cssPageRect.x, rect.x - margin), rect.y, rect.w + 2 * margin, rect.h); Loading
dom/camera/AudioParameter.cpp 0 → 100644 +179 −0 Original line number Diff line number Diff line /* * Copyright (C) 2006-2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "AudioParameter" //#define LOG_NDEBUG 0 #include <utils/Log.h> #include <media/AudioParameter.h> namespace android { const char *AudioParameter::keyRouting = "routing"; const char *AudioParameter::keySamplingRate = "sampling_rate"; const char *AudioParameter::keyFormat = "format"; const char *AudioParameter::keyChannels = "channels"; const char *AudioParameter::keyFrameCount = "frame_count"; const char *AudioParameter::keyInputSource = "input_source"; AudioParameter::AudioParameter(const String8& keyValuePairs) { char *str = new char[keyValuePairs.length()+1]; mKeyValuePairs = keyValuePairs; strcpy(str, keyValuePairs.string()); char *pair = strtok(str, ";"); while (pair != NULL) { if (strlen(pair) != 0) { size_t eqIdx = strcspn(pair, "="); String8 key = String8(pair, eqIdx); String8 value; if (eqIdx == strlen(pair)) { value = String8(""); } else { value = String8(pair + eqIdx + 1); } if (mParameters.indexOfKey(key) < 0) { mParameters.add(key, value); } else { mParameters.replaceValueFor(key, value); } } else { LOGV("AudioParameter() cstor empty key value pair"); } pair = strtok(NULL, ";"); } delete[] str; } AudioParameter::~AudioParameter() { mParameters.clear(); } String8 AudioParameter::toString() { String8 str = String8(""); size_t size = mParameters.size(); for (size_t i = 0; i < size; i++) { str += mParameters.keyAt(i); str += "="; str += mParameters.valueAt(i); if (i < (size - 1)) str += ";"; } return str; } status_t AudioParameter::add(const String8& key, const String8& value) { if (mParameters.indexOfKey(key) < 0) { mParameters.add(key, value); return NO_ERROR; } else { mParameters.replaceValueFor(key, value); return ALREADY_EXISTS; } } status_t AudioParameter::addInt(const String8& key, const int value) { char str[12]; if (snprintf(str, 12, "%d", value) > 0) { String8 str8 = String8(str); return add(key, str8); } else { return BAD_VALUE; } } status_t AudioParameter::addFloat(const String8& key, const float value) { char str[23]; if (snprintf(str, 23, "%.10f", value) > 0) { String8 str8 = String8(str); return add(key, str8); } else { return BAD_VALUE; } } status_t AudioParameter::remove(const String8& key) { if (mParameters.indexOfKey(key) >= 0) { mParameters.removeItem(key); return NO_ERROR; } else { return BAD_VALUE; } } status_t AudioParameter::get(const String8& key, String8& value) { if (mParameters.indexOfKey(key) >= 0) { value = mParameters.valueFor(key); return NO_ERROR; } else { return BAD_VALUE; } } status_t AudioParameter::getInt(const String8& key, int& value) { String8 str8; status_t result = get(key, str8); value = 0; if (result == NO_ERROR) { int val; if (sscanf(str8.string(), "%d", &val) == 1) { value = val; } else { result = INVALID_OPERATION; } } return result; } status_t AudioParameter::getFloat(const String8& key, float& value) { String8 str8; status_t result = get(key, str8); value = 0; if (result == NO_ERROR) { float val; if (sscanf(str8.string(), "%f", &val) == 1) { value = val; } else { result = INVALID_OPERATION; } } return result; } status_t AudioParameter::getAt(size_t index, String8& key, String8& value) { if (mParameters.size() > index) { key = mParameters.keyAt(index); value = mParameters.valueAt(index); return NO_ERROR; } else { return BAD_VALUE; } } }; // namespace android