Skip to content
Permalink
Browse files
[GTK][EFL] Move non-glib/gtk platform implementations out of platform…
…/gtk

https://bugs.webkit.org/show_bug.cgi?id=156847

Reviewed by Carlos Garcia Campos.

The Language and Logging implementation don't really need glib, so
rework them and move them to a new platform/unix directory so that
they can be shared among Unix ports.

* PlatformEfl.cmake: Use the unix version.
* PlatformGTK.cmake: Same.
* platform/efl/LanguageEfl.cpp: Removed.
* platform/efl/LoggingEfl.cpp: Removed.
* platform/unix/LanguageUnix.cpp: Renamed from Source/WebCore/platform/gtk/LanguageGtk.cpp.
(WebCore::platformLanguage):
(WebCore::platformUserPreferredLanguages):
* platform/unix/LoggingUnix.cpp: Renamed from Source/WebCore/platform/gtk/LoggingGtk.cpp.
(WebCore::logLevelString):


Canonical link: https://commits.webkit.org/174950@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
csaavedra committed Apr 21, 2016
1 parent e1f4d36 commit 52395255e03c193ca06571cff35f1acdf851bbb1
@@ -1,3 +1,24 @@
2016-04-21 Claudio Saavedra <csaavedra@igalia.com>

[GTK][EFL] Move non-glib/gtk platform implementations out of platform/gtk
https://bugs.webkit.org/show_bug.cgi?id=156847

Reviewed by Carlos Garcia Campos.

The Language and Logging implementation don't really need glib, so
rework them and move them to a new platform/unix directory so that
they can be shared among Unix ports.

* PlatformEfl.cmake: Use the unix version.
* PlatformGTK.cmake: Same.
* platform/efl/LanguageEfl.cpp: Removed.
* platform/efl/LoggingEfl.cpp: Removed.
* platform/unix/LanguageUnix.cpp: Renamed from Source/WebCore/platform/gtk/LanguageGtk.cpp.
(WebCore::platformLanguage):
(WebCore::platformUserPreferredLanguages):
* platform/unix/LoggingUnix.cpp: Renamed from Source/WebCore/platform/gtk/LoggingGtk.cpp.
(WebCore::logLevelString):

2016-04-21 Nan Wang <n_wang@apple.com>

AX: stringForTextMarkerRange returning empty string for document range
@@ -99,9 +99,7 @@ list(APPEND WebCore_SOURCES
platform/efl/EventLoopEfl.cpp
platform/efl/FileSystemEfl.cpp
platform/efl/GamepadsEfl.cpp
platform/efl/LanguageEfl.cpp
platform/efl/LocalizedStringsEfl.cpp
platform/efl/LoggingEfl.cpp
platform/efl/MIMETypeRegistryEfl.cpp
platform/efl/MainThreadSharedTimerEfl.cpp
platform/efl/PasteboardEfl.cpp
@@ -220,6 +218,9 @@ list(APPEND WebCore_SOURCES

platform/text/hyphen/HyphenationLibHyphen.cpp

platform/unix/LanguageUnix.cpp
platform/unix/LoggingUnix.cpp

rendering/RenderThemeEfl.cpp
)

@@ -141,8 +141,6 @@ list(APPEND WebCore_SOURCES
platform/graphics/x11/XUniqueResource.cpp

platform/gtk/ErrorsGtk.cpp
platform/gtk/LanguageGtk.cpp
platform/gtk/LoggingGtk.cpp
platform/gtk/MIMETypeRegistryGtk.cpp
platform/gtk/ScrollAnimatorGtk.cpp
platform/gtk/TemporaryLinkStubs.cpp
@@ -184,6 +182,9 @@ list(APPEND WebCore_SOURCES
platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp

platform/text/hyphen/HyphenationLibHyphen.cpp

platform/unix/LanguageUnix.cpp
platform/unix/LoggingUnix.cpp
)

list(APPEND WebCorePlatformGTK_SOURCES

This file was deleted.

This file was deleted.

@@ -20,45 +20,30 @@
#include "config.h"
#include "Language.h"

#include <locale.h>
#include <wtf/Vector.h>
#include <wtf/glib/GUniquePtr.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>

#include <glib.h>
#include <locale.h>

namespace WebCore {

// Using pango_language_get_default() here is not an option, because
// it doesn't support changing the locale in runtime, so it returns
// always the same value.
static String platformLanguage()
{
char* localeDefault = setlocale(LC_CTYPE, NULL);

if (!localeDefault)
String localeDefault(setlocale(LC_CTYPE, nullptr));
if (localeDefault.isEmpty())
return String("c");

GUniquePtr<gchar> normalizedDefault(g_ascii_strdown(localeDefault, -1));
char* ptr = strchr(normalizedDefault.get(), '_');

if (ptr)
*ptr = '-';

ptr = strchr(normalizedDefault.get(), '.');

if (ptr)
*ptr = '\0';

return String(normalizedDefault.get());
String normalizedDefault = localeDefault.convertToASCIILowercase();
normalizedDefault.replace('_', '-');
normalizedDefault.truncate(normalizedDefault.find('.'));
return normalizedDefault;
}

Vector<String> platformUserPreferredLanguages()
{
Vector<String> userPreferredLanguages;
userPreferredLanguages.append(platformLanguage());
return userPreferredLanguages;
return { platformLanguage() };
}

}
@@ -24,7 +24,6 @@

#if !LOG_DISABLED

#include <glib.h>
#include <string.h>
#include <wtf/text/WTFString.h>

@@ -38,13 +37,11 @@ String logLevelString()

// We set up the logs anyway because some of our logging, such as Soup's is available in release builds.
#if defined(NDEBUG)
g_warning("WEBKIT_DEBUG is not empty, but this is a release build. Notice that many log messages will only appear in a debug build.");
WTFLogAlways("WEBKIT_DEBUG is not empty, but this is a release build. Notice that many log messages will only appear in a debug build.");
#endif

// To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1.
String logLevel = "NotYetImplemented,";
logLevel.append(logEnv);
return logLevel;
return String("NotYetImplemented,") + logEnv;
}

} // namespace WebCore

0 comments on commit 5239525

Please sign in to comment.