Commit 45b37cda authored by hyatt's avatar hyatt

Scrolling work.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 43bf1f0a
2006-10-03 Dave Hyatt <hyatt@apple.com>
Scrolling work. Eliminate convertTo/FromContainingWindow as cross-platform functions. Add back in
the windowToContents/contentsToWindow functions.
Reviewed by anders
* bridge/mac/FrameMac.mm:
(WebCore::FrameMac::eventMayStartDrag):
(WebCore::FrameMac::dragHysteresisExceeded):
(WebCore::FrameMac::mouseDown):
(WebCore::FrameMac::shouldDragAutoNode):
(WebCore::FrameMac::sendContextMenuEvent):
* bridge/mac/FrameViewMac.mm:
(WebCore::FrameView::passMousePressEventToScrollbar):
* bridge/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge _visiblePositionForPoint:]):
* dom/EventTargetNode.cpp:
(WebCore::EventTargetNode::dispatchMouseEvent):
(WebCore::EventTargetNode::dispatchWheelEvent):
* page/Frame.cpp:
(WebCore::Frame::selectClosestWordFromMouseEvent):
(WebCore::Frame::handleMousePressEventTripleClick):
(WebCore::Frame::handleMousePressEventSingleClick):
(WebCore::Frame::handleMouseMoveEvent):
(WebCore::Frame::handleMouseReleaseEvent):
* page/FrameView.cpp:
(WebCore::FrameView::handleMousePressEvent):
(WebCore::FrameView::handleMouseDoubleClickEvent):
(WebCore::selectCursor):
(WebCore::FrameView::handleMouseMoveEvent):
(WebCore::FrameView::handleMouseReleaseEvent):
(WebCore::FrameView::dispatchDragEvent):
(WebCore::FrameView::prepareMouseEvent):
(WebCore::FrameView::handleWheelEvent):
* page/FrameView.h:
* platform/ScrollBar.cpp:
(WebCore::ScrollBar::setValue):
* platform/ScrollView.h:
* platform/Widget.h:
(WebCore::Widget::scrolled):
* platform/mac/ScrollViewMac.mm:
(WebCore::ScrollView::contentsToWindow):
(WebCore::ScrollView::windowToContents):
(WebCore::ScrollView::scrollbarUnderMouse):
* platform/mac/WidgetMac.mm:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::resize):
(WebCore::RenderLayer::positionScrollbars):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
* rendering/RenderView.cpp:
* rendering/RenderView.h:
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::setWidget):
2006-09-26 David Smith <catfish.man@gmail.com>
Reviewed by Timothy.
......@@ -1572,7 +1572,7 @@ bool FrameMac::eventMayStartDrag(NSEvent *event) const
}
NSPoint loc = [event locationInWindow];
IntPoint mouseDownPos = d->m_view->convertFromContainingWindow(IntPoint(loc));
IntPoint mouseDownPos = d->m_view->windowToContents(IntPoint(loc));
RenderObject::NodeInfo nodeInfo(true, false);
renderer()->layer()->hitTest(nodeInfo, mouseDownPos);
bool srcIsDHTML;
......@@ -1591,7 +1591,7 @@ const float TextDragDelay = 0.15;
bool FrameMac::dragHysteresisExceeded(float dragLocationX, float dragLocationY) const
{
IntPoint dragViewportLocation((int)dragLocationX, (int)dragLocationY);
IntPoint dragLocation = d->m_view->convertFromContainingWindow(dragViewportLocation);
IntPoint dragLocation = d->m_view->windowToContents(dragViewportLocation);
IntSize delta = dragLocation - m_mouseDownPos;
float threshold = GeneralDragHysteresis;
......@@ -1976,7 +1976,7 @@ void FrameMac::mouseDown(NSEvent *event)
_currentEvent = HardRetain(event);
m_mouseDown = PlatformMouseEvent(event);
NSPoint loc = [event locationInWindow];
m_mouseDownPos = d->m_view->convertFromContainingWindow(IntPoint(loc));
m_mouseDownPos = d->m_view->windowToContents(IntPoint(loc));
_mouseDownTimestamp = [event timestamp];
_mouseDownMayStartDrag = false;
......@@ -2137,7 +2137,7 @@ bool FrameMac::shouldDragAutoNode(Node* node, const IntPoint& point) const
// the node hierarchy, and we also don't have to cook up a way to ask WK about non-leaf nodes
// (since right now WK just hit-tests using a cached lastMouseDown).
if (!node->hasChildNodes() && d->m_view) {
NSPoint eventLoc = d->m_view->convertToContainingWindow(point);
NSPoint eventLoc = d->m_view->contentsToWindow(point);
return [_bridge mayStartDragAtEventLocation:eventLoc];
} else
return NO;
......@@ -2158,7 +2158,7 @@ bool FrameMac::sendContextMenuEvent(NSEvent *event)
PlatformMouseEvent mouseEvent(event);
IntPoint viewportPos = v->convertFromContainingWindow(mouseEvent.pos());
IntPoint viewportPos = v->windowToContents(mouseEvent.pos());
MouseEventWithHitTestResults mev = doc->prepareMouseEvent(false, true, false, viewportPos, mouseEvent);
swallowEvent = v->dispatchMouseEvent(contextmenuEvent, mev.targetNode(), true, 0, mouseEvent, true);
......
......@@ -74,9 +74,9 @@ bool FrameView::passWheelEventToSubframe(PlatformWheelEvent&, Frame* subframe)
return Mac(m_frame.get())->passWheelEventToWidget(subframe->view());
}
bool FrameView::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev)
bool FrameView::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev, PlatformScrollBar* scrollbar)
{
return Mac(m_frame.get())->passMouseDownEventToWidget(mev.scrollbar());
return Mac(m_frame.get())->passMouseDownEventToWidget(scrollbar);
}
}
......@@ -2100,7 +2100,7 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
return VisiblePosition();
FrameView* outerView = m_frame->view();
FrameView* innerView = node->document()->view();
IntPoint innerPoint = innerView->convertFromContainingWindow(outerView->convertToContainingWindow(outerPoint));
IntPoint innerPoint = innerView->windowToContents(outerView->contentsToWindow(outerPoint));
return renderer->positionForCoordinates(innerPoint.x(), innerPoint.y());
}
......
......@@ -368,7 +368,7 @@ bool EventTargetNode::dispatchMouseEvent(const PlatformMouseEvent& _mouse, const
IntPoint contentsPos;
if (FrameView* view = document()->view())
contentsPos = view->convertFromContainingWindow(_mouse.pos());
contentsPos = view->windowToContents(_mouse.pos());
return dispatchMouseEvent(eventType, _mouse.button(), detail,
contentsPos.x(), contentsPos.y(), _mouse.globalX(), _mouse.globalY(),
......@@ -453,7 +453,7 @@ void EventTargetNode::dispatchWheelEvent(PlatformWheelEvent& e)
if (!view)
return;
IntPoint pos = view->convertFromContainingWindow(e.pos());
IntPoint pos = view->windowToContents(e.pos());
RefPtr<WheelEvent> we = new WheelEvent(e.deltaX(), e.deltaY(),
document()->defaultView(), e.globalX(), e.globalY(), pos.x(), pos.y(),
......
......@@ -1813,7 +1813,7 @@ void Frame::selectClosestWordFromMouseEvent(const PlatformMouseEvent& mouse, Nod
Selection newSelection;
if (innerNode && innerNode->renderer() && mouseDownMayStartSelect() && innerNode->renderer()->shouldSelect()) {
IntPoint vPoint = view()->convertFromContainingWindow(mouse.pos());
IntPoint vPoint = view()->windowToContents(mouse.pos());
VisiblePosition pos(innerNode->renderer()->positionForPoint(vPoint));
if (pos.isNotNull()) {
newSelection = Selection(pos);
......@@ -1852,7 +1852,7 @@ void Frame::handleMousePressEventTripleClick(const MouseEventWithHitTestResults&
if (event.event().button() == LeftButton && innerNode && innerNode->renderer() &&
mouseDownMayStartSelect() && innerNode->renderer()->shouldSelect()) {
Selection newSelection;
IntPoint vPoint = view()->convertFromContainingWindow(event.event().pos());
IntPoint vPoint = view()->windowToContents(event.event().pos());
VisiblePosition pos(innerNode->renderer()->positionForPoint(vPoint));
if (pos.isNotNull()) {
newSelection = Selection(pos);
......@@ -1881,7 +1881,7 @@ void Frame::handleMousePressEventSingleClick(const MouseEventWithHitTestResults&
// Don't restart the selection when the mouse is pressed on an
// existing selection so we can allow for text dragging.
IntPoint vPoint = view()->convertFromContainingWindow(event.event().pos());
IntPoint vPoint = view()->windowToContents(event.event().pos());
if (!extendSelection && isPointInsideSelection(vPoint))
return;
......@@ -1954,7 +1954,7 @@ void Frame::handleMouseMoveEvent(const MouseEventWithHitTestResults& event)
// handle making selection
IntPoint vPoint = view()->convertFromContainingWindow(event.event().pos());
IntPoint vPoint = view()->windowToContents(event.event().pos());
VisiblePosition pos(innerNode->renderer()->positionForPoint(vPoint));
// Don't modify the selection if we're not on a node.
......@@ -1996,7 +1996,7 @@ void Frame::handleMouseReleaseEvent(const MouseEventWithHitTestResults& event)
Selection newSelection;
Node *node = event.targetNode();
if (node && node->isContentEditable() && node->renderer()) {
IntPoint vPoint = view()->convertFromContainingWindow(event.event().pos());
IntPoint vPoint = view()->windowToContents(event.event().pos());
VisiblePosition pos = node->renderer()->positionForPoint(vPoint);
newSelection = Selection(pos);
}
......
......@@ -587,7 +587,7 @@ void FrameView::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
RefPtr<FrameView> protector(this);
d->mousePressed = true;
d->m_currentMousePosition = convertFromContainingWindow(mouseEvent.pos());
d->m_currentMousePosition = windowToContents(mouseEvent.pos());
MouseEventWithHitTestResults mev = prepareMouseEvent(false, true, false, mouseEvent);
......@@ -601,7 +601,7 @@ void FrameView::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
d->clickNode = mev.targetNode();
RenderLayer* layer = d->clickNode->renderer()? d->clickNode->renderer()->enclosingLayer() : 0;
IntPoint p = convertFromContainingWindow(mouseEvent.pos());
IntPoint p = windowToContents(mouseEvent.pos());
if (layer && layer->isPointInResizeControl(p)) {
layer->setInResizeMode(true);
d->m_resizeLayer = layer;
......@@ -620,7 +620,10 @@ void FrameView::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
if (mev.targetNode()->isShadowNode() && mev.targetNode()->shadowParentNode()->hasTagName(inputTag))
mev = prepareMouseEvent(true, true, false, mouseEvent);
if (!mev.scrollbar() || !passMousePressEventToScrollbar(mev))
PlatformScrollBar* scrollbar = scrollbarUnderMouse(mouseEvent);
if (!scrollbar)
scrollbar = mev.scrollbar();
if (!scrollbar || !passMousePressEventToScrollbar(mev, scrollbar))
m_frame->handleMousePressEvent(mev);
// Many AK widgets run their own event loops and consume events while the mouse is down.
......@@ -643,7 +646,7 @@ void FrameView::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEvent
// We get this instead of a second mouse-up
d->mousePressed = false;
d->m_currentMousePosition = convertFromContainingWindow(mouseEvent.pos());
d->m_currentMousePosition = windowToContents(mouseEvent.pos());
MouseEventWithHitTestResults mev = prepareMouseEvent(false, true, false, mouseEvent);
Frame* subframe = subframeForTargetNode(mev.targetNode());
......@@ -673,7 +676,7 @@ static bool nodeIsNotBeingEdited(Node* node, Frame* frame)
return frame->selectionController()->rootEditableElement() != node->rootEditableElement();
}
static Cursor selectCursor(const MouseEventWithHitTestResults& event, Frame* frame, bool mousePressed)
static Cursor selectCursor(const MouseEventWithHitTestResults& event, Frame* frame, bool mousePressed, PlatformScrollBar* scrollbar)
{
// During selection, use an I-beam no matter what we're over.
if (mousePressed && frame->hasSelection())
......@@ -736,9 +739,9 @@ static Cursor selectCursor(const MouseEventWithHitTestResults& event, Frame* fra
return handCursor();
RenderLayer* layer = renderer ? renderer->enclosingLayer() : 0;
bool inResizer = false;
if (frame->view() && layer && layer->isPointInResizeControl(frame->view()->convertFromContainingWindow(event.event().pos())))
if (frame->view() && layer && layer->isPointInResizeControl(frame->view()->windowToContents(event.event().pos())))
inResizer = true;
if ((editable || (renderer && renderer->isText() && renderer->canSelect())) && !inResizer && !event.scrollbar())
if ((editable || (renderer && renderer->isText() && renderer->canSelect())) && !inResizer && !scrollbar)
return iBeamCursor();
// FIXME: If the point is in a layer's overflow scrollbars, we should use the pointer cursor
return pointerCursor();
......@@ -800,7 +803,7 @@ void FrameView::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
return;
RefPtr<FrameView> protector(this);
d->m_currentMousePosition = convertFromContainingWindow(mouseEvent.pos());
d->m_currentMousePosition = windowToContents(mouseEvent.pos());
if (d->hoverTimer.isActive())
d->hoverTimer.stop();
......@@ -822,11 +825,15 @@ void FrameView::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
bool swallowEvent = dispatchMouseEvent(mousemoveEvent, mev.targetNode(), false, 0, mouseEvent, true);
if (d->oldScrollBar != mev.scrollbar()) {
PlatformScrollBar* scrollbar = scrollbarUnderMouse(mouseEvent);
if (!scrollbar)
scrollbar = mev.scrollbar();
if (d->oldScrollBar != scrollbar) {
// Send mouse exited to the old scrollbar.
if (d->oldScrollBar)
d->oldScrollBar->handleMouseOutEvent(mouseEvent);
d->oldScrollBar = mev.scrollbar();
d->oldScrollBar = scrollbar;
}
if (d->m_resizeLayer && d->m_resizeLayer->inResizeMode())
......@@ -839,9 +846,9 @@ void FrameView::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
if (newSubframe && d->oldSubframe != newSubframe)
passMouseMoveEventToSubframe(mev, newSubframe.get());
else {
if (mev.scrollbar() && !d->mousePressed)
mev.scrollbar()->handleMouseMoveEvent(mouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering.
setCursor(selectCursor(mev, m_frame.get(), d->mousePressed));
if (scrollbar && !d->mousePressed)
scrollbar->handleMouseMoveEvent(mouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering.
setCursor(selectCursor(mev, m_frame.get(), d->mousePressed, scrollbar));
}
d->oldSubframe = newSubframe;
......@@ -871,7 +878,7 @@ void FrameView::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
RefPtr<FrameView> protector(this);
d->mousePressed = false;
d->m_currentMousePosition = convertFromContainingWindow(mouseEvent.pos());
d->m_currentMousePosition = windowToContents(mouseEvent.pos());
if (d->resizingFrameSet) {
dispatchMouseEvent(mouseupEvent, d->resizingFrameSet.get(), true, d->clickCount, mouseEvent, false);
......@@ -901,7 +908,7 @@ void FrameView::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
bool FrameView::dispatchDragEvent(const AtomicString& eventType, Node *dragTarget, const PlatformMouseEvent& event, Clipboard* clipboard)
{
IntPoint contentsPos = convertFromContainingWindow(event.pos());
IntPoint contentsPos = windowToContents(event.pos());
RefPtr<MouseEvent> me = new MouseEvent(eventType,
true, true, m_frame->document()->defaultView(),
......@@ -1144,7 +1151,7 @@ MouseEventWithHitTestResults FrameView::prepareMouseEvent(bool readonly, bool ac
ASSERT(m_frame);
ASSERT(m_frame->document());
IntPoint vPoint = convertFromContainingWindow(mev.pos());
IntPoint vPoint = windowToContents(mev.pos());
return m_frame->document()->prepareMouseEvent(readonly, active, mouseMove, vPoint, mev);
}
......@@ -1221,7 +1228,7 @@ void FrameView::handleWheelEvent(PlatformWheelEvent& e)
if (doc) {
RenderObject *docRenderer = doc->renderer();
if (docRenderer) {
IntPoint vPoint = convertFromContainingWindow(e.pos());
IntPoint vPoint = windowToContents(e.pos());
RenderObject::NodeInfo hitTestResult(true, false);
doc->renderer()->layer()->hitTest(hitTestResult, vPoint);
......
......@@ -145,7 +145,7 @@ public:
bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame*);
bool passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, Frame*);
bool passWheelEventToSubframe(PlatformWheelEvent&, Frame*);
bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&);
bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&, PlatformScrollBar*);
bool mousePressed();
void setMousePressed(bool);
......
......@@ -43,9 +43,10 @@ ScrollBar::ScrollBar(ScrollBarClient* client, ScrollBarOrientation orientation,
bool ScrollBar::setValue(int v)
{
int maxPos = m_totalSize - m_visibleSize;
if (v < 0) v = 0;
if (v > maxPos)
v = maxPos;
if (v < 0)
v = 0;
if (m_currentPos == v)
return false; // Our value stayed the same.
m_currentPos = v;
......
......@@ -37,6 +37,7 @@ class QScrollArea;
namespace WebCore {
class FloatRect;
class PlatformWheelEvent;
class PlatformScrollBar;
class ScrollView : public Widget {
public:
......@@ -71,13 +72,19 @@ namespace WebCore {
virtual void resizeContents(int w, int h);
void updateContents(const IntRect&, bool now = false);
virtual IntPoint convertToContainingWindow(const IntPoint&) const;
virtual IntPoint convertFromContainingWindow(const IntPoint&) const;
// Event coordinates are assumed to be in the coordinate space of a window that contains
// the entire widget hierarchy. It is up to the platform to decide what the precise definition
// of containing window is. (For example on Mac it is the containing NSWindow.)
IntPoint windowToContents(const IntPoint&) const;
IntPoint contentsToWindow(const IntPoint&) const;
void setStaticBackground(bool);
bool inWindow() const;
// For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
PlatformScrollBar* scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent);
// This method exists for scrollviews that need to handle wheel events manually.
// On Mac the underlying NSScrollView just does the scrolling, but on other platforms
// (like Windows), we need this method in order to do the scroll ourselves.
......@@ -93,11 +100,15 @@ namespace WebCore {
virtual void paint(GraphicsContext*, const IntRect&);
virtual void themeChanged();
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
virtual void scrolled() const;
private:
void updateScrollBars();
void updateScrollBars(const IntSize& desiredOffset);
IntSize maximumScroll() const;
int updateScrollInfo(short type, int current, int max, int pageSize);
class ScrollViewPrivate;
ScrollViewPrivate* m_data;
#endif
......
......@@ -129,19 +129,6 @@ namespace WebCore {
virtual bool isFrameView() const;
// Event coordinates are assumed to be in the coordinate space of a window that contains
// the entire widget hierarchy. It is up to the platform to decide what the precise definition
// of containing window is. (For example on Mac it is the containing NSWindow.)
//
// Note that for scrollable widgets, the points and rects given will be converted to and
// from the document coordinate space inside the scrollable widget. Therefore
// for conversion to a containing window coordinate space, the argument should be in the
// scrollable widget's document coordinate space. When converting from the containing window
// coordinate space, the result will be in the scrollable widget's document coordinate space.
IntRect convertToContainingWindow(const IntRect&) const;
virtual IntPoint convertToContainingWindow(const IntPoint&) const;
virtual IntPoint convertFromContainingWindow(const IntPoint&) const;
#if PLATFORM(WIN)
void setContainingWindow(HWND);
HWND containingWindow() const;
......@@ -149,12 +136,23 @@ namespace WebCore {
void setParent(Widget*);
Widget* parent() const;
virtual void scrolled() const {};
bool capturingMouse() const;
void setCapturingMouse(bool);
Widget* capturingTarget();
Widget* capturingChild();
void setCapturingChild(Widget*);
IntRect convertToContainingWindow(const IntRect&) const;
IntPoint convertToContainingWindow(const IntPoint&) const;
IntPoint convertFromContainingWindow(const IntPoint&) const;
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
void setSuppressInvalidation(bool);
// These methods will be called on a widget while it is capturing the mouse.
virtual void handleMouseMoveEvent(const PlatformMouseEvent&) {};
virtual void handleMouseReleaseEvent(const PlatformMouseEvent&) {};
......
......@@ -355,7 +355,7 @@ void ScrollView::updateContents(const IntRect &rect, bool now)
// "Containing Window" means the NSWindow's coord system, which is origin lower left
IntPoint ScrollView::convertToContainingWindow(const IntPoint& contentsPoint) const
IntPoint ScrollView::contentsToWindow(const IntPoint& contentsPoint) const
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
......@@ -375,7 +375,7 @@ IntPoint ScrollView::convertToContainingWindow(const IntPoint& contentsPoint) co
return IntPoint();
}
IntPoint ScrollView::convertFromContainingWindow(const IntPoint& point) const
IntPoint ScrollView::windowToContents(const IntPoint& point) const
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
......@@ -417,6 +417,12 @@ NSView *ScrollView::getDocumentView() const
return nil;
}
PlatformScrollBar* ScrollView::scrollbarUnderMouse(const PlatformMouseEvent& mouseEvent)
{
// On Mac, the ScrollView is really the "document", so events will never flow into it to get to the scrollers.
return 0;
}
bool ScrollView::inWindow() const
{
return [getView() window];
......
......@@ -452,34 +452,4 @@ WidgetClient* Widget::client() const
return data->client;
}
// "Containing Window" means the NSWindow's coord system, which is origin lower left
IntPoint Widget::convertToContainingWindow(const IntPoint& point) const
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSView *view = getView();
NSPoint tempPoint = { point.x(), point.y() }; // workaround for 4213314
NSPoint np = [view convertPoint:tempPoint toView: nil];
return IntPoint(np);
END_BLOCK_OBJC_EXCEPTIONS;
return IntPoint();
}
IntPoint Widget::convertFromContainingWindow(const IntPoint& point) const
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSView *view = getView();
NSPoint tempPoint = { point.x(), point.y() }; // workaround for 4213314
NSPoint np = [view convertPoint:tempPoint fromView: nil];
return IntPoint(np);
END_BLOCK_OBJC_EXCEPTIONS;
return IntPoint();
}
}
......@@ -803,7 +803,7 @@ void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& offsetFro
// FIXME Radar 4118564: ideally we'd autoscroll the window as necessary to keep the point under
// the cursor in view.
IntPoint currentPoint = m_object->document()->view()->convertFromContainingWindow(evt.pos());
IntPoint currentPoint = m_object->document()->view()->windowToContents(evt.pos());
currentPoint += offsetFromResizeCorner;
int x;
......@@ -1004,18 +1004,18 @@ void RenderLayer::positionResizeControl()
void
RenderLayer::positionScrollbars(const IntRect& absBounds)
{
int resizeControlSize = max(resizeControlRect().height() - 1, 0);
int resizeControlSize = max(resizeControlRect().height(), 0);
if (m_vBar)
m_vBar->setRect(IntRect(absBounds.right() - m_object->borderRight() - m_vBar->width(),
absBounds.y() + m_object->borderTop(),
m_vBar->width(),
absBounds.height() - (m_object->borderTop() + m_object->borderBottom()) - (m_hBar ? m_hBar->height() - 1 : resizeControlSize)));
absBounds.height() - (m_object->borderTop() + m_object->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize)));
resizeControlSize = max(resizeControlRect().width() - 1, 0);
resizeControlSize = max(resizeControlRect().width(), 0);
if (m_hBar)
m_hBar->setRect(IntRect(absBounds.x() + m_object->borderLeft(),
absBounds.bottom() - m_object->borderBottom() - m_hBar->height(),
absBounds.width() - (m_object->borderLeft() + m_object->borderRight()) - (m_vBar ? m_vBar->width() - 1 : resizeControlSize),
absBounds.width() - (m_object->borderLeft() + m_object->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),
m_hBar->height()));
}
......
......@@ -51,7 +51,8 @@ bool RenderReplaced::shouldPaint(PaintInfo& i, int& _tx, int& _ty)
return false;
// if we're invisible or haven't received a layout yet, then just bail.
if (style()->visibility() != VISIBLE || m_y <= -500000) return false;
if (style()->visibility() != VISIBLE)
return false;
int tx = _tx + m_x;
int ty = _ty + m_y;
......
......@@ -239,24 +239,6 @@ void RenderView::repaintViewRectangle(const IntRect& ur, bool immediate)
}
}
IntRect RenderView::getAbsoluteRepaintRect()
{
IntRect result;
if (m_frameView && !m_printingMode)
result = IntRect(m_frameView->contentsX(), m_frameView->contentsY(),
m_frameView->visibleWidth(), m_frameView->visibleHeight());
return result;
}
void RenderView::computeAbsoluteRepaintRect(IntRect& r, bool f)
{
if (m_printingMode)
return;
if (f && m_frameView)
r.move(m_frameView->contentsX(), m_frameView->contentsY());
}
void RenderView::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
{
rects.append(IntRect(tx, ty, m_layer->width(), m_layer->height()));
......
......@@ -52,8 +52,6 @@ public:
virtual bool hasOverhangingFloats() { return false; }
virtual IntRect getAbsoluteRepaintRect();
virtual void computeAbsoluteRepaintRect(IntRect& r, bool f=false);
virtual void repaintViewRectangle(const IntRect& r, bool immediate = false);
virtual void paint(PaintInfo& i, int tx, int ty);
......
......@@ -128,15 +128,13 @@ void RenderWidget::setWidget(Widget* widget)
resizeWidget(m_widget,
m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight(),
m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom());
else
setPos(xPos(), -500000);
if (style()) {
if (style()->visibility() != VISIBLE)
m_widget->hide();
else
m_widget->show();
}
m_view->addChild(m_widget, -500000, 0);
m_view->addChild(m_widget);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment