ChangeLog

 12011-05-07 Julien Chaffraix <jchaffraix@codeaurora.org>, Zaheer Ahmad <zahmad@codeaurora.org>, and Joone Hur <joone.hur@collabora.co.uk>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Gtk] Port tiled backing store
 6 https://bugs.webkit.org/show_bug.cgi?id=45423
 7
 8 Add the tiled backing store feature configuration
 9
 10 * configure.ac: Check whether Cairo version is higher than 1.10.
 11
1122011-05-05 Kevin Ollivier <kevino@theolliviers.com>
213
314 [wx] Unreviewed build fix. Add LocalizedDateNone.cpp to the build.

Source/JavaScriptCore/ChangeLog

 12011-05-07 Joone Hur <joone.hur@collabora.co.uk>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Gtk] Port tiled backing store
 6 https://bugs.webkit.org/show_bug.cgi?id=45423
 7
 8 cairo_rectangle_int_t doesn't need to be defined as the name of GdkRectangle.
 9
 10 * wtf/gobject/GTypedefs.h: cairo_rectangle_int_t is only used when
 11 PLATFORM(CAIRO) is defined.
 12
1132011-05-07 Dawit Alemayehu <adawit@kde.org>
214
315 Reviewed by Daniel Bates.

Source/JavaScriptCore/wtf/gobject/GTypedefs.h

@@typedef union _GdkEvent GdkEvent;
6363
6464#if USE(CAIRO)
6565typedef struct _cairo_surface cairo_surface_t;
 66typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
6667#endif
6768
6869#if PLATFORM(GTK)

@@typedef struct _GdkRectangle GdkRectangle;
8788typedef struct _GdkDrawable GdkWindow;
8889#else
8990typedef struct _GdkWindow GdkWindow;
90 typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
91 typedef cairo_rectangle_int_t GdkRectangle;
9291typedef struct _GtkStyleContext GtkStyleContext;
9392#endif
9493

Source/WebCore/ChangeLog

 12011-05-07 Julien Chaffraix <jchaffraix@codeaurora.org>, Zaheer Ahmad <zahmad@codeaurora.org>, and Joone Hur <joone.hur@collabora.co.uk>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Gtk] Port tiled backing store
 6 https://bugs.webkit.org/show_bug.cgi?id=45423
 7
 8 Add the tiled backing store feature to the GTK+ port, which was implemented for the QT Port in 35146.
 9
 10 * GNUmakefile.am: Added the tiled backing store feature definition and included the new files to be compiled.
 11 * GNUmakefile.list.am: Added IntRectCairo.cpp
 12 * platform/ScrollView.cpp:
 13 (WebCore::ScrollView::scrollBy): Get a scroll position from m_actualVisibleContentRect.
 14 (WebCore::ScrollView::windowToContents): Refer to actualScrollOffset instead of scrollOffset.
 15 (WebCore::ScrollView::contentsToWindow): Ditto.
 16 * platform/ScrollView.h:
 17 (WebCore::ScrollView::actualScrollOffset): Returns the actualScrollOffset.
 18 * platform/graphics/IntRect.h: cairo_rectangle_int_t is defined if PLATFORM(CAIRO)
 19 * platform/graphics/Tile.h: Cairo Support.
 20 * platform/graphics/TiledBackingStore.cpp:
 21 (WebCore::TiledBackingStore::TiledBackingStore): Call the setTileSize method to apply the default
 22 tile size.
 23 * platform/graphics/TiledBackingStore.h:
 24 (WebCore::TiledBackingStore::reset): Added to clear the tiles.
 25 * platform/graphics/cairo/IntRectCairo.cpp: Create an IntRect object with the given cairo_rectangle_int_t.
 26 (WebCore::IntRect::IntRect):
 27 (WebCore::IntRect::operator cairo_rectangle_int_t):
 28 * platform/graphics/cairo/OwnPtrCairo.cpp: OwnPtr support for cairo_region_t and cairo_rectangle_t.
 29 (WTF::cairo_region_t):
 30 (WTF::cairo_rectangle_t):
 31 * platform/graphics/cairo/OwnPtrCairo.h:
 32 * platform/graphics/cairo/TileCairo.cpp: Implemented the tile interface using Cairo.
 33 (WebCore::checkeredSurface):
 34 (WebCore::Tile::Tile):
 35 (WebCore::Tile::~Tile):
 36 (WebCore::Tile::isDirty):
 37 (WebCore::Tile::isReadyToPaint):
 38 (WebCore::Tile::invalidate):
 39 (WebCore::regionToRects):
 40 (WebCore::Tile::updateBackBuffer):
 41 (WebCore::Tile::swapBackBufferToFront):
 42 (WebCore::Tile::paint):
 43 (WebCore::Tile::paintCheckerPattern):
 44 * platform/gtk/ScrollViewGtk.cpp:
 45 (WebCore::ScrollView::visibleContentRect): Returns the actualVisibleRect instead of visibleContentRect.
 46
1472011-05-07 Sheriff Bot <webkit.review.bot@gmail.com>
248
349 Unreviewed, rolling out r86016.

Source/WebCore/GNUmakefile.am

@@webcoregtk_cppflags += \
9999 -I$(srcdir)/Source/WebCore/platform/gtk \
100100 -I$(srcdir)/Source/WebCore/platform/network/soup
101101
 102if ENABLE_TILED_BACKING_STORE
 103FEATURE_DEFINES += ENABLE_TILED_BACKING_STORE=1
 104
 105webcore_cppflags += \
 106 -DENABLE_TILED_BACKING_STORE=1
 107
 108webcore_sources += \
 109 Source/WebCore/platform/graphics/Tile.h \
 110 Source/WebCore/platform/graphics/TiledBackingStore.h \
 111 Source/WebCore/platform/graphics/TiledBackingStoreClient.h \
 112 Source/WebCore/platform/graphics/TiledBackingStore.cpp \
 113 Source/WebCore/platform/graphics/cairo/TileCairo.cpp
 114endif # END ENABLE_TILED_BACKING_STORE
 115
102116# ---
103117# Channel mesaging support
104118# ---

Source/WebCore/GNUmakefile.list.am

@@webcoregtk_sources += \
36793679 Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp \
36803680 Source/WebCore/platform/graphics/cairo/ImageBufferData.h \
36813681 Source/WebCore/platform/graphics/cairo/ImageCairo.cpp \
 3682 Source/WebCore/platform/graphics/cairo/IntRectCairo.cpp \
36823683 Source/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp \
36833684 Source/WebCore/platform/graphics/cairo/OwnPtrCairo.h \
36843685 Source/WebCore/platform/graphics/cairo/PathCairo.cpp \

Source/WebCore/platform/ScrollView.cpp

11/*
22 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
 3 * Copyright (C) 2011 Collabora Ltd.
34 *
45 * Redistribution and use in source and binary forms, with or without
56 * modification, are permitted provided that the following conditions

@@void ScrollView::setScrollOffset(const IntPoint& offset)
351352 scrollTo(newOffset);
352353}
353354
 355void ScrollView::scrollBy(const IntSize& s)
 356{
 357#if ENABLE(TILED_BACKING_STORE)
 358 if (!m_actualVisibleContentRect.isEmpty())
 359 return setScrollPosition(m_actualVisibleContentRect.location() + s);
 360#endif
 361
 362 return setScrollPosition(scrollPosition() + s);
 363}
 364
354365void ScrollView::scrollTo(const IntSize& newOffset)
355366{
356367 IntSize scrollDelta = newOffset - m_scrollOffset;

@@void ScrollView::scrollContentsSlowPath(const IntRect& updateRect)
677688IntPoint ScrollView::windowToContents(const IntPoint& windowPoint) const
678689{
679690 IntPoint viewPoint = convertFromContainingWindow(windowPoint);
 691
 692#if ENABLE(TILED_BACKING_STORE)
 693 return viewPoint + actualScrollOffset();
 694#else
680695 return viewPoint + scrollOffset();
 696#endif
681697}
682698
683699IntPoint ScrollView::contentsToWindow(const IntPoint& contentsPoint) const
684700{
 701#if ENABLE(TILED_BACKING_STORE)
 702 IntPoint viewPoint = contentsPoint - actualScrollOffset();
 703#else
685704 IntPoint viewPoint = contentsPoint - scrollOffset();
 705#endif
686706 return convertToContainingWindow(viewPoint);
687707}
688708
689709IntRect ScrollView::windowToContents(const IntRect& windowRect) const
690710{
691711 IntRect viewRect = convertFromContainingWindow(windowRect);
 712#if ENABLE(TILED_BACKING_STORE)
 713 viewRect.move(actualScrollOffset());
 714#else
692715 viewRect.move(scrollOffset());
 716#endif
693717 return viewRect;
694718}
695719
696720IntRect ScrollView::contentsToWindow(const IntRect& contentsRect) const
697721{
698722 IntRect viewRect = contentsRect;
 723#if ENABLE(TILED_BACKING_STORE)
 724 viewRect.move(-actualScrollOffset());
 725#else
699726 viewRect.move(-scrollOffset());
 727#endif
700728 return convertToContainingWindow(viewRect);
701729}
702730

Source/WebCore/platform/ScrollView.h

@@public:
177177 int scrollX() const { return scrollPosition().x(); }
178178 int scrollY() const { return scrollPosition().y(); }
179179
 180#if ENABLE(TILED_BACKING_STORE)
 181 // Functions for querying the current actual scrolled position. This helps implementing correct
 182 // positioning and scroll information for cases in which the viewport is managed independently of
 183 // ScrollView, such as when the tiled backing store is enabled.
 184 IntSize actualScrollOffset() const { return (actualVisibleContentRect().isEmpty() ? visibleContentRect().location() : actualVisibleContentRect().location()) - IntPoint(); }
 185#endif
180186 IntSize overhangAmount() const;
181187
182188 void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition(); }

@@public:
184190
185191 // Functions for scrolling the view.
186192 void setScrollPosition(const IntPoint&);
187  void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); }
 193 void scrollBy(const IntSize&);
188194
189195 // This function scrolls by lines, pages or pixels.
190196 bool scroll(ScrollDirection, ScrollGranularity);

Source/WebCore/platform/graphics/IntRect.h

@@QT_END_NAMESPACE
5050#elif PLATFORM(GTK)
5151#ifdef GTK_API_VERSION_2
5252typedef struct _GdkRectangle GdkRectangle;
53 #else
54 typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
55 typedef cairo_rectangle_int_t GdkRectangle;
5653#endif
5754#elif PLATFORM(HAIKU)
5855class BRect;

@@class BRect;
6057typedef struct _Eina_Rectangle Eina_Rectangle;
6158#endif
6259
 60#if USE(CAIRO)
 61typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
 62#endif
 63
6364#if PLATFORM(WX)
6465class wxRect;
6566#endif

@@public:
178179 IntRect(const QRect&);
179180 operator QRect() const;
180181#elif PLATFORM(GTK)
 182#ifdef GTK_API_VERSION_2
181183 IntRect(const GdkRectangle&);
182184 operator GdkRectangle() const;
 185#endif
183186#elif PLATFORM(HAIKU)
184187 explicit IntRect(const BRect&);
185188 operator BRect() const;

@@public:
188191 operator Eina_Rectangle() const;
189192#endif
190193
 194#if USE(CAIRO)
 195 IntRect(const cairo_rectangle_int_t&);
 196 operator cairo_rectangle_int_t() const;
 197#endif
 198
191199#if USE(CG) || USE(SKIA_ON_MAC_CHROME)
192200 operator CGRect() const;
193201#endif

Source/WebCore/platform/graphics/Tile.h

2828#include <wtf/PassRefPtr.h>
2929#include <wtf/RefCounted.h>
3030
 31#if USE(CAIRO)
 32#include "OwnPtrCairo.h"
 33#include <cairo.h>
 34#endif
 35
3136#if PLATFORM(QT)
3237QT_BEGIN_NAMESPACE
3338class QPixmap;

@@private:
7176 QPixmap* m_backBuffer;
7277 QRegion* m_dirtyRegion;
7378#endif
 79
 80#if USE(CAIRO)
 81 RefPtr<cairo_surface_t> m_buffer;
 82 OwnPtr<cairo_region_t> m_dirtyRegion;
 83#endif
 84
7485};
7586
7687}

Source/WebCore/platform/graphics/TiledBackingStore.cpp

@@TiledBackingStore::TiledBackingStore(TiledBackingStoreClient* client)
4242 , m_pendingScale(0)
4343 , m_contentsFrozen(false)
4444{
 45 setTileSize(m_tileSize);
4546}
4647
4748TiledBackingStore::~TiledBackingStore()

Source/WebCore/platform/graphics/TiledBackingStore.h

@@public:
4242 TiledBackingStore(TiledBackingStoreClient*);
4343 ~TiledBackingStore();
4444
 45 void reset() { m_tiles.clear(); };
 46
4547 void adjustVisibleRect();
4648
4749 float contentsScale() { return m_contentsScale; }

Source/WebCore/platform/graphics/cairo/IntRectCairo.cpp

 1/*
 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
 3 * Copyright (C) 2011 Collabora Ltd.
 4 *
 5 * This library is free software; you can redistribute it and/or
 6 * modify it under the terms of the GNU Library General Public
 7 * License as published by the Free Software Foundation; either
 8 * version 2 of the License, or (at your option) any later version.
 9 *
 10 * This library is distributed in the hope that it will be useful,
 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13 * Library General Public License for more details.
 14 *
 15 * You should have received a copy of the GNU Library General Public License
 16 * along with this library; see the file COPYING.LIB. If not, write to
 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 18 * Boston, MA 02110-1301, USA.
 19 */
 20
 21#include "config.h"
 22#include "IntRect.h"
 23
 24#include <cairo.h>
 25
 26namespace WebCore {
 27
 28IntRect::IntRect(const cairo_rectangle_int_t& r)
 29 : m_location(IntPoint(r.x, r.y))
 30 , m_size(r.width, r.height)
 31{
 32}
 33
 34IntRect::operator cairo_rectangle_int_t() const
 35{
 36 cairo_rectangle_int_t r = { x(), y(), width(), height() };
 37 return r;
 38}
 39
 40}

