diff options
author | Steve Block <steveblock@google.com> | 2010-02-15 12:23:52 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-16 11:48:32 +0000 |
commit | 8a0914b749bbe7da7768e07a7db5c6d4bb09472b (patch) | |
tree | 73f9065f370435d6fde32ae129d458a8c77c8dff /WebCore/platform/gtk | |
parent | bf14be70295513b8076f3fa47a268a7e42b2c478 (diff) | |
download | external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.zip external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.gz external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.bz2 |
Merge webkit.org at r54731 : Initial merge by git
Change-Id: Ia79977b6cf3b0b00c06ef39419989b28e57e4f4a
Diffstat (limited to 'WebCore/platform/gtk')
-rw-r--r-- | WebCore/platform/gtk/ClipboardGtk.cpp | 9 | ||||
-rw-r--r-- | WebCore/platform/gtk/ClipboardGtk.h | 1 | ||||
-rw-r--r-- | WebCore/platform/gtk/GOwnPtrGtk.cpp | 4 | ||||
-rw-r--r-- | WebCore/platform/gtk/RenderThemeGtk.cpp | 4 | ||||
-rw-r--r-- | WebCore/platform/gtk/ScrollViewGtk.cpp | 35 | ||||
-rw-r--r-- | WebCore/platform/gtk/ScrollbarGtk.cpp | 28 | ||||
-rw-r--r-- | WebCore/platform/gtk/ScrollbarGtk.h | 4 | ||||
-rw-r--r-- | WebCore/platform/gtk/WheelEventGtk.cpp | 4 |
8 files changed, 78 insertions, 11 deletions
diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp index 450966e..6122d8f 100644 --- a/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/WebCore/platform/gtk/ClipboardGtk.cpp @@ -176,6 +176,15 @@ void ClipboardGtk::writeRange(Range* range, Frame* frame) gtk_clipboard_set_text(htmlClipboard, createMarkup(range, 0, AnnotateForInterchange).utf8().data(), -1); } +void ClipboardGtk::writePlainText(const String& text) +{ + GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText")); + + gtk_clipboard_clear(textClipboard); + + gtk_clipboard_set_text(textClipboard, text.utf8().data(), -1); +} + bool ClipboardGtk::hasData() { notImplemented(); diff --git a/WebCore/platform/gtk/ClipboardGtk.h b/WebCore/platform/gtk/ClipboardGtk.h index bb21d92..74e36b1 100644 --- a/WebCore/platform/gtk/ClipboardGtk.h +++ b/WebCore/platform/gtk/ClipboardGtk.h @@ -60,6 +60,7 @@ namespace WebCore { virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*); virtual void writeURL(const KURL&, const String&, Frame*); virtual void writeRange(Range*, Frame*); + virtual void writePlainText(const String&); virtual bool hasData(); diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp index 3bb1335..8538105 100644 --- a/WebCore/platform/gtk/GOwnPtrGtk.cpp +++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp @@ -20,7 +20,9 @@ #include "config.h" #include "GOwnPtrGtk.h" +#if ENABLE(VIDEO) #include <gst/gstelement.h> +#endif #include <libsoup/soup-uri.h> namespace WTF { @@ -31,10 +33,12 @@ template <> void freeOwnedGPtr<SoupURI>(SoupURI* ptr) soup_uri_free(ptr); } +#if ENABLE(VIDEO) template <> void freeOwnedGPtr<GstElement>(GstElement* ptr) { if (ptr) gst_object_unref(ptr); } +#endif } diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp index 0c157cf..727788a 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -24,6 +24,7 @@ #include "config.h" #include "RenderThemeGtk.h" +#include "AffineTransform.h" #include "CString.h" #include "GOwnPtr.h" #include "GraphicsContext.h" @@ -32,7 +33,6 @@ #include "NotImplemented.h" #include "RenderBox.h" #include "RenderObject.h" -#include "TransformationMatrix.h" #include "UserAgentStyleSheets.h" #include "gtkdrawing.h" @@ -307,7 +307,7 @@ static bool paintMozillaGtkWidget(const RenderThemeGtk* theme, GtkThemeWidgetTyp break; } - TransformationMatrix ctm = i.context->getCTM(); + AffineTransform ctm = i.context->getCTM(); IntPoint pos = ctm.mapPoint(rect.location()); GdkRectangle gdkRect = IntRect(pos.x(), pos.y(), rect.width(), rect.height()); diff --git a/WebCore/platform/gtk/ScrollViewGtk.cpp b/WebCore/platform/gtk/ScrollViewGtk.cpp index a7e7e15..e868250 100644 --- a/WebCore/platform/gtk/ScrollViewGtk.cpp +++ b/WebCore/platform/gtk/ScrollViewGtk.cpp @@ -2,7 +2,7 @@ * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com * Copyright (C) 2007, 2009 Holger Hans Peter Freyther - * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2008, 2010 Collabora Ltd. * * All rights reserved. * @@ -76,7 +76,7 @@ PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati * The following is assumed: * (hadj && vadj) || (!hadj && !vadj) */ -void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj) +void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues) { ASSERT(!hadj == !vadj); @@ -85,17 +85,40 @@ void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj) // Reset the adjustments to a sane default if (m_horizontalAdjustment) { + ScrollbarGtk* hScrollbar = reinterpret_cast<ScrollbarGtk*>(horizontalScrollbar()); + if (hScrollbar) + hScrollbar->attachAdjustment(m_horizontalAdjustment); + + ScrollbarGtk* vScrollbar = reinterpret_cast<ScrollbarGtk*>(verticalScrollbar()); + if (vScrollbar) + vScrollbar->attachAdjustment(m_verticalAdjustment); + + // We used to reset everything to 0 here, but when page cache + // is enabled we reuse FrameViews that are cached. Since their + // size is not going to change when being restored, (which is + // what would cause the upper limit in the adjusments to be + // set in the normal case), we make sure they are up-to-date + // here. This is needed for the parent scrolling widget to be + // able to report correct values. m_horizontalAdjustment->lower = 0; - m_horizontalAdjustment->upper = 0; - m_horizontalAdjustment->value = 0; + m_horizontalAdjustment->upper = resetValues ? 0 : frameRect().width(); + m_horizontalAdjustment->value = resetValues ? 0 : scrollOffset().width(); gtk_adjustment_changed(m_horizontalAdjustment); gtk_adjustment_value_changed(m_horizontalAdjustment); m_verticalAdjustment->lower = 0; - m_verticalAdjustment->upper = 0; - m_verticalAdjustment->value = 0; + m_verticalAdjustment->upper = resetValues ? 0 : frameRect().height(); + m_verticalAdjustment->value = resetValues ? 0 : scrollOffset().height(); gtk_adjustment_changed(m_verticalAdjustment); gtk_adjustment_value_changed(m_verticalAdjustment); + } else { + ScrollbarGtk* hScrollbar = reinterpret_cast<ScrollbarGtk*>(horizontalScrollbar()); + if (hScrollbar) + hScrollbar->detachAdjustment(); + + ScrollbarGtk* vScrollbar = reinterpret_cast<ScrollbarGtk*>(verticalScrollbar()); + if (vScrollbar) + vScrollbar->detachAdjustment(); } /* reconsider having a scrollbar */ diff --git a/WebCore/platform/gtk/ScrollbarGtk.cpp b/WebCore/platform/gtk/ScrollbarGtk.cpp index 00c6ea0..0c3037a 100644 --- a/WebCore/platform/gtk/ScrollbarGtk.cpp +++ b/WebCore/platform/gtk/ScrollbarGtk.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007, 2009 Holger Hans Peter Freyther zecke@selfish.org + * Copyright (C) 2010 Gustavo Noronha Silva <gns@gnome.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -87,6 +88,32 @@ ScrollbarGtk::ScrollbarGtk(ScrollbarClient* client, ScrollbarOrientation orienta ScrollbarGtk::~ScrollbarGtk() { + if (m_adjustment) + detachAdjustment(); +} + +void ScrollbarGtk::attachAdjustment(GtkAdjustment* adjustment) +{ + if (platformWidget()) + return; + + if (m_adjustment) + detachAdjustment(); + + m_adjustment = adjustment; + + g_object_ref(m_adjustment); + g_signal_connect(m_adjustment, "value-changed", G_CALLBACK(ScrollbarGtk::gtkValueChanged), this); + + updateThumbProportion(); + updateThumbPosition(); +} + +void ScrollbarGtk::detachAdjustment() +{ + if (!m_adjustment) + return; + g_signal_handlers_disconnect_by_func(G_OBJECT(m_adjustment), (gpointer)ScrollbarGtk::gtkValueChanged, this); // For the case where we only operate on the GtkAdjustment it is best to @@ -98,6 +125,7 @@ ScrollbarGtk::~ScrollbarGtk() gtk_adjustment_changed(m_adjustment); gtk_adjustment_value_changed(m_adjustment); g_object_unref(m_adjustment); + m_adjustment = 0; } IntPoint ScrollbarGtk::getLocationInParentWindow(const IntRect& rect) diff --git a/WebCore/platform/gtk/ScrollbarGtk.h b/WebCore/platform/gtk/ScrollbarGtk.h index b4b5989..e02bb50 100644 --- a/WebCore/platform/gtk/ScrollbarGtk.h +++ b/WebCore/platform/gtk/ScrollbarGtk.h @@ -59,7 +59,9 @@ protected: virtual void updateThumbPosition(); virtual void updateThumbProportion(); - + + void detachAdjustment(); + void attachAdjustment(GtkAdjustment*); private: static void gtkValueChanged(GtkAdjustment*, ScrollbarGtk*); IntPoint getLocationInParentWindow(const IntRect&); diff --git a/WebCore/platform/gtk/WheelEventGtk.cpp b/WebCore/platform/gtk/WheelEventGtk.cpp index 404bf29..fc6206f 100644 --- a/WebCore/platform/gtk/WheelEventGtk.cpp +++ b/WebCore/platform/gtk/WheelEventGtk.cpp @@ -69,8 +69,8 @@ PlatformWheelEvent::PlatformWheelEvent(GdkEventScroll* event) m_metaKey = event->state & GDK_META_MASK; // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event - m_deltaX *= static_cast<float>(cScrollbarPixelsPerLineStep); - m_deltaY *= static_cast<float>(cScrollbarPixelsPerLineStep); + m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep()); + m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); } } |