summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/chrome_client_impl.cc92
-rw-r--r--webkit/glue/chrome_client_impl.h32
-rw-r--r--webkit/glue/event_conversion.cc8
-rw-r--r--webkit/glue/glue_util.cc3
-rw-r--r--webkit/glue/inspector_client_impl.cc1
-rw-r--r--webkit/glue/localized_strings.cc8
-rw-r--r--webkit/glue/searchable_form_data.cc10
-rw-r--r--webkit/glue/webframe_impl.cc116
-rw-r--r--webkit/glue/webplugin_impl.cc52
-rw-r--r--webkit/glue/webplugin_impl.h12
-rw-r--r--webkit/glue/webview_impl.cc56
-rw-r--r--webkit/glue/webview_impl.h17
-rw-r--r--webkit/glue/webwidget_impl.cc105
-rw-r--r--webkit/glue/webwidget_impl.h34
14 files changed, 275 insertions, 271 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index d2bbbb4..24cbb7c 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
MSVC_PUSH_WARNING_LEVEL(0);
+#include "Cursor.h"
#include "FloatRect.h"
#include "FileChooser.h"
#include "FrameLoadRequest.h"
@@ -29,6 +30,7 @@ MSVC_POP_WARNING();
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webview_delegate.h"
#include "webkit/glue/webview_impl.h"
+#include "webkit/glue/webwidget_impl.h"
struct IWebURLResponse;
@@ -356,23 +358,52 @@ WebCore::IntRect ChromeClientImpl::windowResizerRect() const {
return rv;
}
-void ChromeClientImpl::addToDirtyRegion(const WebCore::IntRect& damaged_rect) {
- ASSERT_NOT_REACHED();
+void ChromeClientImpl::repaint(
+ const WebCore::IntRect& paint_rect, bool content_changed, bool immediate,
+ bool repaint_content_only) {
+ WebViewDelegate* d = webview_->delegate();
+ if (d)
+ d->DidInvalidateRect(webview_, webkit_glue::FromIntRect(paint_rect));
+}
+
+void ChromeClientImpl::scroll(
+ const WebCore::IntSize& scroll_delta, const WebCore::IntRect& scroll_rect,
+ const WebCore::IntRect& clip_rect) {
+ WebViewDelegate* d = webview_->delegate();
+ if (d) {
+ int dx = scroll_delta.width();
+ int dy = scroll_delta.height();
+ d->DidScrollRect(webview_, dx, dy, webkit_glue::FromIntRect(clip_rect));
+ }
}
-void ChromeClientImpl::scrollBackingStore(int dx, int dy,
- const WebCore::IntRect& scroll_rect,
- const WebCore::IntRect& clip_rect) {
- ASSERT_NOT_REACHED();
+WebCore::IntPoint ChromeClientImpl::screenToWindow(
+ const WebCore::IntPoint&) const {
+ NOTIMPLEMENTED();
+ return WebCore::IntPoint();
}
-void ChromeClientImpl::updateBackingStore() {
- ASSERT_NOT_REACHED();
+WebCore::IntRect ChromeClientImpl::windowToScreen(
+ const WebCore::IntRect& rect) const {
+ WebCore::IntRect screen_rect(rect);
+
+ WebViewDelegate* d = webview_->delegate();
+ if (d) {
+ gfx::Rect window_rect;
+ d->GetWindowRect(webview_, &window_rect);
+ screen_rect.move(window_rect.x(), window_rect.y());
+ }
+
+ return screen_rect;
}
-void ChromeClientImpl::mouseDidMoveOverElement(const WebCore::HitTestResult& result,
- unsigned modifierFlags) {
+PlatformWidget ChromeClientImpl::platformWindow() const {
+ // We have no native widget.
+ return NULL;
+}
+void ChromeClientImpl::mouseDidMoveOverElement(
+ const WebCore::HitTestResult& result, unsigned modifierFlags) {
// Find out if the mouse is over a link, and if so, let our UI know... somehow
WebViewDelegate* d = webview_->delegate();
if (d) {
@@ -392,6 +423,18 @@ void ChromeClientImpl::setToolTip(const WebCore::String& tooltip_text) {
}
}
+void ChromeClientImpl::print(WebCore::Frame* frame) {
+ WebViewDelegate* d = webview_->delegate();
+ if (d) {
+ d->ScriptedPrint(WebFrameImpl::FromFrame(frame));
+ }
+}
+
+void ChromeClientImpl::exceededDatabaseQuota(WebCore::Frame* frame,
+ const WebCore::String& databaseName) {
+ // TODO(tc): If we enable the storage API, we need to implement this function.
+}
+
void ChromeClientImpl::runFileChooser(const WebCore::String& default_path,
PassRefPtr<WebCore::FileChooser> fileChooser) {
WebViewDelegate* delegate = webview_->delegate();
@@ -403,28 +446,21 @@ void ChromeClientImpl::runFileChooser(const WebCore::String& default_path,
delegate->RunFileChooser(suggestion, chooser);
}
-WebCore::IntRect ChromeClientImpl::windowToScreen(const WebCore::IntRect& rect) {
- WebCore::IntRect screen_rect(rect);
-
+void ChromeClientImpl::popupOpened(
+ WebCore::FramelessScrollView* popup_view, const WebCore::IntRect& bounds) {
WebViewDelegate* d = webview_->delegate();
if (d) {
- gfx::Rect window_rect;
- d->GetWindowRect(webview_, &window_rect);
- screen_rect.move(window_rect.x(), window_rect.y());
+ WebWidgetImpl* webwidget =
+ static_cast<WebWidgetImpl*>(d->CreatePopupWidget(webview_));
+ webwidget->Init(popup_view, webkit_glue::FromIntRect(bounds));
}
-
- return screen_rect;
}
-void ChromeClientImpl::print(WebCore::Frame* frame) {
+void ChromeClientImpl::setCursor(const WebCore::Cursor& cursor) {
+#if defined(OS_WIN)
+ // TODO(pinkerton): figure out the cursor delegate methods
WebViewDelegate* d = webview_->delegate();
- if (d) {
- d->ScriptedPrint(WebFrameImpl::FromFrame(frame));
- }
-}
-
-void ChromeClientImpl::exceededDatabaseQuota(WebCore::Frame* frame,
- const WebCore::String& databaseName) {
- // TODO(tc): If we enable the storage API, we need to implement this function.
+ if (d)
+ d->SetCursor(webview_, cursor.impl());
+#endif
}
-
diff --git a/webkit/glue/chrome_client_impl.h b/webkit/glue/chrome_client_impl.h
index a070fd1..acecb44 100644
--- a/webkit/glue/chrome_client_impl.h
+++ b/webkit/glue/chrome_client_impl.h
@@ -72,7 +72,10 @@ public:
virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&);
virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&);
- virtual bool runJavaScriptPrompt(WebCore::Frame*, const WebCore::String& message, const WebCore::String& defaultValue, WebCore::String& result);
+ virtual bool runJavaScriptPrompt(WebCore::Frame*,
+ const WebCore::String& message,
+ const WebCore::String& defaultValue,
+ WebCore::String& result);
virtual void setStatusbarText(const WebCore::String&);
virtual bool shouldInterruptJavaScript();
@@ -85,23 +88,32 @@ public:
virtual bool tabsToLinks() const;
virtual WebCore::IntRect windowResizerRect() const;
- virtual void addToDirtyRegion(const WebCore::IntRect&);
- virtual void scrollBackingStore(int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect);
- virtual void updateBackingStore();
-
- virtual void mouseDidMoveOverElement(const WebCore::HitTestResult& result, unsigned modifierFlags);
+
+ virtual void repaint(const WebCore::IntRect&, bool contentChanged,
+ bool immediate = false, bool repaintContentOnly = false);
+ virtual void scroll(const WebCore::IntSize& scrollDelta,
+ const WebCore::IntRect& rectToScroll,
+ const WebCore::IntRect& clipRect);
+ virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
+ virtual PlatformWidget platformWindow() const;
+
+ virtual void mouseDidMoveOverElement(const WebCore::HitTestResult& result,
+ unsigned modifierFlags);
virtual void setToolTip(const WebCore::String& tooltip_text);
- virtual void runFileChooser(const WebCore::String&,
- PassRefPtr<WebCore::FileChooser>);
- virtual WebCore::IntRect windowToScreen(const WebCore::IntRect& rect);
-
virtual void print(WebCore::Frame*);
virtual void exceededDatabaseQuota(WebCore::Frame*,
const WebCore::String& databaseName);
+ virtual void runFileChooser(const WebCore::String&,
+ PassRefPtr<WebCore::FileChooser>);
+ virtual void popupOpened(WebCore::FramelessScrollView* popup_view,
+ const WebCore::IntRect& bounds);
+ virtual void setCursor(const WebCore::Cursor&);
+
private:
WebViewImpl* webview_; // weak pointer
bool toolbars_visible_;
diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc
index d5b2f44..517b870 100644
--- a/webkit/glue/event_conversion.cc
+++ b/webkit/glue/event_conversion.cc
@@ -115,18 +115,12 @@ MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget,
m_globalPosition = IntPoint(e.global_x, e.global_y);
m_deltaX = static_cast<float>(e.delta_x);
m_deltaY = static_cast<float>(e.delta_y);
- m_charsToScrollPerDelta = 1;
- m_linesToScrollPerDelta = 1;
- m_pageXScrollMode = false;
- m_pageYScrollMode = false;
m_isAccepted = false;
+ m_granularity = ScrollByLineWheelEvent;
m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0;
m_ctrlKey = (e.modifiers & WebInputEvent::CTRL_KEY) != 0;
m_altKey = (e.modifiers & WebInputEvent::ALT_KEY) != 0;
m_metaKey = (e.modifiers & WebInputEvent::META_KEY) != 0;
- m_isContinuous = false;
- m_continuousDeltaX = 0;
- m_continuousDeltaY = 0;
}
// MakePlatformKeyboardEvent --------------------------------------------------
diff --git a/webkit/glue/glue_util.cc b/webkit/glue/glue_util.cc
index 7b609e04..5bbae41 100644
--- a/webkit/glue/glue_util.cc
+++ b/webkit/glue/glue_util.cc
@@ -101,7 +101,8 @@ GURL StringToGURL(const WebCore::String& spec) {
// Rect conversions ------------------------------------------------------------
gfx::Rect FromIntRect(const WebCore::IntRect& r) {
- return gfx::Rect(r.x(), r.y(), r.width(), r.height());
+ return gfx::Rect(r.x(), r.y(), r.width() < 0 ? 0 : r.width(),
+ r.height() < 0 ? 0 : r.height());
}
WebCore::IntRect ToIntRect(const gfx::Rect& r) {
diff --git a/webkit/glue/inspector_client_impl.cc b/webkit/glue/inspector_client_impl.cc
index b87afbb..dfc89fb 100644
--- a/webkit/glue/inspector_client_impl.cc
+++ b/webkit/glue/inspector_client_impl.cc
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
MSVC_PUSH_WARNING_LEVEL(0);
+#include "DOMWindow.h"
#include "FloatRect.h"
#include "InspectorController.h"
#include "Page.h"
diff --git a/webkit/glue/localized_strings.cc b/webkit/glue/localized_strings.cc
index 5bb66a5..cc3053f 100644
--- a/webkit/glue/localized_strings.cc
+++ b/webkit/glue/localized_strings.cc
@@ -98,6 +98,14 @@ String WebCore::AXImageMapText() {
String WebCore::AXHeadingText() {
return GetLocalizedString(IDS_AX_ROLE_HEADING);
}
+String WebCore::AXDefinitionListTermText() {
+ NOTIMPLEMENTED();
+ return String("term");
+}
+String WebCore::AXDefinitionListDefinitionText() {
+ NOTIMPLEMENTED();
+ return String("definition");
+}
String WebCore::AXButtonActionVerb() {
return GetLocalizedString(IDS_AX_BUTTON_ACTION_VERB);
}
diff --git a/webkit/glue/searchable_form_data.cc b/webkit/glue/searchable_form_data.cc
index cd0a88f..420c19a 100644
--- a/webkit/glue/searchable_form_data.cc
+++ b/webkit/glue/searchable_form_data.cc
@@ -268,24 +268,24 @@ WebCore::HTMLInputElement* GetTextElement(
text_element = static_cast<WebCore::HTMLInputElement*>(form_element);
}
for (int j = 0, max = static_cast<int>(lst.list().size()); j < max; ++j) {
- const WebCore::FormDataListItem& item = lst.list()[j];
+ const WebCore::FormDataList::Item& item = lst.list()[j];
// handle ISINDEX / <input name=isindex> special
// but only if its the first entry
- if (enc_string->isEmpty() && item.m_data == "isindex") {
+ if (enc_string->isEmpty() && item.data() == "isindex") {
if (form_element == text_element)
appendString(*enc_string, "{searchTerms}");
else
- appendEncodedString(*enc_string, (lst.list()[j + 1].m_data));
+ appendEncodedString(*enc_string, (lst.list()[j + 1].data()));
++j;
} else {
if (!enc_string->isEmpty())
enc_string->append('&');
- appendEncodedString(*enc_string, item.m_data);
+ appendEncodedString(*enc_string, item.data());
enc_string->append('=');
if (form_element == text_element)
appendString(*enc_string, "{searchTerms}");
else
- appendEncodedString(*enc_string, lst.list()[j + 1].m_data);
+ appendEncodedString(*enc_string, lst.list()[j + 1].data());
++j;
}
}
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index f9e9c5f..8875057 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -107,20 +107,19 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "HistoryItem.h"
#include "markup.h"
#include "Page.h"
-#include "PlatformScrollBar.h"
#include "RenderFrame.h"
#include "RenderWidget.h"
#include "ReplaceSelectionCommand.h"
#include "ResourceHandle.h"
#include "ResourceRequest.h"
#include "ScriptController.h"
+#include "ScrollbarTheme.h"
#include "SelectionController.h"
#include "Settings.h"
#include "SkiaUtils.h"
#include "SubstituteData.h"
#include "TextIterator.h"
#include "TextAffinity.h"
-#include "WidgetClientChromium.h"
#include "XPathResult.h"
MSVC_POP_WARNING();
@@ -174,7 +173,6 @@ using WebCore::HTMLFrameElementBase;
using WebCore::IntRect;
using WebCore::KURL;
using WebCore::Node;
-using WebCore::PlatformScrollbar;
using WebCore::Range;
using WebCore::ReloadIgnoringCacheData;
using WebCore::RenderObject;
@@ -187,9 +185,13 @@ using WebCore::String;
using WebCore::SubstituteData;
using WebCore::TextIterator;
using WebCore::VisiblePosition;
-using WebCore::WidgetClientChromium;
using WebCore::XPathResult;
+// TODO(darin): This used to be defined on WidgetClientChromium, but that
+// interface no longer exists. We'll need to come up with something better
+// once we figure out how to make tickmark support work again!
+static const size_t kNoTickmark = size_t(-1);
+
static const wchar_t* const kWebFrameActiveCount = L"WebFrameActiveCount";
static const char* const kOSDType = "application/opensearchdescription+xml";
@@ -286,7 +288,7 @@ MSVC_POP_WARNING()
margin_height_(-1),
inspected_node_(NULL),
active_tickmark_frame_(NULL),
- active_tickmark_(WidgetClientChromium::kNoTickmark),
+ active_tickmark_(kNoTickmark),
locating_active_rect_(false),
last_active_range_(NULL),
last_match_count_(-1),
@@ -536,7 +538,7 @@ void WebFrameImpl::LoadDocumentData(const KURL& base_url,
StopLoading();
// Reset any pre-existing scroll offset
- frameview()->setContentsPos(0, 0);
+ frameview()->setScrollPosition(WebCore::IntPoint());
// Make sure the correct document type is constructed.
frame_->loader()->setResponseMIMEType(mime_type);
@@ -754,23 +756,21 @@ void WebFrameImpl::InvalidateArea(AreaToInvalidate area) {
FrameView* view = frame()->view();
if ((area & INVALIDATE_ALL) == INVALIDATE_ALL) {
- view->addToDirtyRegion(view->frameGeometry());
+ view->invalidateRect(view->frameRect());
} else {
if ((area & INVALIDATE_CONTENT_AREA) == INVALIDATE_CONTENT_AREA) {
- IntRect content_area(view->x(),
- view->y(),
- view->visibleWidth(),
- view->visibleHeight());
- view->addToDirtyRegion(content_area);
+ IntRect content_area(
+ view->x(), view->y(), view->visibleWidth(), view->visibleHeight());
+ view->invalidateRect(content_area);
}
if ((area & INVALIDATE_SCROLLBAR) == INVALIDATE_SCROLLBAR) {
// Invalidate the vertical scroll bar region for the view.
- IntRect scroll_bar_vert(view->x() + view->visibleWidth(),
- view->y(),
- PlatformScrollbar::verticalScrollbarWidth(),
- view->visibleHeight());
- view->addToDirtyRegion(scroll_bar_vert);
+ IntRect scroll_bar_vert(
+ view->x() + view->visibleWidth(), view->y(),
+ WebCore::ScrollbarTheme::nativeTheme()->scrollbarThickness(),
+ view->visibleHeight());
+ view->invalidateRect(scroll_bar_vert);
}
}
#endif
@@ -783,8 +783,8 @@ void WebFrameImpl::InvalidateTickmark(RefPtr<WebCore::Range> tickmark) {
FrameView* view = frame()->view();
IntRect pos = tickmark->boundingBox();
- pos.move(-view->contentsX(), -view->contentsY());
- view->addToDirtyRegion(pos);
+ pos.move(-view->scrollX(), -view->scrollY());
+ view->invalidateRect(pos);
#endif
}
@@ -913,7 +913,7 @@ bool WebFrameImpl::FindNext(const FindInPageRequest& request,
WebFrameImpl* const active_frame = main_frame_impl->active_tickmark_frame_;
RefPtr<WebCore::Range> old_tickmark = NULL;
if (active_frame &&
- (active_frame->active_tickmark_ != WidgetClientChromium::kNoTickmark)) {
+ (active_frame->active_tickmark_ != kNoTickmark)) {
// When we get a reference to |old_tickmark| we can be in a state where
// the |active_tickmark_| points outside the tickmark vector, possibly
// during teardown of the frame. This doesn't reproduce normally, so if you
@@ -929,7 +929,7 @@ bool WebFrameImpl::FindNext(const FindInPageRequest& request,
// See if we have another match to select, and select it.
if (request.forward) {
const bool at_end = (active_tickmark_ == (tickmarks_.size() - 1));
- if ((active_tickmark_ == WidgetClientChromium::kNoTickmark) ||
+ if ((active_tickmark_ == kNoTickmark) ||
(at_end && wrap_within_frame)) {
// Wrapping within a frame is only done for single frame pages. So when we
// reach the end we go back to the beginning (or back to the end if
@@ -943,7 +943,7 @@ bool WebFrameImpl::FindNext(const FindInPageRequest& request,
}
} else {
const bool at_end = (active_tickmark_ == 0);
- if ((active_tickmark_ == WidgetClientChromium::kNoTickmark) ||
+ if ((active_tickmark_ == kNoTickmark) ||
(at_end && wrap_within_frame)) {
// Wrapping within a frame is not done for multi-frame pages, but if no
// tickmark is active we still need to set the index to the end so that
@@ -960,7 +960,7 @@ bool WebFrameImpl::FindNext(const FindInPageRequest& request,
if (active_frame != this) {
// If we are jumping between frames, reset the active tickmark in the old
// frame and invalidate the area.
- active_frame->active_tickmark_ = WidgetClientChromium::kNoTickmark;
+ active_frame->active_tickmark_ = kNoTickmark;
active_frame->InvalidateArea(INVALIDATE_CONTENT_AREA);
main_frame_impl->active_tickmark_frame_ = this;
} else {
@@ -1250,7 +1250,7 @@ void WebFrameImpl::ScopeStringMatches(FindInPageRequest request,
void WebFrameImpl::CancelPendingScopingEffort() {
scope_matches_factory_.RevokeAll();
- active_tickmark_ = WidgetClientChromium::kNoTickmark;
+ active_tickmark_ = kNoTickmark;
}
void WebFrameImpl::SetFindEndstateFocusAndSelection() {
@@ -1258,7 +1258,7 @@ void WebFrameImpl::SetFindEndstateFocusAndSelection() {
static_cast<WebFrameImpl*>(GetView()->GetMainFrame());
if (this == main_frame_impl->active_tickmark_frame() &&
- active_tickmark_ != WidgetClientChromium::kNoTickmark) {
+ active_tickmark_ != kNoTickmark) {
RefPtr<Range> range = tickmarks_[active_tickmark_];
// Set the selection to what the active match is.
@@ -1424,54 +1424,39 @@ void WebFrameImpl::CreateFrameView() {
DCHECK(page->mainFrame() != NULL);
-#if defined(OS_WIN)
- // TODO(pinkerton): figure out view show/hide like win
- // Detach the current view. This ensures that UI widgets like plugins,
- // etc are detached(hidden)
- if (frame_->view())
- frame_->view()->detachFromWindow();
-#endif
+ bool is_main_frame = frame_ == page->mainFrame();
+ if (is_main_frame && frame_->view())
+ frame_->view()->setParentVisible(false);
frame_->setView(0);
- WebCore::FrameView* view = new FrameView(frame_.get());
+ WebCore::FrameView* view;
+ if (is_main_frame) {
+ IntSize initial_size(
+ webview_impl_->size().width(), webview_impl_->size().height());
+ view = new FrameView(frame_.get(), initial_size);
+ } else {
+ view = new FrameView(frame_.get());
+ }
frame_->setView(view);
-#if defined(OS_WIN)
- // Attaching the view ensures that UI widgets like plugins, display/hide
- // correctly.
- frame_->view()->attachToWindow();
-#endif
-
- if (margin_width_ >= 0)
- view->setMarginWidth(margin_width_);
- if (margin_height_ >= 0)
- view->setMarginHeight(margin_height_);
- if (!allows_scrolling_)
- view->setScrollbarsMode(WebCore::ScrollbarAlwaysOff);
-
// TODO(darin): The Mac code has a comment about this possibly being
// unnecessary. See installInFrame in WebCoreFrameBridge.mm
if (frame_->ownerRenderer())
frame_->ownerRenderer()->setWidget(view);
- view->initScrollbars();
+ if (HTMLFrameOwnerElement* owner = frame_->ownerElement()) {
+ view->setCanHaveScrollbars(
+ owner->scrollingMode() != WebCore::ScrollbarAlwaysOff);
+ }
+
+ if (is_main_frame)
+ view->setParentVisible(true);
// FrameViews are created with a refcount of 1 so it needs releasing after we
// assign it to a RefPtr.
view->deref();
-
- WebFrameImpl* parent = static_cast<WebFrameImpl*>(GetParent());
- if (parent) {
- parent->frameview()->addChild(view);
- } else {
- view->setClient(webview_impl_);
-
- IntRect geom(0, 0, webview_impl_->size().width(),
- webview_impl_->size().height());
- view->setFrameGeometry(geom);
- }
}
// static
@@ -1799,10 +1784,7 @@ gfx::Size WebFrameImpl::ScrollOffset() const {
void WebFrameImpl::SetAllowsScrolling(bool flag) {
allows_scrolling_ = flag;
-#if defined(OS_WIN)
- // TODO(pinkerton): fix when we figure out scrolling apis
- frame_->view()->setAllowsScrolling(flag);
-#endif
+ frame_->view()->setCanHaveScrollbars(flag);
}
bool WebFrameImpl::SetPrintingMode(bool printing,
@@ -1817,9 +1799,11 @@ bool WebFrameImpl::SetPrintingMode(bool printing,
}
printing_ = printing;
if (printing) {
- view->setScrollbarsMode(WebCore::ScrollbarAlwaysOff);
+ view->setScrollbarModes(WebCore::ScrollbarAlwaysOff,
+ WebCore::ScrollbarAlwaysOff);
} else {
- view->setScrollbarsMode(WebCore::ScrollbarAuto);
+ view->setScrollbarModes(WebCore::ScrollbarAuto,
+ WebCore::ScrollbarAuto);
}
DCHECK_EQ(frame()->isFrameSet(), false);
@@ -1862,7 +1846,7 @@ void WebFrameImpl::GetPageRect(int page, gfx::Rect* page_size) const {
}
bool WebFrameImpl::SpoolPage(int page,
- PlatformContextSkia* context) {
+ PlatformContextSkia* context) {
// Ensure correct state.
if (!context ||
!printing_ ||
@@ -1881,7 +1865,7 @@ bool WebFrameImpl::SpoolPage(int page,
DCHECK(pages_[page].x() == 0);
// Offset to get the right square.
spool.translate(0, -static_cast<float>(pages_[page].y()));
- frame()->paint(&spool, pages_[page]);
+ frame()->view()->paint(&spool, pages_[page]);
return true;
}
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index 36d7fc6..0251409 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -118,10 +118,6 @@ NPObject* WebPluginContainer::GetPluginScriptableObject() {
return impl_->GetPluginScriptableObject();
}
-WebCore::IntRect WebPluginContainer::windowClipRect() const {
- return impl_->windowClipRect();
-}
-
#if USE(JSC)
bool WebPluginContainer::isPluginView() const {
return true;
@@ -129,13 +125,9 @@ bool WebPluginContainer::isPluginView() const {
#endif
-void WebPluginContainer::geometryChanged() const {
- impl_->geometryChanged();
-}
-
-void WebPluginContainer::setFrameGeometry(const WebCore::IntRect& rect) {
- WebCore::Widget::setFrameGeometry(rect);
- impl_->setFrameGeometry(rect);
+void WebPluginContainer::setFrameRect(const WebCore::IntRect& rect) {
+ WebCore::Widget::setFrameRect(rect);
+ impl_->setFrameRect(rect);
}
void WebPluginContainer::paint(WebCore::GraphicsContext* gc,
@@ -146,6 +138,18 @@ void WebPluginContainer::paint(WebCore::GraphicsContext* gc,
impl_->paint(gc, damage_rect);
}
+void WebPluginContainer::invalidateRect(const WebCore::IntRect& rect) {
+ if (parent()) {
+ WebCore::IntRect damageRect = convertToContainingWindow(rect);
+
+ // Get our clip rect and intersect with it to ensure we don't invalidate too much.
+ WebCore::IntRect clipRect = parent()->windowClipRect();
+ damageRect.intersect(clipRect);
+
+ parent()->hostWindow()->repaint(damageRect, true);
+ }
+}
+
void WebPluginContainer::setFocus() {
WebCore::Widget::setFocus();
impl_->setFocus();
@@ -164,7 +168,7 @@ void WebPluginContainer::show() {
WebCore::Widget::show();
// This is to force an updategeometry call to the plugin process
// where the plugin window can be hidden or shown.
- geometryChanged();
+ frameRectsChanged();
}
}
@@ -176,7 +180,7 @@ void WebPluginContainer::hide() {
WebCore::Widget::hide();
// This is to force an updategeometry call to the plugin process
// where the plugin window can be hidden or shown.
- geometryChanged();
+ frameRectsChanged();
}
}
@@ -184,16 +188,6 @@ void WebPluginContainer::handleEvent(WebCore::Event* event) {
impl_->handleEvent(event);
}
-void WebPluginContainer::attachToWindow() {
- Widget::attachToWindow();
- show();
-}
-
-void WebPluginContainer::detachFromWindow() {
- Widget::detachFromWindow();
- hide();
-}
-
void WebPluginContainer::windowCutoutRects(const WebCore::IntRect& bounds,
WTF::Vector<WebCore::IntRect>*
cutouts) const {
@@ -602,11 +596,11 @@ void WebPluginImpl::geometryChanged() const {
// This is a hack to tickle re-positioning of the plugin in the case where
// our parent view was scrolled.
- const_cast<WebPluginImpl*>(this)->widget_->setFrameGeometry(
- widget_->frameGeometry());
+ const_cast<WebPluginImpl*>(this)->widget_->setFrameRect(
+ widget_->frameRect());
}
-void WebPluginImpl::setFrameGeometry(const WebCore::IntRect& rect) {
+void WebPluginImpl::setFrameRect(const WebCore::IntRect& rect) {
// Compute a new position and clip rect for ourselves relative to the
// containing window. We ask our delegate to reposition us accordingly.
@@ -679,7 +673,7 @@ void WebPluginImpl::paint(WebCore::GraphicsContext* gc,
return;
// Don't paint anything if the plugin doesn't intersect the damage rect.
- if (!widget_->frameGeometry().intersects(damage_rect))
+ if (!widget_->frameRect().intersects(damage_rect))
return;
// A windowed plugin starts out by being invisible regardless of the style
@@ -697,7 +691,7 @@ void WebPluginImpl::paint(WebCore::GraphicsContext* gc,
WebCore::IntRect clip_rect;
std::vector<gfx::Rect> cutout_rects;
- CalculateBounds(widget_->frameGeometry(), &window_rect, &clip_rect,
+ CalculateBounds(widget_->frameRect(), &window_rect, &clip_rect,
&cutout_rects);
delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect),
@@ -1111,7 +1105,7 @@ void WebPluginImpl::CalculateBounds(const WebCore::IntRect& frame_rect,
WebCore::IntRect(view->contentsToWindow(frame_rect.location()),
frame_rect.size());
// Calculate a clip-rect so that we don't overlap the scrollbars, etc.
- *clip_rect = widget_->windowClipRect();
+ *clip_rect = windowClipRect();
clip_rect->move(-window_rect->x(), -window_rect->y());
cutout_rects->clear();
diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h
index b5473c5..77e0100 100644
--- a/webkit/glue/webplugin_impl.h
+++ b/webkit/glue/webplugin_impl.h
@@ -55,16 +55,16 @@ class WebPluginContainer : public WebCore::Widget {
WebPluginContainer(WebPluginImpl* impl);
virtual ~WebPluginContainer();
NPObject* GetPluginScriptableObject();
- virtual WebCore::IntRect windowClipRect() const;
- virtual void geometryChanged() const;
- virtual void setFrameGeometry(const WebCore::IntRect& rect);
+
+ // Widget methods:
+ virtual void setFrameRect(const WebCore::IntRect& rect);
virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& rect);
+ virtual void invalidateRect(const WebCore::IntRect&);
virtual void setFocus();
virtual void show();
virtual void hide();
virtual void handleEvent(WebCore::Event* event);
- virtual void attachToWindow();
- virtual void detachFromWindow();
+ virtual void frameRectsChanged() const {}
#if USE(JSC)
virtual bool isPluginView() const;
@@ -203,7 +203,7 @@ class WebPluginImpl : public WebPlugin,
// Override for when our window changes size or position.
// Used to notify the plugin when the size or position changes.
- virtual void setFrameGeometry(const WebCore::IntRect& rect);
+ virtual void setFrameRect(const WebCore::IntRect& rect);
// Overrides paint so we can notify the underlying widget to repaint.
virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& rect);
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 8dfb3f5..7c5ecac 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -686,13 +686,13 @@ void WebViewImpl::Layout() {
// they need to be told that we are updating the screen. The problem is
// that the native widgets need to recalculate their clip region and not
// overlap any of our non-native widgets. To force the resizing, call
- // setFrameGeometry(). This will be a quick operation for most frames, but
+ // setFrameRect(). This will be a quick operation for most frames, but
// the NativeWindowWidgets will update a proper clipping region.
FrameView* frameview = main_frame_->frameview();
if (frameview)
- frameview->setFrameGeometry(frameview->frameGeometry());
+ frameview->setFrameRect(frameview->frameRect());
- // setFrameGeometry may have the side-effect of causing existing page
+ // setFrameRect may have the side-effect of causing existing page
// layout to be invalidated, so layout needs to be called last.
main_frame_->Layout();
@@ -1126,6 +1126,9 @@ void WebViewImpl::SetPreferences(const WebPreferences& preferences) {
settings->setFontRenderingMode(NormalRenderingMode);
settings->setJavaEnabled(preferences.java_enabled);
+ // Turn this on to cause WebCore to paint the resize corner for us.
+ settings->setShouldPaintCustomScrollbars(true);
+
#if defined(OS_WIN)
// RenderTheme is a singleton that needs to know the default font size to
// draw some form controls. We let it know each time the size changes.
@@ -1372,54 +1375,12 @@ void WebViewImpl::ImageResourceDownloadDone(ImageResourceFetcher* fetcher,
//-----------------------------------------------------------------------------
// WebCore::WidgetClientWin
+// TODO(darin): Figure out what to do with these methods.
+#if 0
gfx::ViewHandle WebViewImpl::containingWindow() {
return delegate_ ? delegate_->GetContainingWindow(this) : NULL;
}
-void WebViewImpl::invalidateRect(const IntRect& damaged_rect) {
- if (delegate_)
- delegate_->DidInvalidateRect(this, gfx::Rect(damaged_rect.x(),
- damaged_rect.y(),
- damaged_rect.width(),
- damaged_rect.height()));
-}
-
-void WebViewImpl::scrollRect(int dx, int dy, const IntRect& clip_rect) {
- if (delegate_)
- delegate_->DidScrollRect(this, dx, dy, gfx::Rect(clip_rect.x(),
- clip_rect.y(),
- clip_rect.width(),
- clip_rect.height()));
-}
-
-void WebViewImpl::popupOpened(WebCore::Widget* widget,
- const WebCore::IntRect& bounds) {
- if (!delegate_)
- return;
-
- WebWidgetImpl* webwidget =
- static_cast<WebWidgetImpl*>(delegate_->CreatePopupWidget(this));
- webwidget->Init(widget, gfx::Rect(bounds.x(), bounds.y(),
- bounds.width(), bounds.height()));
-}
-
-void WebViewImpl::popupClosed(WebCore::Widget* widget) {
- NOTREACHED() << "popupClosed called on a non-popup";
-}
-
-void WebViewImpl::setCursor(const WebCore::Cursor& cursor) {
-#if defined(OS_WIN)
- // TODO(pinkerton): figure out the cursor delegate methods
- if (delegate_)
- delegate_->SetCursor(this, cursor.impl());
-#endif
-}
-
-void WebViewImpl::setFocus() {
- if (delegate_)
- delegate_->Focus(this);
-}
-
const SkBitmap* WebViewImpl::getPreloadedResourceBitmap(int resource_id) {
if (!delegate_)
return NULL;
@@ -1462,6 +1423,7 @@ bool WebViewImpl::isHidden() {
return delegate_->IsHidden();
}
+#endif
//-----------------------------------------------------------------------------
// WebCore::BackForwardListClient
diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h
index 0e09bf9..e4ec4b4 100644
--- a/webkit/glue/webview_impl.h
+++ b/webkit/glue/webview_impl.h
@@ -18,8 +18,7 @@
#include "webkit/glue/webview.h"
MSVC_PUSH_WARNING_LEVEL(0);
-#include "webkit/port/history/BackForwardList.h"
-#include "webkit/port/platform/chromium/WidgetClientChromium.h"
+#include "BackForwardList.h"
MSVC_POP_WARNING();
namespace WebCore {
@@ -41,9 +40,7 @@ class WebMouseEvent;
class WebMouseWheelEvent;
class WebViewDelegate;
-class WebViewImpl : public WebView,
- public WebCore::WidgetClientChromium,
- public WebCore::BackForwardListClient {
+class WebViewImpl : public WebView, public WebCore::BackForwardListClient {
public:
// WebView
virtual bool ShouldClose();
@@ -189,21 +186,17 @@ class WebViewImpl : public WebView,
WebCore::Frame* frame,
const WebCore::PlatformKeyboardEvent& e);
+ // TODO(darin): Figure out what happens to these methods.
+#if 0
// WebCore::WidgetClientWin
virtual gfx::ViewHandle containingWindow();
- virtual void invalidateRect(const WebCore::IntRect& damaged_rect);
- virtual void scrollRect(int dx, int dy, const WebCore::IntRect& clip_rect);
- virtual void popupOpened(WebCore::Widget* widget,
- const WebCore::IntRect& bounds);
- virtual void popupClosed(WebCore::Widget* widget);
- virtual void setCursor(const WebCore::Cursor& cursor);
- virtual void setFocus();
virtual const SkBitmap* getPreloadedResourceBitmap(int resource_id);
virtual void onScrollPositionChanged(WebCore::Widget* widget);
virtual const WTF::Vector<RefPtr<WebCore::Range> >* getTickmarks(
WebCore::Frame* frame);
virtual size_t getActiveTickmarkIndex(WebCore::Frame* frame);
virtual bool isHidden();
+#endif
// WebCore::BackForwardListClient
virtual void didAddHistoryItem(WebCore::HistoryItem* item);
diff --git a/webkit/glue/webwidget_impl.cc b/webkit/glue/webwidget_impl.cc
index 381c4b8..c04bedb 100644
--- a/webkit/glue/webwidget_impl.cc
+++ b/webkit/glue/webwidget_impl.cc
@@ -22,6 +22,7 @@ MSVC_POP_WARNING();
#include "base/gfx/rect.h"
#include "base/logging.h"
#include "webkit/glue/event_conversion.h"
+#include "webkit/glue/glue_util.h"
#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webwidget_delegate.h"
#include "webkit/glue/webwidget_impl.h"
@@ -45,15 +46,13 @@ WebWidgetImpl::WebWidgetImpl(WebWidgetDelegate* delegate)
}
WebWidgetImpl::~WebWidgetImpl() {
- if (widget_) {
+ if (widget_)
widget_->setClient(NULL);
- }
}
-void WebWidgetImpl::Init(WebCore::Widget* widget, const gfx::Rect& bounds) {
- DCHECK(widget->isFrameView());
- widget_ = static_cast<FramelessScrollView*>(widget);
-
+void WebWidgetImpl::Init(WebCore::FramelessScrollView* widget,
+ const gfx::Rect& bounds) {
+ widget_ = widget;
widget_->setClient(this);
if (delegate_) {
@@ -109,7 +108,7 @@ void WebWidgetImpl::Resize(const gfx::Size& new_size) {
if (widget_) {
IntRect new_geometry(0, 0, size_.width(), size_.height());
- widget_->setFrameGeometry(new_geometry);
+ widget_->setFrameRect(new_geometry);
}
if (delegate_) {
@@ -197,51 +196,47 @@ bool WebWidgetImpl::ImeUpdateStatus(bool* enable_ime, const void** id,
return false;
}
-const SkBitmap* WebWidgetImpl::getPreloadedResourceBitmap(int resource_id) {
- return NULL;
-}
-
-const WTF::Vector<RefPtr<WebCore::Range> >* WebWidgetImpl::getTickmarks(
- WebCore::Frame* frame) {
- return NULL;
-}
+//-----------------------------------------------------------------------------
+// WebCore::HostWindow
-size_t WebWidgetImpl::getActiveTickmarkIndex(WebCore::Frame* frame) {
- return kNoTickmark;
+void WebWidgetImpl::repaint(const WebCore::IntRect& paint_rect,
+ bool content_changed,
+ bool immediate,
+ bool repaint_content_only) {
+ if (delegate_)
+ delegate_->DidInvalidateRect(this, webkit_glue::FromIntRect(paint_rect));
}
-void WebWidgetImpl::onScrollPositionChanged(Widget* widget) {
+void WebWidgetImpl::scroll(const WebCore::IntSize& scroll_delta,
+ const WebCore::IntRect& scroll_rect,
+ const WebCore::IntRect& clip_rect) {
+ if (delegate_) {
+ int dx = scroll_delta.width();
+ int dy = scroll_delta.height();
+ delegate_->DidScrollRect(this, dx, dy, webkit_glue::FromIntRect(clip_rect));
+ }
}
-//-----------------------------------------------------------------------------
-// WebCore::WidgetClientWin
-
-gfx::ViewHandle WebWidgetImpl::containingWindow() {
- return delegate_ ? delegate_->GetContainingWindow(this) : NULL;
+WebCore::IntPoint WebWidgetImpl::screenToWindow(
+ const WebCore::IntPoint& point) const {
+ NOTIMPLEMENTED();
+ return WebCore::IntPoint();
}
-void WebWidgetImpl::invalidateRect(const IntRect& damaged_rect) {
- if (delegate_)
- delegate_->DidInvalidateRect(this, gfx::Rect(damaged_rect.x(),
- damaged_rect.y(),
- damaged_rect.width(),
- damaged_rect.height()));
+WebCore::IntRect WebWidgetImpl::windowToScreen(
+ const WebCore::IntRect& rect) const {
+ NOTIMPLEMENTED();
+ return WebCore::IntRect();
}
-void WebWidgetImpl::scrollRect(int dx, int dy, const IntRect& clip_rect) {
- if (delegate_)
- delegate_->DidScrollRect(this, dx, dy, gfx::Rect(clip_rect.x(),
- clip_rect.y(),
- clip_rect.width(),
- clip_rect.height()));
+PlatformWidget WebWidgetImpl::platformWindow() const {
+ return NULL;
}
-void WebWidgetImpl::popupOpened(WebCore::Widget* widget,
- const WebCore::IntRect& bounds) {
- NOTREACHED() << "popupOpened called on a popup";
-}
+//-----------------------------------------------------------------------------
+// WebCore::FramelessScrollViewClient
-void WebWidgetImpl::popupClosed(WebCore::Widget* widget) {
+void WebWidgetImpl::popupClosed(WebCore::FramelessScrollView* widget) {
DCHECK(widget == widget_);
if (widget_) {
widget_->setClient(NULL);
@@ -250,16 +245,29 @@ void WebWidgetImpl::popupClosed(WebCore::Widget* widget) {
delegate_->CloseWidgetSoon(this);
}
-void WebWidgetImpl::setCursor(const WebCore::Cursor& cursor) {
-#if defined(OS_WIN)
- // TODO(pinkerton): re-enable when WebCursor is ported
- if (delegate_)
- delegate_->SetCursor(this, cursor.impl());
-#endif
+//-----------------------------------------------------------------------------
+// WebCore::WidgetClientWin
+
+// TODO(darin): Figure out what happens to these methods.
+#if 0
+gfx::ViewHandle WebWidgetImpl::containingWindow() {
+ return delegate_ ? delegate_->GetContainingWindow(this) : NULL;
}
-void WebWidgetImpl::setFocus() {
- delegate_->Focus(this);
+const SkBitmap* WebWidgetImpl::getPreloadedResourceBitmap(int resource_id) {
+ return NULL;
+}
+
+void WebWidgetImpl::onScrollPositionChanged(Widget* widget) {
+}
+
+const WTF::Vector<RefPtr<WebCore::Range> >* WebWidgetImpl::getTickmarks(
+ WebCore::Frame* frame) {
+ return NULL;
+}
+
+size_t WebWidgetImpl::getActiveTickmarkIndex(WebCore::Frame* frame) {
+ return kNoTickmark;
}
bool WebWidgetImpl::isHidden() {
@@ -268,3 +276,4 @@ bool WebWidgetImpl::isHidden() {
return delegate_->IsHidden();
}
+#endif
diff --git a/webkit/glue/webwidget_impl.h b/webkit/glue/webwidget_impl.h
index 32bcbde..288485f 100644
--- a/webkit/glue/webwidget_impl.h
+++ b/webkit/glue/webwidget_impl.h
@@ -12,9 +12,7 @@
#include "base/gfx/size.h"
#include "webkit/glue/webwidget.h"
-MSVC_PUSH_WARNING_LEVEL(0);
-#include "WidgetClientChromium.h"
-MSVC_POP_WARNING();
+#include "FramelessScrollViewClient.h"
namespace WebCore {
class Frame;
@@ -31,7 +29,8 @@ class WebMouseEvent;
class WebMouseWheelEvent;
class WebWidgetDelegate;
-class WebWidgetImpl : public WebWidget, public WebCore::WidgetClientChromium {
+class WebWidgetImpl : public WebWidget,
+ public WebCore::FramelessScrollViewClient {
public:
// WebWidget
virtual void Close();
@@ -50,7 +49,7 @@ class WebWidgetImpl : public WebWidget, public WebCore::WidgetClientChromium {
int* x, int* y);
// WebWidgetImpl
- void Init(WebCore::Widget* widget, const gfx::Rect& bounds);
+ void Init(WebCore::FramelessScrollView* widget, const gfx::Rect& bounds);
const gfx::Size& size() const { return size_; }
@@ -72,21 +71,32 @@ class WebWidgetImpl : public WebWidget, public WebCore::WidgetClientChromium {
WebWidgetImpl(WebWidgetDelegate* delegate);
~WebWidgetImpl();
+ // WebCore::HostWindow methods:
+ virtual void repaint(const WebCore::IntRect&,
+ bool content_changed,
+ bool immediate = false,
+ bool repaint_content_only = false);
+ virtual void scroll(const WebCore::IntSize& scroll_delta,
+ const WebCore::IntRect& scroll_rect,
+ const WebCore::IntRect& clip_rect);
+ virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
+ virtual PlatformWidget platformWindow() const;
+
+ // WebCore::FramelessScrollViewClient methods:
+ virtual void popupClosed(WebCore::FramelessScrollView* popup_view);
+
+ // TODO(darin): Figure out what happens to these methods.
+#if 0
// WebCore::WidgetClientWin
virtual gfx::ViewHandle containingWindow();
- virtual void invalidateRect(const WebCore::IntRect& damaged_rect);
- virtual void scrollRect(int dx, int dy, const WebCore::IntRect& clip_rect);
- virtual void popupOpened(WebCore::Widget* widget,
- const WebCore::IntRect& bounds);
- virtual void popupClosed(WebCore::Widget* widget);
- virtual void setCursor(const WebCore::Cursor& cursor);
- virtual void setFocus();
virtual const SkBitmap* getPreloadedResourceBitmap(int resource_id);
virtual void onScrollPositionChanged(WebCore::Widget* widget);
virtual const WTF::Vector<RefPtr<WebCore::Range> >* getTickmarks(
WebCore::Frame* frame);
virtual size_t getActiveTickmarkIndex(WebCore::Frame* frame);
virtual bool isHidden();
+#endif
WebWidgetDelegate* delegate_;
gfx::Size size_;