Source/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp

@@template <> void deleteOwnedPtr<cairo_path_t>(cairo_path_t* ptr)
4949 cairo_path_destroy(ptr);
5050}
5151
 52template <> void deleteOwnedPtr<cairo_region_t>(cairo_region_t* ptr)
 53{
 54 if (ptr)
 55 cairo_region_destroy(ptr);
 56}
 57
 58template <> void deleteOwnedPtr<cairo_rectangle_t>(cairo_rectangle_t* ptr)
 59{
 60 if (ptr)
 61 free(ptr);
 62}
 63
5264} // namespace WTF

Source/WebCore/platform/graphics/cairo/OwnPtrCairo.h

@@typedef struct _FcFontSet FcFontSet;
2929#endif
3030
3131typedef struct cairo_path cairo_path_t;
 32typedef struct _cairo_region cairo_region_t;
 33typedef struct _cairo_rectangle cairo_rectangle_t;
3234
3335namespace WTF {
3436

@@template <> void deleteOwnedPtr<FcFontSet>(FcFontSet*);
3840#endif
3941
4042template <> void deleteOwnedPtr<cairo_path_t>(cairo_path_t*);
 43template <> void deleteOwnedPtr<cairo_region_t>(cairo_region_t*);
 44template <> void deleteOwnedPtr<cairo_rectangle_t>(cairo_rectangle_t*);
4145
4246} // namespace WTF
4347

Source/WebCore/platform/graphics/cairo/TileCairo.cpp

 1/*
 2 * Copyright (C) 2010 codeaurora.org All rights reserved.
 3 * Copyright (C) 2011 Collabora Ltd.
 4 *
 5 * Redistribution and use in source and binary forms, with or without
 6 * modification, are permitted provided that the following conditions
 7 * are met:
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. The name of the author may not be used to endorse or promote products
 14 * derived from this software without specific prior written permission.
 15 *
 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 26 */
 27
 28#include "config.h"
 29#include "Tile.h"
 30
 31#if ENABLE(TILED_BACKING_STORE)
 32
 33#include "CairoUtilities.h"
 34#include "GraphicsContext.h"
 35#include "PlatformContextCairo.h"
 36#include "TiledBackingStore.h"
 37#include "TiledBackingStoreClient.h"
 38#include <OwnPtrCairo.h>
 39#include <RefPtrCairo.h>
 40
 41namespace WebCore {
 42
 43static const unsigned checkerSize = 16;
 44static const unsigned checkerColor1 = 0xff555555;
 45static const unsigned checkerColor2 = 0xffaaaaaa;
 46
 47static cairo_surface_t* checkeredSurface()
 48{
 49 static cairo_surface_t* surface = 0;
 50 if (surface)
 51 return surface;
 52
 53 surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, checkerSize, checkerSize);
 54 RefPtr<cairo_t> cr = adoptRef(cairo_create(surface));
 55
 56 for (unsigned y = 0; y < checkerSize; y += checkerSize / 2) {
 57 bool alternate = y % checkerSize;
 58 for (unsigned x = 0; x < checkerSize; x += checkerSize / 2) {
 59 if (alternate)
 60 setSourceRGBAFromColor(cr.get(), checkerColor1);
 61 else
 62 setSourceRGBAFromColor(cr.get(), checkerColor2);
 63 cairo_rectangle(cr.get(), x, y, checkerSize / 2, checkerSize / 2);
 64 cairo_fill(cr.get());
 65 alternate = !alternate;
 66 }
 67 }
 68
 69 return surface;
 70}
 71
 72Tile::Tile(TiledBackingStore* backingStore, const Coordinate& tileCoordinate)
 73 : m_backingStore(backingStore)
 74 , m_coordinate(tileCoordinate)
 75 , m_rect(m_backingStore->tileRectForCoordinate(tileCoordinate))
 76{
 77 cairo_rectangle_int_t rect = m_rect;
 78 m_dirtyRegion = cairo_region_create_rectangle(&rect);
 79}
 80
 81Tile::~Tile()
 82{
 83}
 84
 85bool Tile::isDirty() const
 86{
 87 return !cairo_region_is_empty(m_dirtyRegion.get());
 88}
 89
 90bool Tile::isReadyToPaint() const
 91{
 92 return m_buffer;
 93}
 94
 95void Tile::invalidate(const IntRect& dirtyRect)
 96{
 97 IntRect tileDirtyRect = intersection(dirtyRect, m_rect);
 98 if (tileDirtyRect.isEmpty())
 99 return;
 100
 101 cairo_rectangle_int_t rect = tileDirtyRect;
 102 cairo_region_union_rectangle(m_dirtyRegion.get(), &rect);
 103
 104}
 105
 106static void regionToRects(cairo_region_t* region, Vector<IntRect>& updateRects)
 107{
 108 int rectCount = cairo_region_num_rectangles(region);
 109 OwnPtr<cairo_rectangle_int_t> rects = adoptPtr(new cairo_rectangle_int_t[rectCount]);
 110 for (int i = 0; i < rectCount; i++) {
 111 cairo_region_get_rectangle(region, i, rects.get() + i);
 112 updateRects.append(IntRect(rects.get()[i]));
 113 }
 114}
 115
 116Vector<IntRect> Tile::updateBackBuffer()
 117{
 118 if (m_buffer && !isDirty())
 119 return Vector<IntRect>();
 120
 121 if (!m_buffer)
 122 m_buffer = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, m_backingStore->m_tileSize.width(), m_backingStore->m_tileSize.height()));
 123
 124 Vector<IntRect> updateRects;
 125 regionToRects(m_dirtyRegion.get(), updateRects);
 126 m_dirtyRegion.clear();
 127 m_dirtyRegion = adoptPtr(cairo_region_create());
 128
 129 RefPtr<cairo_t> cr = adoptRef(cairo_create(m_buffer.get()));
 130 GraphicsContext context(cr.get());
 131 context.translate(-m_rect.x(), -m_rect.y());
 132
 133 for (int i = 0; i < updateRects.size() ; ++i) {
 134 context.save();
 135 context.clip(FloatRect(updateRects[i]));
 136 context.scale(FloatSize(m_backingStore->m_contentsScale, m_backingStore->m_contentsScale));
 137 m_backingStore->m_client->tiledBackingStorePaint(&context, m_backingStore->mapToContents(updateRects[i]));
 138 context.restore();
 139 }
 140
 141 return updateRects;
 142}
 143
 144void Tile::swapBackBufferToFront()
 145{
 146}
 147
 148void Tile::paint(GraphicsContext* context, const IntRect& rect)
 149{
 150 if (!m_buffer)
 151 return;
 152
 153 IntRect target = intersection(rect, m_rect);
 154 IntRect source(target.x() - m_rect.x(), target.y() - m_rect.y(), target.width(), target.height());
 155
 156 PlatformContextCairo* platformContext = context->platformContext();
 157 cairo_t* cr = platformContext->cr();
 158 cairo_set_source_surface(cr, m_buffer.get(), target.x() - source.x(), target.y() - source.y());
 159 cairo_rectangle(cr, target.x(), target.y(), target.width(), target.height());
 160 cairo_fill(cr);
 161}
 162
 163void Tile::paintCheckerPattern(GraphicsContext* context, const FloatRect& target)
 164{
 165 PlatformContextCairo* platformContext = context->platformContext();
 166 cairo_t* cr = platformContext->cr();
 167 cairo_set_source_surface(cr, checkeredSurface(), 0, 0);
 168 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
 169 cairo_rectangle(cr, target.x(), target.y(), target.width(), target.height());
 170 cairo_fill(cr);
 171}
 172
 173}
 174#endif // ENABLE(TILED_BACKING_STORE)

