diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 17:48:33 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 17:48:33 +0000 |
commit | 0d4763b5d57ab007fbe444b55fae83c72fa7529a (patch) | |
tree | 13e1106070c1125084422f02967374839fb9b175 | |
parent | 70bf1a6bbd3086acb2384dd38b08172f750c135e (diff) | |
download | chromium_src-0d4763b5d57ab007fbe444b55fae83c72fa7529a.zip chromium_src-0d4763b5d57ab007fbe444b55fae83c72fa7529a.tar.gz chromium_src-0d4763b5d57ab007fbe444b55fae83c72fa7529a.tar.bz2 |
Delete unnecessary lines of code.
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/19463004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212085 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | android_webview/native/DEPS | 3 | ||||
-rw-r--r-- | android_webview/native/aw_settings.cc | 5 | ||||
-rw-r--r-- | webkit/browser/database/database_util.cc | 1 | ||||
-rw-r--r-- | webkit/browser/dom_storage/dom_storage_area.cc | 1 | ||||
-rw-r--r-- | webkit/common/webpreferences.cc | 1 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.cc | 83 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 32 | ||||
-rw-r--r-- | webkit/glue/webkit_glue_unittest.cc | 45 |
8 files changed, 10 insertions, 161 deletions
diff --git a/android_webview/native/DEPS b/android_webview/native/DEPS index b45be10..bb16f7d 100644 --- a/android_webview/native/DEPS +++ b/android_webview/native/DEPS @@ -9,4 +9,7 @@ include_rules = [ "+components/navigation_interception", "+components/user_prefs", "+components/web_contents_delegate_android", + + # These should be burned down. http://crbug.com/237267 + "!third_party/WebKit/public/web/WebView.h", ] diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc index 667f426..9295c00 100644 --- a/android_webview/native/aw_settings.cc +++ b/android_webview/native/aw_settings.cc @@ -14,6 +14,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/content_client.h" #include "jni/AwSettings_jni.h" +#include "third_party/WebKit/public/web/WebView.h" #include "webkit/common/user_agent/user_agent.h" #include "webkit/common/webpreferences.h" #include "webkit/glue/webkit_glue.h" @@ -114,8 +115,8 @@ void AwSettings::UpdateWebkitPreferencesLocked(JNIEnv* env, jobject obj) { render_view_host_ext->SetTextZoomLevel(0); } else { prefs.force_enable_zoom = false; - render_view_host_ext->SetTextZoomLevel(webkit_glue::ZoomFactorToZoomLevel( - text_size_percent / 100.0f)); + render_view_host_ext->SetTextZoomLevel( + WebKit::WebView::zoomFactorToZoomLevel(text_size_percent / 100.0f)); } prefs.standard_font_family_map[webkit_glue::kCommonScript] = diff --git a/webkit/browser/database/database_util.cc b/webkit/browser/database/database_util.cc index 5b6fd28..f037638 100644 --- a/webkit/browser/database/database_util.cc +++ b/webkit/browser/database/database_util.cc @@ -6,7 +6,6 @@ #include "base/basictypes.h" #include "base/strings/utf_string_conversions.h" -#include "third_party/WebKit/public/platform/WebString.h" #include "webkit/browser/database/database_tracker.h" #include "webkit/browser/database/vfs_backend.h" diff --git a/webkit/browser/dom_storage/dom_storage_area.cc b/webkit/browser/dom_storage/dom_storage_area.cc index 5f64c41..d0e2ac3 100644 --- a/webkit/browser/dom_storage/dom_storage_area.cc +++ b/webkit/browser/dom_storage/dom_storage_area.cc @@ -10,7 +10,6 @@ #include "base/metrics/histogram.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" -#include "third_party/WebKit/public/platform/WebString.h" #include "webkit/browser/database/database_util.h" #include "webkit/browser/dom_storage/dom_storage_namespace.h" #include "webkit/browser/dom_storage/dom_storage_task_runner.h" diff --git a/webkit/common/webpreferences.cc b/webkit/common/webpreferences.cc index ad99369..c226ab6 100644 --- a/webkit/common/webpreferences.cc +++ b/webkit/common/webpreferences.cc @@ -7,7 +7,6 @@ #include "base/basictypes.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebSettings.h" #include "third_party/icu/public/common/unicode/uchar.h" diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index e7d65a4..2ef0e57 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -1,82 +1,31 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "webkit/glue/webkit_glue.h" -#if defined(OS_WIN) -#include <mlang.h> -#include <objidl.h> -#elif defined(OS_POSIX) && !defined(OS_MACOSX) -#include <sys/utsname.h> -#endif - #if defined(OS_LINUX) #include <malloc.h> #endif -#include <limits> - #include "base/logging.h" #include "base/memory/scoped_ptr.h" -#include "base/path_service.h" #include "base/process_util.h" -#include "base/strings/string_piece.h" #include "base/strings/string_tokenizer.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "base/sys_info.h" #include "net/base/escape.h" #include "skia/ext/platform_canvas.h" -#if defined(OS_MACOSX) -#include "skia/ext/skia_utils_mac.h" -#endif -#include "third_party/WebKit/public/platform/WebData.h" #include "third_party/WebKit/public/platform/WebFileInfo.h" -#include "third_party/WebKit/public/platform/WebImage.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/platform/WebVector.h" -#include "third_party/WebKit/public/web/WebDevToolsAgent.h" -#include "third_party/WebKit/public/web/WebDocument.h" -#include "third_party/WebKit/public/web/WebElement.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebGlyphCache.h" -#include "third_party/WebKit/public/web/WebHistoryItem.h" #include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebPrintParams.h" -#include "third_party/WebKit/public/web/WebView.h" -#if defined(OS_WIN) -#include "third_party/WebKit/public/web/win/WebInputEventFactory.h" -#endif #include "third_party/skia/include/core/SkBitmap.h" #include "v8/include/v8.h" using WebKit::WebCanvas; -using WebKit::WebData; -using WebKit::WebDevToolsAgent; -using WebKit::WebElement; using WebKit::WebFrame; using WebKit::WebGlyphCache; -using WebKit::WebHistoryItem; -using WebKit::WebImage; -using WebKit::WebPrintParams; -using WebKit::WebRect; -using WebKit::WebSize; -using WebKit::WebString; -using WebKit::WebVector; -using WebKit::WebView; - -static const char kLayoutTestsPattern[] = "/LayoutTests/"; -static const std::string::size_type kLayoutTestsPatternSize = - arraysize(kLayoutTestsPattern) - 1; -static const char kFileUrlPattern[] = "file:/"; -static const char kDataUrlPattern[] = "data:"; -static const std::string::size_type kDataUrlPatternSize = - arraysize(kDataUrlPattern) - 1; -static const char kFileTestPrefix[] = "(file test):"; //------------------------------------------------------------------------------ // webkit_glue impl: @@ -96,22 +45,6 @@ void EnableWebCoreLogChannels(const std::string& channels) { } } -int NumberOfPages(WebFrame* web_frame, - float page_width_in_pixels, - float page_height_in_pixels) { - WebSize size(static_cast<int>(page_width_in_pixels), - static_cast<int>(page_height_in_pixels)); - - WebPrintParams print_params; - print_params.paperSize = size; - print_params.printContentArea = WebRect(0, 0, size.width, size.height); - print_params.printableArea = WebRect(0, 0, size.width, size.height); - - int number_of_pages = web_frame->printBegin(print_params); - web_frame->printEnd(); - return number_of_pages; -} - #ifndef NDEBUG // The log macro was having problems due to collisions with WTF, so we just // code here what that would have inlined. @@ -130,16 +63,6 @@ void CheckForLeaks() { #endif } -bool DecodeImage(const std::string& image_data, SkBitmap* image) { - WebData web_data(image_data.data(), image_data.length()); - WebImage web_image(WebImage::fromData(web_data, WebSize())); - if (web_image.isNull()) - return false; - - *image = web_image.getSkBitmap(); - return true; -} - void PlatformFileInfoToWebFileInfo( const base::PlatformFileInfo& file_info, WebKit::WebFileInfo* web_file_info) { @@ -201,8 +124,4 @@ size_t MemoryUsageKB() { } #endif -double ZoomFactorToZoomLevel(double factor) { - return WebView::zoomFactorToZoomLevel(factor); -} - } // namespace webkit_glue diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 505332c..2a9d74d 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -1,30 +1,22 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBKIT_GLUE_WEBKIT_GLUE_H_ #define WEBKIT_GLUE_WEBKIT_GLUE_H_ -#include "base/basictypes.h" - -#if defined(OS_WIN) -#include <windows.h> -#endif - #include <string> -#include <vector> +#include "base/basictypes.h" #include "base/platform_file.h" #include "base/strings/string16.h" #include "third_party/WebKit/public/platform/WebCanvas.h" #include "webkit/glue/webkit_glue_export.h" -class SkBitmap; class SkCanvas; namespace WebKit { struct WebFileInfo; -class WebFrame; } namespace webkit_glue { @@ -34,17 +26,6 @@ WEBKIT_GLUE_EXPORT void SetJavaScriptFlags(const std::string& flags); // Turn on logging for flags in the provided comma delimited list. WEBKIT_GLUE_EXPORT void EnableWebCoreLogChannels(const std::string& channels); -// Returns the number of page where the specified element will be put. -int PageNumberForElementById(WebKit::WebFrame* web_frame, - const std::string& id, - float page_width_in_pixels, - float page_height_in_pixels); - -// Returns the number of pages to be printed. -int NumberOfPages(WebKit::WebFrame* web_frame, - float page_width_in_pixels, - float page_height_in_pixels); - #ifndef NDEBUG // Checks various important objects to see if there are any in memory, and // calls AppendToLog with any leaked objects. Designed to be called on @@ -52,11 +33,6 @@ int NumberOfPages(WebKit::WebFrame* web_frame, WEBKIT_GLUE_EXPORT void CheckForLeaks(); #endif -// Decodes the image from the data in |image_data| into |image|. -// Returns false if the image could not be decoded. -WEBKIT_GLUE_EXPORT bool DecodeImage(const std::string& image_data, - SkBitmap* image); - // File info conversion WEBKIT_GLUE_EXPORT void PlatformFileInfoToWebFileInfo( const base::PlatformFileInfo& file_info, @@ -76,10 +52,6 @@ WEBKIT_GLUE_EXPORT int GetGlyphPageCount(); // computed inside the sandbox and thus its not always accurate. WEBKIT_GLUE_EXPORT size_t MemoryUsageKB(); -// Converts from zoom factor (zoom percent / 100) to zoom level, where 0 means -// no zoom, positive numbers mean zoom in, negatives mean zoom out. -WEBKIT_GLUE_EXPORT double ZoomFactorToZoomLevel(double factor); - } // namespace webkit_glue #endif // WEBKIT_GLUE_WEBKIT_GLUE_H_ diff --git a/webkit/glue/webkit_glue_unittest.cc b/webkit/glue/webkit_glue_unittest.cc index 0d7925a..f3c91b6 100644 --- a/webkit/glue/webkit_glue_unittest.cc +++ b/webkit/glue/webkit_glue_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,53 +9,10 @@ #include "base/message_loop.h" #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/skia/include/core/SkColorPriv.h" #include "webkit/glue/webkitplatformsupport_impl.h" namespace { -TEST(WebkitGlueTest, DecodeImageFail) { - std::string data("not an image"); - SkBitmap image; - EXPECT_FALSE(webkit_glue::DecodeImage(data, &image)); - EXPECT_TRUE(image.isNull()); -} - -TEST(WebkitGlueTest, DecodeImage) { - std::string data("GIF87a\x02\x00\x02\x00\xa1\x04\x00\x00\x00\x00\x00\x00\xff" - "\xff\x00\x00\x00\xff\x00,\x00\x00\x00\x00\x02\x00\x02\x00" - "\x00\x02\x03\x84\x16\x05\x00;", 42); - EXPECT_EQ(42u, data.size()); - SkBitmap image; - EXPECT_TRUE(webkit_glue::DecodeImage(data, &image)); - EXPECT_FALSE(image.isNull()); - EXPECT_EQ(2, image.width()); - EXPECT_EQ(2, image.height()); - EXPECT_EQ(SkBitmap::kARGB_8888_Config, image.config()); - image.lockPixels(); - uint32_t pixel = *image.getAddr32(0, 0); // Black - EXPECT_EQ(0x00U, SkGetPackedR32(pixel)); - EXPECT_EQ(0x00U, SkGetPackedG32(pixel)); - EXPECT_EQ(0x00U, SkGetPackedB32(pixel)); - - pixel = *image.getAddr32(1, 0); // Red - EXPECT_EQ(0xffU, SkGetPackedR32(pixel)); - EXPECT_EQ(0x00U, SkGetPackedG32(pixel)); - EXPECT_EQ(0x00U, SkGetPackedB32(pixel)); - - pixel = *image.getAddr32(0, 1); // Green - EXPECT_EQ(0x00U, SkGetPackedR32(pixel)); - EXPECT_EQ(0xffU, SkGetPackedG32(pixel)); - EXPECT_EQ(0x00U, SkGetPackedB32(pixel)); - - pixel = *image.getAddr32(1, 1); // Blue - EXPECT_EQ(0x00U, SkGetPackedR32(pixel)); - EXPECT_EQ(0x00U, SkGetPackedG32(pixel)); - EXPECT_EQ(0xffU, SkGetPackedB32(pixel)); - image.unlockPixels(); -} - // Derives WebKitPlatformSupportImpl for testing shared timers. class TestWebKitPlatformSupport : public webkit_glue::WebKitPlatformSupportImpl { |