[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
hyatt
hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:37:39 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 7a077f7515cbfd83a66d8b43de5ca57b0e2b7faa
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Sep 9 23:56:44 2002 +0000
Switching over to the layer system for the handling of mouse
events.
* khtml/rendering/render_flow.cpp:
(RenderFlow::nodeAtPoint):
* khtml/rendering/render_image.cpp:
(RenderImage::nodeAtPoint):
* khtml/rendering/render_layer.cpp:
(RenderLayer::paint):
(RenderLayer::nodeAtPoint):
(RenderLayer::constructZTree):
* khtml/rendering/render_layer.h:
* khtml/rendering/render_object.cpp:
(RenderObject::nodeAtPoint):
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::prepareMouseEvent):
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge drawRect:withPainter:]):
(-[WebCoreBridge elementAtPoint:]):
* kwq/qt/qrect.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2014 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 9e052a6..29d3180 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,26 @@
+2002-09-09 David Hyatt <hyatt at apple.com>
+
+ Switching over to the layer system for the handling of mouse
+ events.
+
+ * khtml/rendering/render_flow.cpp:
+ (RenderFlow::nodeAtPoint):
+ * khtml/rendering/render_image.cpp:
+ (RenderImage::nodeAtPoint):
+ * khtml/rendering/render_layer.cpp:
+ (RenderLayer::paint):
+ (RenderLayer::nodeAtPoint):
+ (RenderLayer::constructZTree):
+ * khtml/rendering/render_layer.h:
+ * khtml/rendering/render_object.cpp:
+ (RenderObject::nodeAtPoint):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::prepareMouseEvent):
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge drawRect:withPainter:]):
+ (-[WebCoreBridge elementAtPoint:]):
+ * kwq/qt/qrect.h:
+
2002-09-09 Darin Adler <darin at apple.com>
* khtml/rendering/render_layer.h: Add a call to delete to fix a storage leak.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 9e052a6..29d3180 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,26 @@
+2002-09-09 David Hyatt <hyatt at apple.com>
+
+ Switching over to the layer system for the handling of mouse
+ events.
+
+ * khtml/rendering/render_flow.cpp:
+ (RenderFlow::nodeAtPoint):
+ * khtml/rendering/render_image.cpp:
+ (RenderImage::nodeAtPoint):
+ * khtml/rendering/render_layer.cpp:
+ (RenderLayer::paint):
+ (RenderLayer::nodeAtPoint):
+ (RenderLayer::constructZTree):
+ * khtml/rendering/render_layer.h:
+ * khtml/rendering/render_object.cpp:
+ (RenderObject::nodeAtPoint):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::prepareMouseEvent):
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge drawRect:withPainter:]):
+ (-[WebCoreBridge elementAtPoint:]):
+ * kwq/qt/qrect.h:
+
2002-09-09 Darin Adler <darin at apple.com>
* khtml/rendering/render_layer.h: Add a call to delete to fix a storage leak.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 9e052a6..29d3180 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,26 @@
+2002-09-09 David Hyatt <hyatt at apple.com>
+
+ Switching over to the layer system for the handling of mouse
+ events.
+
+ * khtml/rendering/render_flow.cpp:
+ (RenderFlow::nodeAtPoint):
+ * khtml/rendering/render_image.cpp:
+ (RenderImage::nodeAtPoint):
+ * khtml/rendering/render_layer.cpp:
+ (RenderLayer::paint):
+ (RenderLayer::nodeAtPoint):
+ (RenderLayer::constructZTree):
+ * khtml/rendering/render_layer.h:
+ * khtml/rendering/render_object.cpp:
+ (RenderObject::nodeAtPoint):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::prepareMouseEvent):
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge drawRect:withPainter:]):
+ (-[WebCoreBridge elementAtPoint:]):
+ * kwq/qt/qrect.h:
+
2002-09-09 Darin Adler <darin at apple.com>
* khtml/rendering/render_layer.h: Add a call to delete to fix a storage leak.
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index 5bcc857..e7a4d59 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -1584,15 +1584,10 @@ bool RenderFlow::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty)
if (specialObjects) {
int stx = _tx;
int sty = _ty;
- // special case - special objects in root are relative to viewport
- if (isRoot()) {
- stx += static_cast<RenderRoot*>(this)->view()->contentsX();
- sty += static_cast<RenderRoot*>(this)->view()->contentsY();
- }
SpecialObject* o;
QPtrListIterator<SpecialObject> it(*specialObjects);
for (it.toLast(); (o = it.current()); --it)
- if (o->node->containingBlock() == this)
+ if (!o->node->layer() && o->node->containingBlock() == this)
inBox |= o->node->nodeAtPoint(info, _x, _y, stx+xPos(), sty+yPos());
}
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index 8e1daeb..d1024e3 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -345,9 +345,7 @@ bool RenderImage::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty)
if (inside && element()) {
int tx = _tx + m_x;
int ty = _ty + m_y;
- if (isRelPositioned())
- relativePositionOffset(tx, ty);
-
+
HTMLImageElementImpl* i = element()->id() == ID_IMG ? static_cast<HTMLImageElementImpl*>(element()) : 0;
HTMLMapElementImpl* map;
if (i && i->getDocument()->isHTMLDocument() &&
diff --git a/WebCore/khtml/rendering/render_layer.cpp b/WebCore/khtml/rendering/render_layer.cpp
index 12e3077..aee09b9 100644
--- a/WebCore/khtml/rendering/render_layer.cpp
+++ b/WebCore/khtml/rendering/render_layer.cpp
@@ -146,7 +146,7 @@ RenderLayer::convertToLayerCoords(RenderLayer* ancestorLayer, int& x, int& y)
}
void
-RenderLayer::paint(QPainter *p, int x, int y, int w, int h, int tx, int ty)
+RenderLayer::paint(QPainter *p, int x, int y, int w, int h)
{
// Create the z-tree of layers that should be displayed.
RenderLayer::RenderZTreeNode* node = constructZTree(QRect(x, y, w, h), this);
@@ -169,15 +169,50 @@ RenderLayer::paint(QPainter *p, int x, int y, int w, int h, int tx, int ty)
//printf("Painting layer at %d %d\n", elt->absBounds.x(), elt->absBounds.y());
elt->layer->renderer()->print(p, x, y, w, h,
- tx + elt->absBounds.x() - elt->layer->renderer()->xPos(),
- ty + elt->absBounds.y() - elt->layer->renderer()->yPos());
+ elt->absBounds.x() - elt->layer->renderer()->xPos(),
+ elt->absBounds.y() - elt->layer->renderer()->yPos());
}
delete node;
}
+bool
+RenderLayer::nodeAtPoint(RenderObject::NodeInfo& info, int x, int y)
+{
+ bool inside = false;
+ RenderLayer::RenderZTreeNode* node = constructZTree(QRect(x, y, 0, 0), this, true);
+ if (!node)
+ return false;
+
+ // Flatten the tree into a back-to-front list for painting.
+ QPtrVector<RenderLayer::RenderLayerElement> layerList;
+ constructLayerList(node, &layerList);
+
+ // Walk the list and test each layer, adding in the appropriate offset.
+ uint count = layerList.count();
+ for (int i = count-1; i >= 0; i--) {
+ RenderLayer::RenderLayerElement* elt = layerList.at(i);
+
+ // Elements add in their own positions as a translation factor. This forces
+ // us to subtract that out, so that when it's added back in, we get the right
+ // bounds. This is really disgusting (that print only sets up the right paint
+ // position after you call into it). -dwh
+ //printf("Painting layer at %d %d\n", elt->absBounds.x(), elt->absBounds.y());
+
+ inside = elt->layer->renderer()->nodeAtPoint(info, x, y,
+ elt->absBounds.x() - elt->layer->renderer()->xPos(),
+ elt->absBounds.y() - elt->layer->renderer()->yPos());
+ if (inside)
+ break;
+ }
+ delete node;
+
+ return inside;
+}
+
RenderLayer::RenderZTreeNode*
RenderLayer::constructZTree(const QRect& damageRect,
- RenderLayer* rootLayer)
+ RenderLayer* rootLayer,
+ bool eventProcessing)
{
// This variable stores the result we will hand back.
RenderLayer::RenderZTreeNode* returnNode = 0;
@@ -204,7 +239,7 @@ RenderLayer::constructZTree(const QRect& damageRect,
if (child->zIndex() < 0)
continue; // Ignore negative z-indices in this first pass.
- RenderZTreeNode* childNode = child->constructZTree(damageRect, rootLayer);
+ RenderZTreeNode* childNode = child->constructZTree(damageRect, rootLayer, eventProcessing);
if (childNode) {
// Put the new node into the tree at the front of the parent's list.
if (lastChildNode)
@@ -217,7 +252,9 @@ RenderLayer::constructZTree(const QRect& damageRect,
// Now add a leaf node for ourselves, but only if we intersect the damage
// rect.
- if (!m_parent || layerBounds.intersects(damageRect)) {
+ if (!m_parent ||
+ (eventProcessing && layerBounds.contains(x,y)) ||
+ (!eventProcessing && layerBounds.intersects(damageRect))) {
RenderLayerElement* layerElt = new RenderLayerElement(this, layerBounds, x, y);
if (returnNode->child) {
RenderZTreeNode* leaf = new RenderZTreeNode(layerElt);
@@ -233,7 +270,7 @@ RenderLayer::constructZTree(const QRect& damageRect,
if (child->zIndex() >= 0)
continue; // Ignore non-negative z-indices in this second pass.
- RenderZTreeNode* childNode = child->constructZTree(damageRect, rootLayer);
+ RenderZTreeNode* childNode = child->constructZTree(damageRect, rootLayer, eventProcessing);
if (childNode) {
// Deal with the case where all our children views had negative z-indices.
// Demote our leaf node and make a new interior node that can hold these
diff --git a/WebCore/khtml/rendering/render_layer.h b/WebCore/khtml/rendering/render_layer.h
index b9b4310..6cb8b57 100644
--- a/WebCore/khtml/rendering/render_layer.h
+++ b/WebCore/khtml/rendering/render_layer.h
@@ -89,7 +89,12 @@ public:
bool hasAutoZIndex() { return renderer()->style()->hasAutoZIndex(); }
int zIndex() { return renderer()->style()->zIndex(); }
- void paint(QPainter *p, int x, int y, int w, int h, int tx, int ty);
+ // The two main functions that use the layer system. The paint method
+ // paints the layers that intersect the damage rect from back to
+ // front. The nodeAtPoint method looks for mouse events by walking
+ // layers that intersect the point from front to back.
+ void paint(QPainter *p, int x, int y, int w, int h);
+ bool nodeAtPoint(RenderObject::NodeInfo& info, int x, int y);
public:
// Z-Index Implementation Notes
@@ -193,7 +198,8 @@ private:
// +-------> L(L6)
//
RenderZTreeNode* constructZTree(const QRect& damageRect,
- RenderLayer* rootLayer);
+ RenderLayer* rootLayer,
+ bool eventProcessing = false);
// Once the z-tree has been constructed, we call constructLayerList
// to produce a flattened layer list for rendering/event handling.
@@ -221,7 +227,7 @@ private:
// [ L(L0)(0), L(L1)(0), L(L2)(0), L(L3)(0), L(L5)(0), L(L4)(0), L(L6)(1) ]
void constructLayerList(RenderZTreeNode* ztree,
QPtrVector<RenderLayerElement>* result);
-
+
private:
void setNextSibling(RenderLayer* next) { m_next = next; }
void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index eb8b96c..76b1a94 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -833,9 +833,7 @@ bool RenderObject::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty)
{
int tx = _tx + xPos();
int ty = _ty + yPos();
- if (isRelPositioned())
- static_cast<RenderBox*>(this)->relativePositionOffset(tx, ty);
-
+
bool inside = (style()->visibility() != HIDDEN && ((_y >= ty) && (_y < ty + height()) &&
(_x >= tx) && (_x < tx + width()))) || isBody() || isHtml();
bool inner = !info.innerNode();
@@ -843,7 +841,7 @@ bool RenderObject::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty)
// ### table should have its own, more performant method
if (overhangingContents() || isInline() || isRoot() || isTableRow() || isTableSection() || inside || mouseInside() ) {
for (RenderObject* child = lastChild(); child; child = child->previousSibling())
- if (!child->isPositioned() && child->nodeAtPoint(info, _x, _y, _tx+xPos(), _ty+yPos()))
+ if (!child->layer() && child->nodeAtPoint(info, _x, _y, _tx+xPos(), _ty+yPos()))
inside = true;
}
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index e4520a2..cbae82f 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -1474,7 +1474,7 @@ bool DocumentImpl::prepareMouseEvent( bool readonly, int _x, int _y, MouseEvent
if ( m_render ) {
assert(m_render->isRoot());
RenderObject::NodeInfo renderInfo(readonly, ev->type == MousePress);
- bool isInside = m_render->nodeAtPoint(renderInfo, _x, _y, 0, 0);
+ bool isInside = m_render->layer()->nodeAtPoint(renderInfo, _x, _y);
ev->innerNode = renderInfo.innerNode();
if (renderInfo.URLElement()) {
diff --git a/WebCore/kwq/KWQRect.h b/WebCore/kwq/KWQRect.h
index 1154812..140fa58 100644
--- a/WebCore/kwq/KWQRect.h
+++ b/WebCore/kwq/KWQRect.h
@@ -60,6 +60,12 @@ public:
QRect intersect(const QRect &) const;
bool intersects(const QRect &) const;
QRect unite(const QRect &) const;
+
+ bool contains(int x, int y, bool proper = false) {
+ if (proper)
+ return x > xp && x < (xp + w - 1) && y > yp && y < (yp + h - 1);
+ return x >= xp && x < xp + w && y >= yp && y < yp + h;
+ }
inline QRect operator&(const QRect &r) const { return intersect(r); }
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 91bb230..3929f4d 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -223,7 +223,7 @@ using khtml::RenderPart;
#endif
if (renderer && renderer->layer())
- renderer->layer()->paint(p, (int)rect.origin.x, (int)rect.origin.y, (int)rect.size.width, (int)rect.size.height, 0, 0);
+ renderer->layer()->paint(p, (int)rect.origin.x, (int)rect.origin.y, (int)rect.size.width, (int)rect.size.height);
}
- (void)drawRect:(NSRect)rect
@@ -425,7 +425,7 @@ using khtml::RenderPart;
- (NSDictionary *)elementAtPoint:(NSPoint)point
{
RenderObject::NodeInfo nodeInfo(true, true);
- part->impl->renderer()->nodeAtPoint(nodeInfo, (int)point.x, (int)point.y, 0, 0);
+ part->impl->renderer()->layer()->nodeAtPoint(nodeInfo, (int)point.x, (int)point.y);
NSMutableDictionary *elementInfo = [NSMutableDictionary dictionary];
diff --git a/WebCore/kwq/qt/qrect.h b/WebCore/kwq/qt/qrect.h
index 1154812..140fa58 100644
--- a/WebCore/kwq/qt/qrect.h
+++ b/WebCore/kwq/qt/qrect.h
@@ -60,6 +60,12 @@ public:
QRect intersect(const QRect &) const;
bool intersects(const QRect &) const;
QRect unite(const QRect &) const;
+
+ bool contains(int x, int y, bool proper = false) {
+ if (proper)
+ return x > xp && x < (xp + w - 1) && y > yp && y < (yp + h - 1);
+ return x >= xp && x < xp + w && y >= yp && y < yp + h;
+ }
inline QRect operator&(const QRect &r) const { return intersect(r); }
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list