Source/WebCore/platform/graphics/gtk/IntRectGtk.cpp

2222
2323#include <gdk/gdk.h>
2424
 25#ifdef GTK_API_VERSION_2
2526namespace WebCore {
2627
2728IntRect::IntRect(const GdkRectangle& r)

@@IntRect::operator GdkRectangle() const
3738}
3839
3940}
40 
41 // vim: ts=4 sw=4 et
 41#endif

Source/WebCore/platform/gtk/ScrollViewGtk.cpp

@@IntRect ScrollView::visibleContentRect(bool includeScrollbars) const
184184
185185 GtkAllocation allocation;
186186 gtk_widget_get_allocation(measuredWidget, &allocation);
 187
 188#if ENABLE(TILED_BACKING_STORE)
 189 IntSize scrollOffset;
 190 if (delegatesScrolling())
 191 scrollOffset = actualScrollOffset();
 192 else
 193 scrollOffset = m_scrollOffset;
 194
 195 return IntRect(IntPoint(scrollOffset.width(), scrollOffset.height()),
 196 IntSize(allocation.width, allocation.height));
 197#else
187198 return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()),
188199 IntSize(allocation.width, allocation.height));
 200#endif
189201}
190202
191203void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, bool horizontalLock, bool verticalLock)

Source/WebKit/gtk/ChangeLog

 12011-05-07 Julien Chaffraix <jchaffraix@codeaurora.org>, Zaheer Ahmad <zahmad@codeaurora.org>, and Joone Hur <joone.hur@collabora.co.uk>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Gtk] Port tiled backing store
 6 https://bugs.webkit.org/show_bug.cgi?id=45423
 7
 8 Add the tiled backing store feature to the GTK+ port, which was implemented for the QT Port in 35146.
 9
 10 * WebCoreSupport/ChromeClientGtk.cpp:
 11 (WebKit::ChromeClient::invalidateWindow): Call the adjustVisibleRect of the tiledBackingStore.
 12 (WebKit::ChromeClient::scroll): Use the backing store while scrolling.
 13 (WebKit::ChromeClient::contentsSizeChanged): Invalidate the tiledBackingStore.
 14 (WebKit::ChromeClient::visibleRectForTiledBackingStore): Return the visibleContentRect
 15 for the main frame.
 16 (WebKit::ChromeClient::delegatedScrollRequested): Allow the delegate to scroll a web page instead of
 17 WebCore for programmatic scrolling.
 18 * WebCoreSupport/ChromeClientGtk.h:
 19 * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: Use cairo_rectangle_int_t instead of GdkRectangle.
 20 (DumpRenderTreeSupportGtk::firstRectForCharacterRange):
 21 (DumpRenderTreeSupportGtk::rectangleForSelection):
 22 * WebCoreSupport/DumpRenderTreeSupportGtk.h:
 23 * WebCoreSupport/FrameLoaderClientGtk.cpp:
 24 (WebKit::postCommitFrameViewSetup): Initialize the scroll position to (0, 0).
 25 (WebKit::FrameLoaderClient::transitionToCommittedForNewPage): Configure the scrollview for
 26 the tiled backing store.
 27 * webkit/webkitwebframe.cpp:
 28 (applyDelayedPainting): Paint the tiles when the time delay is over.
 29 (queueScrollingUpdate): Allow WebKit to queue a painting command when scrolling.
 30 (webkit_web_frame_get_scroll_offset): Obtain the current scroll offset.
 31 (webkit_web_frame_set_scroll_offset): Set the scroll offset.
 32 (webkit_web_frame_scroll): Shift the visible area by scrolling the contents by the provided amount.
 33 * webkit/webkitwebframe.h:
 34 * webkit/webkitwebframeprivate.h:
 35 * webkit/webkitwebsettings.cpp: add the enable-tiled-backing-store property.
 36 (webkit_web_settings_class_init): Install the enable-tiled-backing-store property.
 37 (webkit_web_settings_set_property): Set the enable-tiled-backing-store property.
 38 (webkit_web_settings_get_property): Get the enable-tiled-backing-store property.
 39 (webkit_web_settings_copy):
 40 * webkit/webkitwebview.cpp:
 41 (renderFromTiledBackingStore): Added to calculate the document dirty rect taking the
 42 scroll offsets and invoke the tile paint api.
 43 (paintWebView): Paint the tiled backing store when enabled.
 44 (webkit_web_view_size_allocate): Set the actualVisibleContentRect and adjust the tiles to the new size.
 45 (webkit_web_view_update_settings): Add the enable-tiled-backing-store property when
 46 ENABLE_TILED_BACKING_STORE.
 47 (webkit_web_view_settings_notify): Ditto.
 48
1492011-05-06 Kent Tamura <tkent@chromium.org>
250
351 Reviewed by Ryosuke Niwa.

Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

6666#include "DatabaseTracker.h"
6767#endif
6868
 69#if ENABLE(TILED_BACKING_STORE)
 70#include "TiledBackingStore.h"
 71#endif
 72
6973using namespace WebCore;
7074
7175namespace WebKit {

@@IntRect ChromeClient::windowResizerRect() const
374378 return IntRect();
375379}
376380
377 void ChromeClient::invalidateWindow(const IntRect&, bool immediate)
 381void ChromeClient::invalidateWindow(const IntRect& windowRect, bool immediate)
