diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/platform/gtk | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/platform/gtk')
-rw-r--r-- | Source/WebCore/platform/gtk/ClipboardGtk.cpp | 3 | ||||
-rw-r--r-- | Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp | 1 | ||||
-rw-r--r-- | Source/WebCore/platform/gtk/FileChooserGtk.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/platform/gtk/KeyEventGtk.cpp | 20 | ||||
-rw-r--r-- | Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp | 10 | ||||
-rw-r--r-- | Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp | 16 | ||||
-rw-r--r-- | Source/WebCore/platform/gtk/ScrollViewGtk.cpp | 12 | ||||
-rw-r--r-- | Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp | 2 | ||||
-rw-r--r-- | Source/WebCore/platform/gtk/WidgetGtk.cpp | 15 |
9 files changed, 47 insertions, 36 deletions
diff --git a/Source/WebCore/platform/gtk/ClipboardGtk.cpp b/Source/WebCore/platform/gtk/ClipboardGtk.cpp index eb7248b..24580ea 100644 --- a/Source/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/Source/WebCore/platform/gtk/ClipboardGtk.cpp @@ -83,7 +83,7 @@ static ClipboardDataType dataObjectTypeFromHTMLClipboardType(const String& rawTy String type(rawType.stripWhiteSpace()); // Two special cases for IE compatibility - if (type == "Text") + if (type == "Text" || type == "text") return ClipboardDataTypeText; if (type == "URL") return ClipboardDataTypeURL; @@ -201,6 +201,7 @@ HashSet<String> ClipboardGtk::types() const if (m_dataObject->hasText()) { types.add("text/plain"); types.add("Text"); + types.add("text"); } if (m_dataObject->hasMarkup()) diff --git a/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp b/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp index fee7a14..bdd3962 100644 --- a/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp +++ b/Source/WebCore/platform/gtk/ContextMenuItemGtk.cpp @@ -107,6 +107,7 @@ static const char* gtkStockIDFromContextMenuAction(const ContextMenuAction& acti return GTK_STOCK_SELECT_COLOR; case ContextMenuItemTagToggleMediaControls: case ContextMenuItemTagToggleMediaLoop: + case ContextMenuItemTagCopyImageUrlToClipboard: // No icon for this. return 0; case ContextMenuItemTagEnterVideoFullscreen: diff --git a/Source/WebCore/platform/gtk/FileChooserGtk.cpp b/Source/WebCore/platform/gtk/FileChooserGtk.cpp index 54763d4..b4bdf3f 100644 --- a/Source/WebCore/platform/gtk/FileChooserGtk.cpp +++ b/Source/WebCore/platform/gtk/FileChooserGtk.cpp @@ -60,8 +60,8 @@ String FileChooser::basenameForWidth(const Font& font, int width) const gchar* systemBasename = g_path_get_basename(systemFilename.data()); stringByAdoptingFileSystemRepresentation(systemBasename, string); } else if (m_filenames.size() > 1) - return StringTruncator::rightTruncate(multipleFileUploadText(m_filenames.size()), width, font, false); + return StringTruncator::rightTruncate(multipleFileUploadText(m_filenames.size()), width, font); - return StringTruncator::centerTruncate(string, width, font, false); + return StringTruncator::centerTruncate(string, width, font); } } diff --git a/Source/WebCore/platform/gtk/KeyEventGtk.cpp b/Source/WebCore/platform/gtk/KeyEventGtk.cpp index 5a034d6..d010b37 100644 --- a/Source/WebCore/platform/gtk/KeyEventGtk.cpp +++ b/Source/WebCore/platform/gtk/KeyEventGtk.cpp @@ -43,7 +43,7 @@ namespace WebCore { // FIXME: This is incomplete. We should change this to mirror // more like what Firefox does, and generate these switch statements // at build time. -static String keyIdentifierForGdkKeyCode(guint keyCode) +String PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(unsigned keyCode) { switch (keyCode) { case GDK_Menu: @@ -149,7 +149,7 @@ static String keyIdentifierForGdkKeyCode(guint keyCode) } } -static int windowsKeyCodeForKeyEvent(unsigned int keycode) +int PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(unsigned keycode) { switch (keycode) { case GDK_KP_0: @@ -516,7 +516,7 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode) } -static String singleCharacterString(guint val) +String PlatformKeyboardEvent::singleCharacterString(unsigned val) { switch (val) { case GDK_ISO_Enter: @@ -552,7 +552,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event) , m_unmodifiedText(singleCharacterString(event->keyval)) , m_keyIdentifier(keyIdentifierForGdkKeyCode(event->keyval)) , m_autoRepeat(false) - , m_windowsVirtualKeyCode(windowsKeyCodeForKeyEvent(event->keyval)) + , m_windowsVirtualKeyCode(windowsKeyCodeForGdkKeyCode(event->keyval)) , m_nativeVirtualKeyCode(event->keyval) , m_isKeypad(event->keyval >= GDK_KP_Space && event->keyval <= GDK_KP_9) , m_shiftKey((event->state & GDK_SHIFT_MASK) || (event->keyval == GDK_3270_BackTab)) @@ -588,11 +588,13 @@ bool PlatformKeyboardEvent::currentCapsLockState() void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey) { - notImplemented(); - shiftKey = false; - ctrlKey = false; - altKey = false; - metaKey = false; + GdkModifierType state; + gtk_get_current_event_state(&state); + + shiftKey = state & GDK_SHIFT_MASK; + ctrlKey = state & GDK_CONTROL_MASK; + altKey = state & GDK_MOD1_MASK; + metaKey = state & GDK_META_MASK; } GdkEventKey* PlatformKeyboardEvent::gdkEventKey() const diff --git a/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp b/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp index 65e8852..eab0ac6 100644 --- a/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp +++ b/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp @@ -66,6 +66,11 @@ String resetButtonDefaultLabel() return String::fromUTF8(_("Reset")); } +String defaultDetailsSummaryText() +{ + return String::fromUTF8(_("Details")); +} + String searchableIndexIntroduction() { return String::fromUTF8(_("This is a searchable index. Enter search keywords: ")); @@ -111,6 +116,11 @@ String contextMenuItemTagCopyImageToClipboard() return String::fromUTF8(_("Cop_y Image")); } +String contextMenuItemTagCopyImageUrlToClipboard() +{ + return String::fromUTF8(_("Copy Image _Address")); +} + String contextMenuItemTagOpenVideoInNewWindow() { return String::fromUTF8(_("Open _Video in New Window")); diff --git a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp index d1571a5..d8cdb79 100644 --- a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp +++ b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp @@ -60,6 +60,8 @@ MainFrameScrollbarGtk::~MainFrameScrollbarGtk() void MainFrameScrollbarGtk::attachAdjustment(GtkAdjustment* adjustment) { + if (m_adjustment.get() == adjustment) + return; if (m_adjustment) detachAdjustment(); @@ -67,9 +69,9 @@ void MainFrameScrollbarGtk::attachAdjustment(GtkAdjustment* adjustment) if (!m_adjustment) return; - g_signal_connect(m_adjustment.get(), "value-changed", G_CALLBACK(MainFrameScrollbarGtk::gtkValueChanged), this); updateThumbProportion(); updateThumbPosition(); + g_signal_connect(m_adjustment.get(), "value-changed", G_CALLBACK(MainFrameScrollbarGtk::gtkValueChanged), this); } void MainFrameScrollbarGtk::detachAdjustment() @@ -109,7 +111,17 @@ void MainFrameScrollbarGtk::updateThumbProportion() void MainFrameScrollbarGtk::gtkValueChanged(GtkAdjustment*, MainFrameScrollbarGtk* that) { - that->scrollableArea()->scrollToOffsetWithoutAnimation(that->orientation(), static_cast<int>(gtk_adjustment_get_value(that->m_adjustment.get()))); + // If we've been removed from our parent, we no longer get to control the WebCore + // scrollbar. If this is the case, deactivate this signal handler. WebCore will + // create a fresh MainFrameScrollbar when the scrollbar reappears. + if (!that->parent()) { + that->detachAdjustment(); + return; + } + + int newValue = static_cast<int>(gtk_adjustment_get_value(that->m_adjustment.get())); + if (newValue != that->value()) + that->scrollableArea()->scrollToOffsetWithoutAnimation(that->orientation(), newValue); } void MainFrameScrollbarGtk::paint(GraphicsContext* context, const IntRect& rect) diff --git a/Source/WebCore/platform/gtk/ScrollViewGtk.cpp b/Source/WebCore/platform/gtk/ScrollViewGtk.cpp index a8c7562..c5f32f3 100644 --- a/Source/WebCore/platform/gtk/ScrollViewGtk.cpp +++ b/Source/WebCore/platform/gtk/ScrollViewGtk.cpp @@ -162,14 +162,6 @@ void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, boo setVerticalAdjustment(vadj, resetValues); } -void ScrollView::platformAddChild(Widget* child) -{ -} - -void ScrollView::platformRemoveChild(Widget* child) -{ -} - IntRect ScrollView::visibleContentRect(bool includeScrollbars) const { // If we are an interior frame scrollbar or are in some sort of transition @@ -177,8 +169,8 @@ IntRect ScrollView::visibleContentRect(bool includeScrollbars) const // scrollbar width should be. if (parent() || !hostWindow() || !hostWindow()->platformPageClient()) { return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()), - IntSize(max(0, width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)), - max(0, height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0)))); + IntSize(max(0, m_boundsSize.width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)), + max(0, m_boundsSize.height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0)))); } // We don't have a parent, so we are the main frame and thus have diff --git a/Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp b/Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp index 5c27080..eee07ce 100644 --- a/Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp +++ b/Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp @@ -48,5 +48,7 @@ void getSupportedKeySizes(Vector<String>&) { notImplemented(); } String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) { return String(); } float userIdleTime() { notImplemented(); return FLT_MAX; } // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed void setCookieStoragePrivateBrowsingEnabled(bool) { notImplemented(); } +void startObservingCookieChanges() { notImplemented(); } +void stopObservingCookieChanges() { notImplemented(); } } diff --git a/Source/WebCore/platform/gtk/WidgetGtk.cpp b/Source/WebCore/platform/gtk/WidgetGtk.cpp index ee1005c..f251772 100644 --- a/Source/WebCore/platform/gtk/WidgetGtk.cpp +++ b/Source/WebCore/platform/gtk/WidgetGtk.cpp @@ -67,19 +67,10 @@ static GdkWindow* gdkWindow(PlatformWidget widget) void Widget::setCursor(const Cursor& cursor) { - GdkCursor* platformCursor = cursor.platformCursor().get(); - - // http://bugs.webkit.org/show_bug.cgi?id=16388 - // [GTK] Widget::setCursor() gets called frequently - // - // gdk_window_set_cursor() in certain GDK backends seems to be an - // expensive operation, so avoid it if possible. - - if (platformCursor == lastSetCursor) + ScrollView* view = root(); + if (!view) return; - - gdk_window_set_cursor(gdkWindow(platformWidget()) ? gdkWindow(platformWidget()) : gtk_widget_get_window(GTK_WIDGET(root()->hostWindow()->platformPageClient())), platformCursor); - lastSetCursor = platformCursor; + view->hostWindow()->setCursor(cursor); } void Widget::show() |