summaryrefslogtreecommitdiffstats
path: root/WebCore/page
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page')
-rw-r--r--WebCore/page/FocusController.cpp9
-rw-r--r--WebCore/page/Frame.cpp28
-rw-r--r--WebCore/page/Frame.h10
-rw-r--r--WebCore/page/FrameView.cpp31
-rw-r--r--WebCore/page/FrameView.h3
-rw-r--r--WebCore/page/Geolocation.cpp18
-rw-r--r--WebCore/page/Page.cpp2
-rw-r--r--WebCore/page/PageGroup.h1
-rw-r--r--WebCore/page/SecurityOrigin.cpp13
-rw-r--r--WebCore/page/Settings.cpp2
-rw-r--r--WebCore/page/Settings.h12
-rw-r--r--WebCore/page/SpeechInput.cpp4
-rw-r--r--WebCore/page/SpeechInput.h3
-rw-r--r--WebCore/page/SpeechInputClient.h3
-rw-r--r--WebCore/page/brew/FrameBrew.cpp6
-rw-r--r--WebCore/page/chromium/FrameChromium.cpp84
-rw-r--r--WebCore/page/efl/FrameEfl.cpp6
-rw-r--r--WebCore/page/gtk/FrameGtk.cpp6
-rw-r--r--WebCore/page/haiku/FrameHaiku.cpp7
-rw-r--r--WebCore/page/mac/FrameMac.mm4
-rw-r--r--WebCore/page/qt/FrameQt.cpp11
-rw-r--r--WebCore/page/win/FrameCGWin.cpp2
-rw-r--r--WebCore/page/win/FrameCairoWin.cpp2
-rw-r--r--WebCore/page/wince/FrameWince.cpp7
-rw-r--r--WebCore/page/wx/FrameWx.cpp6
25 files changed, 197 insertions, 83 deletions
diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp
index 388aa09..2c2c447 100644
--- a/WebCore/page/FocusController.cpp
+++ b/WebCore/page/FocusController.cpp
@@ -620,11 +620,14 @@ bool FocusController::setFocusedNode(Node* node, PassRefPtr<Frame> newFocusedFra
oldDocument->setFocusedNode(0);
setFocusedFrame(newFocusedFrame);
-
+
+ // Setting the focused node can result in losing our last reft to node when JS event handlers fire.
+ RefPtr<Node> protect = node;
if (newDocument)
newDocument->setFocusedNode(node);
-
- m_page->editorClient()->setInputMethodState(node->shouldUseInputMethod());
+
+ if (newDocument->focusedNode() == node)
+ m_page->editorClient()->setInputMethodState(node->shouldUseInputMethod());
return true;
}
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 17652d9..c23368a 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -241,9 +241,11 @@ void Frame::setView(PassRefPtr<FrameView> view)
if (!view && m_doc && m_doc->attached() && !m_doc->inPageCache()) {
// FIXME: We don't call willRemove here. Why is that OK?
m_doc->detach();
- if (m_view)
- m_view->unscheduleRelayout();
}
+
+ if (m_view)
+ m_view->unscheduleRelayout();
+
eventHandler()->clear();
m_view = view;
@@ -1086,8 +1088,10 @@ void Frame::revealSelection(const ScrollAlignment& alignment, bool revealExtent)
// FIXME: This code only handles scrolling the startContainer's layer, but
// the selection rect could intersect more than just that.
// See <rdar://problem/4799899>.
- if (RenderLayer* layer = start.node()->renderer()->enclosingLayer())
+ if (RenderLayer* layer = start.node()->renderer()->enclosingLayer()) {
layer->scrollRectToVisible(rect, false, alignment, alignment);
+ selection()->updateAppearance();
+ }
}
}
@@ -1281,7 +1285,7 @@ unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsig
// Only treat the result as a match if it is visible
if (editor()->insideVisibleArea(resultRange.get())) {
++matchCount;
- document()->addMarker(resultRange.get(), DocumentMarker::TextMatch);
+ document()->markers()->addMarker(resultRange.get(), DocumentMarker::TextMatch);
}
// Stop looking if we hit the specified limit. A limit of 0 means no limit.
@@ -1321,7 +1325,7 @@ void Frame::setMarkedTextMatchesAreHighlighted(bool flag)
return;
m_highlightTextMatches = flag;
- document()->repaintMarkers(DocumentMarker::TextMatch);
+ document()->markers()->repaintMarkers(DocumentMarker::TextMatch);
}
void Frame::setDOMWindow(DOMWindow* domWindow)
@@ -1467,16 +1471,16 @@ void Frame::respondToChangedSelection(const VisibleSelection& oldSelection, bool
// This only erases markers that are in the first unit (word or sentence) of the selection.
// Perhaps peculiar, but it matches AppKit.
if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange())
- document()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);
+ document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);
if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange())
- document()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
+ document()->markers()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
}
// When continuous spell checking is off, existing markers disappear after the selection changes.
if (!isContinuousSpellCheckingEnabled)
- document()->removeMarkers(DocumentMarker::Spelling);
+ document()->markers()->removeMarkers(DocumentMarker::Spelling);
if (!isContinuousGrammarCheckingEnabled)
- document()->removeMarkers(DocumentMarker::Grammar);
+ document()->markers()->removeMarkers(DocumentMarker::Grammar);
editor()->respondToChangedSelection(oldSelection);
}
@@ -1612,7 +1616,11 @@ String Frame::layerTreeAsText() const
if (!contentRenderer())
return String();
- GraphicsLayer* rootLayer = contentRenderer()->compositor()->rootPlatformLayer();
+ RenderLayerCompositor* compositor = contentRenderer()->compositor();
+ if (compositor->compositingLayerUpdatePending())
+ compositor->updateCompositingLayers();
+
+ GraphicsLayer* rootLayer = compositor->rootPlatformLayer();
if (!rootLayer)
return String();
diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h
index 4e522c4..36803f8 100644
--- a/WebCore/page/Frame.h
+++ b/WebCore/page/Frame.h
@@ -221,6 +221,7 @@ namespace WebCore {
void textWillBeDeletedInTextField(Element* input);
void textDidChangeInTextArea(Element*);
+ DragImageRef nodeImage(Node*);
DragImageRef dragImageForSelection();
// === to be moved into SelectionController
@@ -285,7 +286,6 @@ namespace WebCore {
NSImage* selectionImage(bool forceBlackText = false) const;
NSImage* snapshotDragImage(Node*, NSRect* imageRect, NSRect* elementRect) const;
- NSImage* nodeImage(Node*) const;
private:
NSImage* imageFromRect(NSRect) const;
@@ -298,14 +298,6 @@ namespace WebCore {
#endif
-#if PLATFORM(WIN)
-
- public:
- // FIXME - We should have a single version of nodeImage instead of using platform types.
- HBITMAP nodeImage(Node*) const;
-
-#endif
-
private:
Page* m_page;
mutable FrameTree m_treeNode;
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 441e543..831ea86 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -212,7 +212,7 @@ void FrameView::reset()
m_delayedLayout = false;
m_doFullRepaint = true;
m_layoutSchedulingEnabled = true;
- m_midLayout = false;
+ m_inLayout = false;
m_layoutCount = 0;
m_nestedLayoutCount = 0;
m_postLayoutTasksTimer.stop();
@@ -609,7 +609,7 @@ RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const
void FrameView::layout(bool allowSubtree)
{
- if (m_midLayout)
+ if (m_inLayout)
return;
m_layoutTimer.stop();
@@ -642,11 +642,6 @@ void FrameView::layout(bool allowSubtree)
}
ASSERT(m_frame->view() == this);
- // This early return should be removed when rdar://5598072 is resolved. In the meantime, there is a
- // gigantic CrashTracer because of this issue, and the early return will hopefully cause graceful
- // failure instead.
- if (m_frame->view() != this)
- return;
Document* document = m_frame->document();
@@ -788,11 +783,11 @@ void FrameView::layout(bool allowSubtree)
view->disableLayoutState();
}
- m_midLayout = true;
+ m_inLayout = true;
beginDeferredRepaints();
root->layout();
endDeferredRepaints();
- m_midLayout = false;
+ m_inLayout = false;
if (subtree) {
RenderView* view = root->view();
@@ -802,7 +797,7 @@ void FrameView::layout(bool allowSubtree)
}
m_layoutRoot = 0;
- m_frame->selection()->setNeedsLayout();
+ m_frame->selection()->setCaretRectNeedsUpdate();
m_frame->selection()->updateAppearance();
m_layoutSchedulingEnabled = true;
@@ -1016,6 +1011,7 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
return false;
}
+// Note that this gets called at painting time.
void FrameView::setIsOverlapped(bool isOverlapped)
{
if (isOverlapped == m_isOverlapped)
@@ -1026,10 +1022,15 @@ void FrameView::setIsOverlapped(bool isOverlapped)
#if USE(ACCELERATED_COMPOSITING)
// Overlap can affect compositing tests, so if it changes, we need to trigger
- // a recalcStyle in the parent document.
+ // a layer update in the parent document.
if (hasCompositedContent()) {
- if (Element* ownerElement = m_frame->document()->ownerElement())
- ownerElement->setNeedsStyleRecalc(SyntheticStyleChange);
+ if (Frame* parentFrame = m_frame->tree()->parent()) {
+ if (RenderView* parentView = parentFrame->contentRenderer()) {
+ RenderLayerCompositor* compositor = parentView->compositor();
+ compositor->setCompositingLayersNeedRebuild();
+ compositor->scheduleCompositingLayerUpdate();
+ }
+ }
}
#endif
}
@@ -1781,7 +1782,7 @@ void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec
void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const
{
- tickmarks = frame()->document()->renderedRectsForMarkers(DocumentMarker::TextMatch);
+ tickmarks = frame()->document()->markers()->renderedRectsForMarkers(DocumentMarker::TextMatch);
}
IntRect FrameView::windowResizerRect() const
@@ -1988,7 +1989,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
PaintBehavior oldPaintBehavior = m_paintBehavior;
if (m_paintBehavior == PaintBehaviorNormal)
- document->invalidateRenderedRectsForMarkersInRect(rect);
+ document->markers()->invalidateRenderedRectsForMarkersInRect(rect);
if (document->printing())
m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index cc32404..47dff43 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -88,6 +88,7 @@ public:
void scheduleRelayoutOfSubtree(RenderObject*);
void unscheduleRelayout();
bool layoutPending() const;
+ bool isInLayout() const { return m_inLayout; }
RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
int layoutCount() const { return m_layoutCount; }
@@ -317,7 +318,7 @@ private:
RenderObject* m_layoutRoot;
bool m_layoutSchedulingEnabled;
- bool m_midLayout;
+ bool m_inLayout;
int m_layoutCount;
unsigned m_nestedLayoutCount;
Timer<FrameView> m_postLayoutTasksTimer;
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index 9a5e40b..19eff4a 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -693,14 +693,6 @@ void Geolocation::stopUpdating()
#if USE(PREEMPT_GEOLOCATION_PERMISSION)
void Geolocation::handlePendingPermissionNotifiers()
{
-#if ENABLE(CLIENT_BASED_GEOLOCATION)
- if (!m_frame)
- return;
- Page* page = m_frame->page();
- if (!page)
- return;
-#endif
-
// While we iterate through the list, we need not worry about list being modified as the permission
// is already set to Yes/No and no new listeners will be added to the pending list
GeoNotifierSet::const_iterator end = m_pendingForPermissionNotifiers.end();
@@ -710,12 +702,10 @@ void Geolocation::handlePendingPermissionNotifiers()
if (isAllowed()) {
// start all pending notification requests as permission granted.
// The notifier is always ref'ed by m_oneShots or m_watchers.
-#if ENABLE(CLIENT_BASED_GEOLOCATION)
- notifier->startTimerIfNeeded();
- page->geolocationController()->addObserver(this, notifier->m_options->enableHighAccuracy());
-#else
- // TODO: Handle startUpdate() for non-client based implementations using pre-emptive policy
-#endif
+ if (startUpdating(notifier))
+ notifier->startTimerIfNeeded();
+ else
+ notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage));
} else
notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage));
}
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index 63decd7..b8abb54 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -558,7 +558,7 @@ void Page::unmarkAllTextMatches()
Frame* frame = mainFrame();
do {
- frame->document()->removeMarkers(DocumentMarker::TextMatch);
+ frame->document()->markers()->removeMarkers(DocumentMarker::TextMatch);
frame = incrementFrame(frame, true, false);
} while (frame);
}
diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h
index 6a3518e..fcad773 100644
--- a/WebCore/page/PageGroup.h
+++ b/WebCore/page/PageGroup.h
@@ -74,6 +74,7 @@ namespace WebCore {
#endif
#if ENABLE(INDEXED_DATABASE)
IDBFactoryBackendInterface* idbFactory();
+ bool hasIDBFactory() { return m_factoryBackend; }
#endif
void addUserScriptToWorld(DOMWrapperWorld*, const String& source, const KURL&,
diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp
index f759402..5b51501 100644
--- a/WebCore/page/SecurityOrigin.cpp
+++ b/WebCore/page/SecurityOrigin.cpp
@@ -29,6 +29,7 @@
#include "config.h"
#include "SecurityOrigin.h"
+#include "BlobURL.h"
#include "Document.h"
#include "FileSystem.h"
#include "KURL.h"
@@ -123,6 +124,10 @@ PassRefPtr<SecurityOrigin> SecurityOrigin::create(const KURL& url, SandboxFlags
{
if (!url.isValid())
return adoptRef(new SecurityOrigin(KURL(), sandboxFlags));
+#if ENABLE(BLOB)
+ if (url.protocolIs("blob"))
+ return adoptRef(new SecurityOrigin(BlobURL::getOrigin(url), sandboxFlags));
+#endif
return adoptRef(new SecurityOrigin(url, sandboxFlags));
}
@@ -275,6 +280,14 @@ bool SecurityOrigin::isAccessWhiteListed(const SecurityOrigin* targetOrigin) con
bool SecurityOrigin::canLoad(const KURL& url, const String& referrer, Document* document)
{
+#if ENABLE(BLOB)
+ if (url.protocolIs("blob") && document) {
+ SecurityOrigin* documentOrigin = document->securityOrigin();
+ RefPtr<SecurityOrigin> targetOrigin = SecurityOrigin::create(url);
+ return documentOrigin->isSameSchemeHostPort(targetOrigin.get());
+ }
+#endif
+
if (!SchemeRegistry::shouldTreatURLAsLocal(url.string()))
return true;
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index 06dcd49..a7ca533 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -144,8 +144,6 @@ Settings::Settings(Page* page)
, m_acceleratedCanvas2dEnabled(false)
, m_loadDeferringEnabled(true)
, m_tiledBackingStoreEnabled(false)
- , m_html5ParserEnabled(true)
- , m_html5TreeBuilderEnabled(false) // Will be deleted soon, do not use.
, m_paginateDuringLayoutEnabled(false)
, m_dnsPrefetchingEnabled(true)
, m_memoryInfoEnabled(false)
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index d048c34..0048598 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -376,16 +376,6 @@ namespace WebCore {
void setTiledBackingStoreEnabled(bool);
bool tiledBackingStoreEnabled() const { return m_tiledBackingStoreEnabled; }
- void setHTML5ParserEnabled(bool flag) { m_html5ParserEnabled = flag; }
- bool html5ParserEnabled() const { return m_html5ParserEnabled; }
-
- // NOTE: This code will be deleted once the HTML5TreeBuilder is ready
- // to replace LegacyHTMLTreeBuilder. Using the HTML5DocumentParser
- // with LegacyHTMLTreeBuilder will not be supported long-term.
- // Setting is only for testing the new tree builder in DumpRenderTree.
- void setHTML5TreeBuilderEnabled_DO_NOT_USE(bool flag) { m_html5TreeBuilderEnabled = flag; }
- bool html5TreeBuilderEnabled() const { return m_html5TreeBuilderEnabled; }
-
void setPaginateDuringLayoutEnabled(bool flag) { m_paginateDuringLayoutEnabled = flag; }
bool paginateDuringLayoutEnabled() const { return m_paginateDuringLayoutEnabled; }
@@ -516,8 +506,6 @@ namespace WebCore {
bool m_acceleratedCanvas2dEnabled : 1;
bool m_loadDeferringEnabled : 1;
bool m_tiledBackingStoreEnabled : 1;
- bool m_html5ParserEnabled: 1;
- bool m_html5TreeBuilderEnabled: 1; // Will be deleted soon, do not use.
bool m_paginateDuringLayoutEnabled : 1;
bool m_dnsPrefetchingEnabled : 1;
bool m_memoryInfoEnabled: 1;
diff --git a/WebCore/page/SpeechInput.cpp b/WebCore/page/SpeechInput.cpp
index 24b52d2..234791b 100644
--- a/WebCore/page/SpeechInput.cpp
+++ b/WebCore/page/SpeechInput.cpp
@@ -93,10 +93,10 @@ void SpeechInput::setRecognitionResult(int listenerId, const String& result)
m_listeners.get(listenerId)->setRecognitionResult(listenerId, result);
}
-bool SpeechInput::startRecognition(int listenerId)
+bool SpeechInput::startRecognition(int listenerId, const IntRect& elementRect)
{
ASSERT(m_listeners.contains(listenerId));
- return m_client->startRecognition(listenerId);
+ return m_client->startRecognition(listenerId, elementRect);
}
void SpeechInput::stopRecording(int listenerId)
diff --git a/WebCore/page/SpeechInput.h b/WebCore/page/SpeechInput.h
index f36194c..d10b789 100644
--- a/WebCore/page/SpeechInput.h
+++ b/WebCore/page/SpeechInput.h
@@ -40,6 +40,7 @@
namespace WebCore {
+class IntRect;
class SpeechInputClient;
class SpeechInputListener;
@@ -60,7 +61,7 @@ public:
void unregisterListener(int);
// Methods invoked by the input elements.
- bool startRecognition(int);
+ bool startRecognition(int, const IntRect&);
void stopRecording(int);
void cancelRecognition(int);
diff --git a/WebCore/page/SpeechInputClient.h b/WebCore/page/SpeechInputClient.h
index 87ff7b9..d5fda17 100644
--- a/WebCore/page/SpeechInputClient.h
+++ b/WebCore/page/SpeechInputClient.h
@@ -35,6 +35,7 @@
namespace WebCore {
+class IntRect;
class SpeechInputListener;
// Provides an interface for SpeechInput to call into the embedder.
@@ -47,7 +48,7 @@ public:
virtual void setListener(SpeechInputListener*) = 0;
// Starts speech recognition and audio recording.
- virtual bool startRecognition(int requestId) = 0;
+ virtual bool startRecognition(int requestId, const IntRect& elementRect) = 0;
// Stops audio recording and performs recognition with the audio recorded until now
// (does not discard audio).
diff --git a/WebCore/page/brew/FrameBrew.cpp b/WebCore/page/brew/FrameBrew.cpp
index a590544..7825dbd 100644
--- a/WebCore/page/brew/FrameBrew.cpp
+++ b/WebCore/page/brew/FrameBrew.cpp
@@ -29,6 +29,12 @@
namespace WebCore {
+DragImageRef Frame::nodeImage(Node*)
+{
+ notImplemented();
+ return 0;
+}
+
DragImageRef Frame::dragImageForSelection()
{
notImplemented();
diff --git a/WebCore/page/chromium/FrameChromium.cpp b/WebCore/page/chromium/FrameChromium.cpp
index 548e0fa..4146b39 100644
--- a/WebCore/page/chromium/FrameChromium.cpp
+++ b/WebCore/page/chromium/FrameChromium.cpp
@@ -28,19 +28,91 @@
#include "Document.h"
#include "FloatRect.h"
+#include "ImageBuffer.h"
#include "RenderView.h"
#include "Settings.h"
-using std::min;
-
namespace WebCore {
+namespace {
+
+struct ScopedState {
+ ScopedState(Frame* theFrame, RenderObject* theRenderer)
+ : frame(theFrame)
+ , renderer(theRenderer)
+ , paintBehavior(frame->view()->paintBehavior())
+ , backgroundColor(frame->view()->baseBackgroundColor())
+ {
+ }
+
+ ~ScopedState()
+ {
+ if (renderer)
+ renderer->updateDragState(false);
+ frame->view()->setPaintBehavior(paintBehavior);
+ frame->view()->setBaseBackgroundColor(backgroundColor);
+ frame->view()->setNodeToDraw(0);
+ }
+
+ Frame* frame;
+ RenderObject* renderer;
+ PaintBehavior paintBehavior;
+ Color backgroundColor;
+};
+
+} // namespace
+
+DragImageRef Frame::nodeImage(Node* node)
+{
+ RenderObject* renderer = node->renderer();
+ if (!renderer)
+ return 0;
+
+ const ScopedState state(this, renderer);
+
+ renderer->updateDragState(true);
+ m_view->setPaintBehavior(state.paintBehavior | PaintBehaviorFlattenCompositingLayers);
+ // When generating the drag image for an element, ignore the document background.
+ m_view->setBaseBackgroundColor(colorWithOverrideAlpha(Color::white, 1.0));
+ m_doc->updateLayout();
+ m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode.
+
+ IntRect topLevelRect;
+ IntRect paintingRect = renderer->paintingRootRect(topLevelRect);
+
+ OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size()));
+ if (!buffer)
+ return 0;
+ buffer->context()->translate(-paintingRect.x(), -paintingRect.y());
+ buffer->context()->clip(FloatRect(0, 0, paintingRect.right(), paintingRect.bottom()));
+
+ m_view->paint(buffer->context(), paintingRect);
+
+ RefPtr<Image> image = buffer->copyImage();
+ return createDragImageFromImage(image.get());
+}
+
DragImageRef Frame::dragImageForSelection()
-{
- if (selection()->isRange())
- return 0; // FIXME: implement me!
+{
+ if (!selection()->isRange())
+ return 0;
+
+ const ScopedState state(this, 0);
+ m_view->setPaintBehavior(PaintBehaviorSelectionOnly);
+ m_doc->updateLayout();
+
+ IntRect paintingRect = enclosingIntRect(selectionBounds());
+
+ OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size()));
+ if (!buffer)
+ return 0;
+ buffer->context()->translate(-paintingRect.x(), -paintingRect.y());
+ buffer->context()->clip(FloatRect(0, 0, paintingRect.right(), paintingRect.bottom()));
+
+ m_view->paint(buffer->context(), paintingRect);
- return 0;
+ RefPtr<Image> image = buffer->copyImage();
+ return createDragImageFromImage(image.get());
}
} // namespace WebCore
diff --git a/WebCore/page/efl/FrameEfl.cpp b/WebCore/page/efl/FrameEfl.cpp
index 783df7e..b1be9ca 100644
--- a/WebCore/page/efl/FrameEfl.cpp
+++ b/WebCore/page/efl/FrameEfl.cpp
@@ -32,6 +32,12 @@
namespace WebCore {
+DragImageRef Frame::nodeImage(Node* node)
+{
+ notImplemented();
+ return 0;
+}
+
DragImageRef Frame::dragImageForSelection()
{
notImplemented();
diff --git a/WebCore/page/gtk/FrameGtk.cpp b/WebCore/page/gtk/FrameGtk.cpp
index 3cab5a0..14a0f8b 100644
--- a/WebCore/page/gtk/FrameGtk.cpp
+++ b/WebCore/page/gtk/FrameGtk.cpp
@@ -28,6 +28,12 @@
namespace WebCore {
+DragImageRef Frame::nodeImage(Node*)
+{
+ notImplemented();
+ return 0;
+}
+
DragImageRef Frame::dragImageForSelection()
{
notImplemented();
diff --git a/WebCore/page/haiku/FrameHaiku.cpp b/WebCore/page/haiku/FrameHaiku.cpp
index 50168dd..5ff6950 100644
--- a/WebCore/page/haiku/FrameHaiku.cpp
+++ b/WebCore/page/haiku/FrameHaiku.cpp
@@ -33,6 +33,12 @@
namespace WebCore {
+DragImageRef Frame::nodeImage(Node*)
+{
+ notImplemented();
+ return 0;
+}
+
DragImageRef Frame::dragImageForSelection()
{
notImplemented();
@@ -40,4 +46,3 @@ DragImageRef Frame::dragImageForSelection()
}
} // namespace WebCore
-
diff --git a/WebCore/page/mac/FrameMac.mm b/WebCore/page/mac/FrameMac.mm
index bb11ac9..0365784 100644
--- a/WebCore/page/mac/FrameMac.mm
+++ b/WebCore/page/mac/FrameMac.mm
@@ -380,7 +380,7 @@ NSImage* Frame::snapshotDragImage(Node* node, NSRect* imageRect, NSRect* element
return result;
}
-NSImage* Frame::nodeImage(Node* node) const
+DragImageRef Frame::nodeImage(Node* node)
{
RenderObject* renderer = node->renderer();
if (!renderer)
@@ -535,7 +535,7 @@ NSMutableDictionary* Frame::dashboardRegionsDictionary()
}
#endif
-DragImageRef Frame::dragImageForSelection()
+DragImageRef Frame::dragImageForSelection()
{
if (!selection()->isRange())
return nil;
diff --git a/WebCore/page/qt/FrameQt.cpp b/WebCore/page/qt/FrameQt.cpp
index 493e60d..ed75eb8 100644
--- a/WebCore/page/qt/FrameQt.cpp
+++ b/WebCore/page/qt/FrameQt.cpp
@@ -24,10 +24,19 @@
#include "config.h"
#include "Frame.h"
+#include "NotImplemented.h"
+
namespace WebCore {
-DragImageRef Frame::dragImageForSelection()
+DragImageRef Frame::nodeImage(Node*)
+{
+ notImplemented();
+ return 0;
+}
+
+DragImageRef Frame::dragImageForSelection()
{
+ notImplemented();
return 0;
}
diff --git a/WebCore/page/win/FrameCGWin.cpp b/WebCore/page/win/FrameCGWin.cpp
index cce5004..b61deef 100644
--- a/WebCore/page/win/FrameCGWin.cpp
+++ b/WebCore/page/win/FrameCGWin.cpp
@@ -95,7 +95,7 @@ HBITMAP imageFromSelection(Frame* frame, bool forceBlackText)
return image;
}
-HBITMAP Frame::nodeImage(Node* node) const
+DragImageRef Frame::nodeImage(Node* node)
{
RenderObject* renderer = node->renderer();
if (!renderer)
diff --git a/WebCore/page/win/FrameCairoWin.cpp b/WebCore/page/win/FrameCairoWin.cpp
index 3e1fe28..f843ba1 100644
--- a/WebCore/page/win/FrameCairoWin.cpp
+++ b/WebCore/page/win/FrameCairoWin.cpp
@@ -40,7 +40,7 @@ HBITMAP imageFromSelection(Frame* frame, bool forceBlackText)
return 0;
}
-HBITMAP Frame::nodeImage(Node*) const
+DragImageRef Frame::nodeImage(Node*)
{
notImplemented();
return 0;
diff --git a/WebCore/page/wince/FrameWince.cpp b/WebCore/page/wince/FrameWince.cpp
index c806b98..7cfbae0 100644
--- a/WebCore/page/wince/FrameWince.cpp
+++ b/WebCore/page/wince/FrameWince.cpp
@@ -35,6 +35,7 @@
#include "HTMLNames.h"
#include "HTMLTableCellElement.h"
#include "KeyboardEvent.h"
+#include "NotImplemented.h"
#include "Page.h"
#include "RenderFrame.h"
#include "RenderLayer.h"
@@ -147,6 +148,12 @@ HBITMAP imageFromSelection(Frame* frame, bool forceBlackText)
return hBmp;
}
+DragImageRef Frame::nodeImage(Node*)
+{
+ notImplemented();
+ return 0;
+}
+
DragImageRef Frame::dragImageForSelection()
{
if (selection()->isRange())
diff --git a/WebCore/page/wx/FrameWx.cpp b/WebCore/page/wx/FrameWx.cpp
index b220694..6c16adc 100644
--- a/WebCore/page/wx/FrameWx.cpp
+++ b/WebCore/page/wx/FrameWx.cpp
@@ -29,6 +29,12 @@
namespace WebCore {
+DragImageRef Frame::nodeImage(Node*)
+{
+ notImplemented();
+ return 0;
+}
+
DragImageRef Frame::dragImageForSelection()
{
notImplemented();