378382{
379383 // If we've invalidated regions for scrolling, force GDK to process those invalidations
380384 // now. This will also cause child windows to move right away. This prevents redraw

@@void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, con
412416
413417 m_pendingScrollInvalidations = true;
414418
 419#if ENABLE(TILED_BACKING_STORE)
 420 Frame* frame = core(m_webView)->mainFrame();
 421 if (frame && frame->tiledBackingStore())
 422 frame->tiledBackingStore()->adjustVisibleRect();
 423#endif
 424
415425 // We cannot use gdk_window_scroll here because it is only able to
416426 // scroll the whole window at once, and we often need to scroll
417427 // portions of the window only (think frames).

@@void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
485495 && (requisition.height != size.height())
486496 || (requisition.width != size.width()))
487497 gtk_widget_queue_resize_no_redraw(widget);
 498
 499#if ENABLE(TILED_BACKING_STORE)
 500 int xOffset, yOffset;
 501 WebKitWebFrame* webFrame = kit(frame);
 502 webkit_web_frame_get_scroll_offset(webFrame, &xOffset, &yOffset);
 503
 504 if (frame && frame->tiledBackingStore())
 505 frame->tiledBackingStore()->invalidate(IntRect(xOffset, yOffset, size.width(), size.height()));
 506#endif
488507}
489508
490509void ChromeClient::scrollbarsModeDidChange() const

@@void ChromeClient::exitFullScreenForElement(WebCore::Element* element)
725744}
726745#endif
727746
 747#if ENABLE(TILED_BACKING_STORE)
 748IntRect ChromeClient::visibleRectForTiledBackingStore() const
 749{
 750 Frame* frame = core(m_webView)->mainFrame();
 751 if (!frame || !frame->view())
 752 return IntRect();
 753
 754 WebKitWebFrame* webFrame = kit(frame);
 755
 756 int xOffset, yOffset;
 757 webkit_web_frame_get_scroll_offset(webFrame, &xOffset, &yOffset);
 758
 759 IntSize size = frame->view()->frameRect().size();
 760 return IntRect(xOffset, yOffset, size.width(), size.height());
 761}
728762
 763void ChromeClient::delegatedScrollRequested(const IntPoint& delta)
 764{
 765 WebKitWebFrame* webFrame = webkit_web_view_get_main_frame(m_webView);
 766 webkit_web_frame_scroll(webFrame, delta.x(), delta.y());
 767}
 768#endif
729769}

Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h

@@namespace WebKit {
150150 virtual void exitFullScreenForElement(WebCore::Element*);
151151#endif
152152
 153#if ENABLE(TILED_BACKING_STORE)
 154 virtual WebCore::IntRect visibleRectForTiledBackingStore() const;
 155 virtual void delegatedScrollRequested(const WebCore::IntPoint&);
 156#endif
 157
153158 private:
154159 WebKitWebView* m_webView;
155160 WebCore::KURL m_hoveredLinkURL;

Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp

@@void DumpRenderTreeSupportGtk::confirmComposition(WebKitWebView* webView, const
553553 editor->insertText(String::fromUTF8(text), 0);
554554}
555555
556 bool DumpRenderTreeSupportGtk::firstRectForCharacterRange(WebKitWebView* webView, int location, int length, GdkRectangle* rect)
 556bool DumpRenderTreeSupportGtk::firstRectForCharacterRange(WebKitWebView* webView, int location, int length, cairo_rectangle_int_t* rect)
557557{
558558 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), false);
559559 g_return_val_if_fail(rect, false);

@@void DumpRenderTreeSupportGtk::setValueForUser(JSContextRef context, JSValueRef
782782 inputElement->setValueForUser(String::fromUTF8(valueBuffer.get()));
783783}
784784
785 void DumpRenderTreeSupportGtk::rectangleForSelection(WebKitWebFrame* frame, GdkRectangle* rectangle)
 785void DumpRenderTreeSupportGtk::rectangleForSelection(WebKitWebFrame* frame, cairo_rectangle_int_t* rectangle)
786786{
787787 Frame* coreFrame = core(frame);
788788 if (!coreFrame)

Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h

@@public:
9999 static bool findString(WebKitWebView*, const gchar*, WebKitFindOptions);
100100 static void setComposition(WebKitWebView*, const char* text, int start, int end);
101101 static void confirmComposition(WebKitWebView*, const char* text);
102  static bool firstRectForCharacterRange(WebKitWebView*, int location, int length, GdkRectangle*);
 102 static bool firstRectForCharacterRange(WebKitWebView*, int location, int length, cairo_rectangle_int_t*);
103103 static bool selectedRange(WebKitWebView*, int* start, int* end);
104104 static double defaultMinimumTimerInterval(); // Not really tied to WebView
105105 static void setMinimumTimerInterval(WebKitWebView*, double);
106  static void rectangleForSelection(WebKitWebFrame*, GdkRectangle*);
 106 static void rectangleForSelection(WebKitWebFrame*, cairo_rectangle_int_t*);
107107 static void scalePageBy(WebKitWebView*, float, float, float);
108108
109109 // Accessibility

Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

9393#include <wtf/text/CString.h>
9494#include <wtf/text/StringConcatenate.h>
9595
 96#if ENABLE(TILED_BACKING_STORE)
 97#include "TiledBackingStore.h"
 98#endif
 99
96100using namespace WebCore;
97101
98102namespace WebKit {

@@static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, boo
13601364 webkit_web_view_clear_resources(containingWindow);
13611365
13621366 WebKitWebViewPrivate* priv = containingWindow->priv;
 1367#if ENABLE(TILED_BACKING_STORE)
 1368 webkit_web_frame_set_scroll_offset(frame, 0, 0);
 1369#else
13631370 view->setGtkAdjustments(priv->horizontalAdjustment.get(), priv->verticalAdjustment.get(), resetValues);
 1371#endif
13641372
13651373 // Invalidate the viewport attributes - they will only be valid
13661374 // again if the page we're beginning to load now has an

@@void FrameLoaderClient::transitionToCommittedForNewPage()
14091417 if (frame != frame->page()->mainFrame())
14101418 return;
14111419
 1420#if ENABLE(TILED_BACKING_STORE)
 1421 if (frame->tiledBackingStore()) {
 1422 frame->view()->setActualVisibleContentRect(IntRect(0, 0, size.width(), size.height()));
 1423 frame->view()->setDelegatesScrolling(true);
 1424 }
 1425#endif
 1426
14121427 postCommitFrameViewSetup(m_frame, frame->view(), true);
14131428}
14141429

Source/WebKit/gtk/webkit/webkitwebframe.cpp

33 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
44 * Copyright (C) 2007 Apple Inc.
55 * Copyright (C) 2008 Christian Dywan <christian@imendio.com>
6  * Copyright (C) 2008 Collabora Ltd.
76 * Copyright (C) 2008 Nuanti Ltd.
87 * Copyright (C) 2009 Jan Alonzo <jmalonzo@gmail.com>
98 * Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org>
 9 * Copyright (C) 2008,2011 Collabora Ltd.
1010 *
1111 * This library is free software; you can redistribute it and/or
1212 * modify it under the terms of the GNU Library General Public

6969#include "SVGSMILElement.h"
7070#endif
7171
 72#if ENABLE(TILED_BACKING_STORE)
 73#include "TiledBackingStore.h"
 74#endif
 75
7276/**
7377 * SECTION:webkitwebframe
7478 * @short_description: The content of a #WebKitWebView

@@WebKitNetworkResponse* webkit_web_frame_get_network_response(WebKitWebFrame* fra
974978 return kitNew(loader->response());
975979}
976980
 981#if ENABLE(TILED_BACKING_STORE)
 982static gboolean applyDelayedPainting(gpointer data)
 983{
 984 WebKitWebFrame* webFrame = WEBKIT_WEB_FRAME(data);
 985 Frame* frame = core(webFrame);
 986
 987 frame->tiledBackingStore()->setContentsFrozen(false);
 988
 989 frame->tiledBackingStore()->adjustVisibleRect();
 990 gtk_widget_queue_draw(GTK_WIDGET(webFrame->priv->webView));
 991 webFrame->priv->delayedPaintingTimeoutID = 0;
 992
 993 return FALSE;
 994}
 995
 996static void queueScrollingUpdate(WebKitWebFrame* webFrame)
 997{
 998 Frame* frame = core(webFrame);
 999 frame->tiledBackingStore()->setContentsFrozen(true);
 1000
 1001 if (webFrame->priv->delayedPaintingTimeoutID)
 1002 g_source_remove(webFrame->priv->delayedPaintingTimeoutID);
 1003
 1004 g_object_ref(webFrame);
 1005 webFrame->priv->delayedPaintingTimeoutID = g_timeout_add_full(G_PRIORITY_DEFAULT, 200, applyDelayedPainting, webFrame, g_object_unref);
 1006
 1007 // Let WebCore know that we're in a different part of the page,
 1008 // for programmatic scrolling.
 1009 IntRect actualVisibleContentRect(frame->view()->actualVisibleContentRect());
 1010 actualVisibleContentRect.setLocation(IntPoint(webFrame->priv->xOffset, webFrame->priv->yOffset));
 1011 frame->view()->setActualVisibleContentRect(actualVisibleContentRect);
 1012
 1013 // Update the view. We just don't want the backing store to have
 1014 // to be updated at this point, but we do want the already painted
 1015 // content, and the checkered area to scroll normally.
 1016 gtk_widget_queue_draw(GTK_WIDGET(webFrame->priv->webView));
 1017
 1018 // Emit the scroll event so that DOM event listeners are notified.
 1019 frame->eventHandler()->sendScrollEvent();
 1020
 1021 // Let plugins and other child widgets know as well.
 1022 frame->view()->frameRectsChanged();
 1023}
 1024#endif
 1025
 1026/**
 1027 * webkit_web_frame_get_scroll_offset:
 1028 * @webFrame: a #WebKitWebFrame instance
 1029 * @x: the location where the value for the x position should be stored or %NULL
 1030 * @y: the location where the value for the y position should be stored or %NULL
 1031 *
 1032 * Obtains the current scroll offset the the given @webFrame.
 1033 *
 1034 * Return value: %TRUE if the position was correctly obtained, %FALSE
 1035 * if the frame does not have a view currently.
 1036 *
 1037 * Since: 1.4.0
 1038 */
 1039gboolean webkit_web_frame_get_scroll_offset(WebKitWebFrame* webFrame,
 1040 gint* x, gint* y)
 1041{
 1042 g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(webFrame), FALSE);
 1043
 1044 FrameView* coreView = core(webFrame)->view();
 1045 if (!coreView)
 1046 return FALSE;
 1047
 1048 if (x) {
 1049#if ENABLE(TILED_BACKING_STORE)
 1050 if (core(webFrame) && core(webFrame)->tiledBackingStore())
 1051 *x = webFrame->priv->xOffset;
 1052 else
 1053#endif
 1054 *x = coreView->scrollX();
 1055 }
 1056
 1057 if (y) {
 1058#if ENABLE(TILED_BACKING_STORE)
 1059 if (core(webFrame) && core(webFrame)->tiledBackingStore())
 1060 *y = webFrame->priv->yOffset;
 1061 else
 1062#endif
 1063 *y = coreView->scrollY();
 1064 }
 1065
 1066 return TRUE;
 1067}
 1068
 1069/**
 1070 * webkit_web_frame_set_scroll_offset:
 1071 * @webFrame: a #WebKitWebFrame instance
 1072 * @x: the x position to where the view should be scrolled
 1073 * @y: the y position to where the view should be scrolled
 1074 *
 1075 * Sets the scroll offset of the given frame.
 1076 *
 1077 * Since: 1.4.0
 1078 */
 1079void webkit_web_frame_set_scroll_offset(WebKitWebFrame* webFrame,
 1080 gint x, gint y)
 1081{
 1082 g_return_if_fail(WEBKIT_IS_WEB_FRAME(webFrame));
 1083
 1084 FrameView* coreView = core(webFrame)->view();
 1085 if (!coreView)
 1086 return;
 1087
 1088#if ENABLE(TILED_BACKING_STORE)
 1089 Frame* frame = core(webFrame);
 1090 if (frame && frame->tiledBackingStore()) {
 1091 webFrame->priv->xOffset = x;
 1092 webFrame->priv->yOffset = y;
 1093 queueScrollingUpdate(webFrame);
 1094 } else
 1095#endif
 1096 coreView->setScrollPosition(IntPoint(x, y));
 1097}
 1098
 1099/**
 1100 * webkit_web_frame_scroll:
 1101 * @webFrame: a #WebKitWebFrame instance
 1102 * @x: how many pixels the view should be scrolled in the x axis
 1103 * @y: how many pixels the view should be scrolled in the y axis
 1104 *
 1105 * Shifts the visible area by scrolling the contents of the given
 1106 * frame by the provided amount.
 1107 *
 1108 * Since: 1.4.0
 1109 */
 1110void webkit_web_frame_scroll(WebKitWebFrame* webFrame, gint x, gint y)
 1111{
 1112 g_return_if_fail(WEBKIT_IS_WEB_FRAME(webFrame));
 1113
 1114 FrameView* coreView = core(webFrame)->view();
 1115 if (!coreView)
 1116 return;
 1117
 1118#if ENABLE(TILED_BACKING_STORE)
 1119 Frame* frame = core(webFrame);
 1120 if (frame && frame->tiledBackingStore()) {
 1121 int xOffset, yOffset;
 1122 webkit_web_frame_get_scroll_offset(webFrame, &xOffset, &yOffset);
 1123
 1124 xOffset += x;
 1125 yOffset += y;
 1126
 1127 webkit_web_frame_set_scroll_offset(webFrame, xOffset, yOffset);
 1128 } else
 1129#endif
 1130 coreView->scrollBy(IntSize(x, y));
 1131}
 1132
9771133namespace WebKit {
9781134
9791135WebKitWebView* getViewFromFrame(WebKitWebFrame* frame)

Source/WebKit/gtk/webkit/webkitwebframe.h

@@webkit_web_frame_get_security_origin (WebKitWebFrame *frame);
175175WEBKIT_API WebKitNetworkResponse*
176176webkit_web_frame_get_network_response (WebKitWebFrame *frame);
177177
 178WEBKIT_API void
 179webkit_web_frame_set_scroll_offset (WebKitWebFrame *frame,
 180 gint x,
 181 gint y);
 182WEBKIT_API gboolean
 183webkit_web_frame_get_scroll_offset (WebKitWebFrame *frame,
 184 gint *x,
 185 gint *y);
 186WEBKIT_API void
 187webkit_web_frame_scroll (WebKitWebFrame *frame,
 188 gint x,
 189 gint y);
 190
178191G_END_DECLS
179192
180193#endif

Source/WebKit/gtk/webkit/webkitwebframeprivate.h

@@struct _WebKitWebFramePrivate {
4747 gchar* uri;
4848 WebKitLoadStatus loadStatus;
4949 WebKitSecurityOrigin* origin;
 50
 51#if ENABLE(TILED_BACKING_STORE)
 52 guint delayedPaintingTimeoutID;
 53 gint xOffset;
 54 gint yOffset;
 55#endif
5056};
5157
5258void webkit_web_frame_core_frame_gone(WebKitWebFrame*);

Source/WebKit/gtk/webkit/webkitwebsettings.cpp

@@struct _WebKitWebSettingsPrivate {
114114 gboolean enable_fullscreen;
115115 gboolean enable_dns_prefetching;
116116 gboolean enable_webgl;
 117 gboolean enable_tiled_backing_store;
117118};
118119
119120#define WEBKIT_WEB_SETTINGS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsPrivate))

@@enum {
168169 PROP_ENABLE_HYPERLINK_AUDITING,
169170 PROP_ENABLE_FULLSCREEN,
170171 PROP_ENABLE_DNS_PREFETCHING,
171  PROP_ENABLE_WEBGL
 172 PROP_ENABLE_WEBGL,
 173 PROP_ENABLE_TILED_BACKING_STORE
172174};
173175
174176// Create a default user agent string

@@static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass)
947949 TRUE,
948950 flags));
949951
 952 /**
 953 * WebKitWebSettings: enable-tiled-backing-store:
 954 *
 955 * Whether to enable the the tiled backing store feature.
 956 * With the tiled backing store enabled, the content of the web page are cached to bitmap
 957 * tiles. These bitmap tiles are created and deleted on-demand as the viewport moves over
 958 * the web page.
 959 * Enabling tiling can significantly speed up painting heavy operations like scrolling,
 960 * but it consumes more memory. It does not work well with contents using CSS fixed
 961 * positioning. This property is disabled by default and will be ignored if the build
 962 * option is disabled.
 963 *
 964 * Since: 1.4.0
 965 */
 966 g_object_class_install_property(gobject_class,
 967 PROP_ENABLE_TILED_BACKING_STORE,
 968 g_param_spec_boolean("enable-tiled-backing-store",
 969 _("Enable Tiled Backing Store"),
 970 _("Whether Tiled Backing Store should be enabled"),
 971 FALSE,
 972 flags));
 973
950974 g_type_class_add_private(klass, sizeof(WebKitWebSettingsPrivate));
951975}
952976

@@static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
11381162 case PROP_ENABLE_WEBGL:
11391163 priv->enable_webgl = g_value_get_boolean(value);
11401164 break;
 1165 case PROP_ENABLE_TILED_BACKING_STORE:
 1166 priv->enable_tiled_backing_store = g_value_get_boolean(value);
 1167 break;
11411168 default:
11421169 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
11431170 break;

@@static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa
12941321 case PROP_ENABLE_WEBGL:
12951322 g_value_set_boolean(value, priv->enable_webgl);
12961323 break;
 1324 case PROP_ENABLE_TILED_BACKING_STORE:
 1325 g_value_set_boolean(value, priv->enable_tiled_backing_store);
 1326 break;
12971327 default:
12981328 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
12991329 break;

@@WebKitWebSettings* webkit_web_settings_copy(WebKitWebSettings* web_settings)
13711401 "enable-hyperlink-auditing", priv->enable_hyperlink_auditing,
13721402 "enable-fullscreen", priv->enable_fullscreen,
13731403 "enable-dns-prefetching", priv->enable_dns_prefetching,
 1404 "enable-tiled-backing-store", priv->enable_tiled_backing_store,
13741405 NULL));
13751406
13761407 return copy;

Source/WebKit/gtk/webkit/webkitwebview.cpp

108108#include <wtf/gobject/GOwnPtr.h>
109109#include <wtf/text/CString.h>
110110
 111#if ENABLE(TILED_BACKING_STORE)
 112#include "TiledBackingStore.h"
 113#endif
 114
111115/**
112116 * SECTION:webkitwebview
113117 * @short_description: The central class of the WebKitGTK+ API

@@static bool shouldCoalesce(const IntRect& rect, const Vector<IntRect>& rects)
629633 return useUnionedRect;
630634}
631635
 636#if ENABLE(TILED_BACKING_STORE)
 637static void renderFromTiledBackingStore(Frame* frame, GraphicsContext* context, IntRect rect)
 638{
 639 ASSERT(frame->tiledBackingStore());
 640
 641 if (!frame->view() || !frame->contentRenderer())
 642 return;
 643
 644 WebKitWebFrame* webFrame = kit(frame);
 645
 646 gint scrollX, scrollY;
 647 webkit_web_frame_get_scroll_offset(webFrame, &scrollX, &scrollY);
 648
 649 context->translate(-scrollX, -scrollY);
 650 rect.move(scrollX, scrollY);
 651 frame->tiledBackingStore()->paint(context, rect);
 652}
 653#endif
 654
632655static void paintWebView(Frame* frame, gboolean transparent, GraphicsContext& context, const IntRect& clipRect, const Vector<IntRect>& rects)
633656{
634657 bool coalesce = true;

@@static void paintWebView(Frame* frame, gboolean transparent, GraphicsContext& co
640663 context.clip(clipRect);
641664 if (transparent)
642665 context.clearRect(clipRect);
 666#if ENABLE(TILED_BACKING_STORE)
 667 if (frame->tiledBackingStore())
 668 renderFromTiledBackingStore(frame, &context, clipRect);
 669 else
 670 frame->view()->paint(&context, clipRect);
 671#else
643672 frame->view()->paint(&context, clipRect);
 673#endif
644674 } else {
645675 for (size_t i = 0; i < rects.size(); i++) {
646676 IntRect rect = rects[i];

@@static void paintWebView(Frame* frame, gboolean transparent, GraphicsContext& co
648678 context.clip(rect);
649679 if (transparent)
650680 context.clearRect(rect);
 681#if ENABLE(TILED_BACKING_STORE)
 682 if (frame->tiledBackingStore())
 683 renderFromTiledBackingStore(frame, &context, clipRect);
 684 else
 685 frame->view()->paint(&context, rect);
 686#else
651687 frame->view()->paint(&context, rect);
 688#endif
652689 context.restore();
653690 }
654691 }

@@static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allo
905942 return;
906943
907944 frame->view()->resize(allocation->width, allocation->height);
 945
 946#if ENABLE(TILED_BACKING_STORE)
 947 if (frame->tiledBackingStore()) {
 948 IntRect actualVisibleContentRect = frame->view()->actualVisibleContentRect();
 949 actualVisibleContentRect.setSize(IntSize(allocation->width, allocation->height));
 950 frame->view()->setActualVisibleContentRect(actualVisibleContentRect);
 951 frame->tiledBackingStore()->adjustVisibleRect();
 952 }
 953#endif
 954
908955}
909956
910957static void webkit_web_view_grab_focus(GtkWidget* widget)

@@static void webkit_web_view_update_settings(WebKitWebView* webView)
32063253 enableUniversalAccessFromFileURI, enableFileAccessFromFileURI,
32073254 enableDOMPaste, tabKeyCyclesThroughElements, enableWebGL,
32083255 enableSiteSpecificQuirks, usePageCache, enableJavaApplet,
3209  enableHyperlinkAuditing, enableFullscreen, enableDNSPrefetching;
 3256 enableHyperlinkAuditing, enableFullscreen, enableDNSPrefetching,
 3257 enableTiledBackingStore;
32103258
32113259 WebKitEditingBehavior editingBehavior;
32123260

@@static void webkit_web_view_update_settings(WebKitWebView* webView)
32493297 "enable-fullscreen", &enableFullscreen,
32503298 "enable-dns-prefetching", &enableDNSPrefetching,
32513299 "enable-webgl", &enableWebGL,
 3300 "enable-tiled-backing-store", &enableTiledBackingStore,
32523301 NULL);
32533302
32543303 settings->setDefaultTextEncodingName(defaultEncoding);

@@static void webkit_web_view_update_settings(WebKitWebView* webView)
33013350 settings->setWebGLEnabled(enableWebGL);
33023351#endif
33033352
 3353#if ENABLE(TILED_BACKING_STORE)
 3354 settings->setTiledBackingStoreEnabled(enableTiledBackingStore);
 3355#endif
 3356
33043357 Page* page = core(webView);
33053358 if (page)
33063359 page->setTabKeyCyclesThroughElements(tabKeyCyclesThroughElements);

@@static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar
34303483 settings->setWebGLEnabled(g_value_get_boolean(&value));
34313484#endif
34323485
 3486#if ENABLE(TILED_BACKING_STORE)
 3487 else if (name == g_intern_string("enable-tiled-backing-store"))
 3488 settings->setTiledBackingStoreEnabled(g_value_get_boolean(&value));
 3489#endif
34333490 else if (!g_object_class_find_property(G_OBJECT_GET_CLASS(webSettings), name))
34343491 g_warning("Unexpected setting '%s'", name);
34353492 g_value_unset(&value);

Tools/ChangeLog

 12011-05-07 Joone Hur <joone.hur@collabora.co.uk>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Gtk] Port tiled backing store
 6 https://bugs.webkit.org/show_bug.cgi?id=45423
 7
 8 Use cairo_rectangle_int_t instead of GdkRectangle to remove GTK+2.0 dependency.
 9
 10 * DumpRenderTree/gtk/PixelDumpSupportGtk.cpp: Use cairo_rectangle_int_t instead of GdkRectangle.
 11 (createBitmapContextFromWebView):
 12 * DumpRenderTree/gtk/TextInputController.cpp: Ditto.
 13 (firstRectForCharacterRangeCallback):
 14
1152011-05-07 Adam Barth <abarth@webkit.org>
216
317 Reviewed by Eric Seidel.

Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp

@@PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool
6060#endif
6161
6262 if (drawSelectionRect) {
63  GdkRectangle rectangle;
 63 cairo_rectangle_int_t rectangle;
6464 DumpRenderTreeSupportGtk::rectangleForSelection(mainFrame, &rectangle);
6565
6666 cairo_set_line_width(context, 1.0);

Tools/DumpRenderTree/gtk/TextInputController.cpp

@@static JSValueRef firstRectForCharacterRangeCallback(JSContextRef context, JSObj
113113 int length = static_cast<int>(JSValueToNumber(context, arguments[1], exception));
114114 g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
115115
116  GdkRectangle rect;
 116 cairo_rectangle_int_t rect;
117117 if (!DumpRenderTreeSupportGtk::firstRectForCharacterRange(view, location, length, &rect))
118118 return JSValueMakeUndefined(context);
119119

configure.ac

@@fi
255255
256256# minimum base dependencies
257257LIBSOUP_REQUIRED_VERSION=2.33.6
258 CAIRO_REQUIRED_VERSION=1.6
 258CAIRO_REQUIRED_VERSION=1.10
259259FONTCONFIG_REQUIRED_VERSION=2.4
260260FREETYPE2_REQUIRED_VERSION=9.0
261261LIBXML_REQUIRED_VERSION=2.6

@@AC_ARG_ENABLE(fast_mobile_scrolling,
780780 [],[enable_fast_mobile_scrolling="no"])
781781AC_MSG_RESULT([$enable_fast_mobile_scrolling])
782782
 783# Tile support
 784AC_MSG_CHECKING([whether to enable Tiled Backing Store])
 785AC_ARG_ENABLE(tiled_backing_store,
 786 AC_HELP_STRING([--enable-tiled-backing-store],
 787 [enable support for Tiled Backing Store[default=no]]),
 788 [],[enable_tiled_backing_store="no"])
 789AC_MSG_RESULT([$enable_tiled_backing_store])
 790
783791# check whether to enable code coverage
784792AC_MSG_CHECKING([whether to enable code coverage support])
785793AC_ARG_ENABLE(coverage,

@@AM_CONDITIONAL([ENABLE_DATALIST],[test "$enable_datalist" = "yes"])
10911099AM_CONDITIONAL([ENABLE_DETAILS],[test "$enable_details" = "yes"])
10921100AM_CONDITIONAL([ENABLE_EVENTSOURCE],[test "$enable_eventsource" = "yes"])
10931101AM_CONDITIONAL([ENABLE_FAST_MOBILE_SCROLLING],[test "$enable_fast_mobile_scrolling" = "yes"])
 1102AM_CONDITIONAL([ENABLE_TILED_BACKING_STORE],[test "$enable_tiled_backing_store" = "yes"])
10941103AM_CONDITIONAL([ENABLE_FILE_SYSTEM],[test "$enable_file_system" = "yes"])
10951104AM_CONDITIONAL([ENABLE_QUOTA],[test "$enable_quota" = "yes"])
10961105AM_CONDITIONAL([ENABLE_ICONDATABASE],[test "$enable_icon_database" = "yes"])

@@Features:
11811190 Blob support : $enable_blob
11821191 Directory upload : $enable_directory_upload
11831192 Fast Mobile Scrolling : $enable_fast_mobile_scrolling
 1193 Tiled Backing Store : $enable_tiled_backing_store
11841194 JIT compilation : $enable_jit
11851195 Filters support : $enable_filters
11861196 Geolocation support : $enable_geolocation