Commit 559ff05c authored by hyatt's avatar hyatt
Browse files

Fix for the 3137790. This patch passes the mouse event x and y as

	distinct arguments to constructZTree, so that the damageRect can
	really reflect your clip rect.
	This allows me to prune out layers that are clipped so
	that if x,y aren't inside the clip rect, the layer doesn't get added to
	the list.

	This patch also makes the "clip" property apply to the element that specifies the clip instead of to the element's kids.  This is ambiguous in the spec, but it turns out other browsers do it this way, so there really is an interpretation that must be followed. :)

	Reviewed by darin

        * khtml/rendering/render_layer.cpp:
        (RenderLayer::nodeAtPoint):
        (RenderLayer::constructZTree):
        * khtml/rendering/render_layer.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3236 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a14d1741
2003-01-02 David Hyatt <hyatt@apple.com>
Fix for the 3137790. This patch passes the mouse event x and y as
distinct arguments to constructZTree, so that the damageRect can
really reflect your clip rect.
This allows me to prune out layers that are clipped so
that if x,y aren't inside the clip rect, the layer doesn't get added to
the list.
This patch also makes the "clip" property apply to the element that specifies the clip instead of to the element's kids. This is ambiguous in the spec, but it turns out other browsers do it this way, so there really is an interpretation that must be followed. :)
Reviewed by darin
* khtml/rendering/render_layer.cpp:
(RenderLayer::nodeAtPoint):
(RenderLayer::constructZTree):
* khtml/rendering/render_layer.h:
2003-01-02 David Hyatt <hyatt@apple.com>
Fix for bug #3137935. When a float causes a line to get
......
2003-01-02 David Hyatt <hyatt@apple.com>
Fix for the 3137790. This patch passes the mouse event x and y as
distinct arguments to constructZTree, so that the damageRect can
really reflect your clip rect.
This allows me to prune out layers that are clipped so
that if x,y aren't inside the clip rect, the layer doesn't get added to
the list.
This patch also makes the "clip" property apply to the element that specifies the clip instead of to the element's kids. This is ambiguous in the spec, but it turns out other browsers do it this way, so there really is an interpretation that must be followed. :)
Reviewed by darin
* khtml/rendering/render_layer.cpp:
(RenderLayer::nodeAtPoint):
(RenderLayer::constructZTree):
* khtml/rendering/render_layer.h:
2003-01-02 David Hyatt <hyatt@apple.com>
Fix for bug #3137935. When a float causes a line to get
......
......@@ -318,8 +318,8 @@ bool
RenderLayer::nodeAtPoint(RenderObject::NodeInfo& info, int x, int y)
{
bool inside = false;
QRect damageRect = QRect(x,y,0,0);
RenderLayer::RenderZTreeNode* node = constructZTree(damageRect, damageRect, this, true);
QRect damageRect(m_x, m_y, m_width, m_height);
RenderLayer::RenderZTreeNode* node = constructZTree(damageRect, damageRect, this, true, x, y);
if (!node)
return false;
......@@ -352,7 +352,7 @@ RenderLayer::nodeAtPoint(RenderObject::NodeInfo& info, int x, int y)
RenderLayer::RenderZTreeNode*
RenderLayer::constructZTree(QRect overflowClipRect, QRect posClipRect,
RenderLayer* rootLayer,
bool eventProcessing)
bool eventProcessing, int xMousePos, int yMousePos)
{
// The arena we use for allocating our temporary ztree elements.
RenderArena* renderArena = renderer()->renderArena();
......@@ -383,9 +383,12 @@ RenderLayer::constructZTree(QRect overflowClipRect, QRect posClipRect,
// Positioned elements are clipped according to the posClipRect. All other
// layers are clipped according to the overflowClipRect.
QRect clipRectToApply = m_object->isPositioned() ? posClipRect : overflowClipRect;
QRect damageRect = eventProcessing ? clipRectToApply :
clipRectToApply.intersect(layerBounds);
QRect damageRect = clipRectToApply.intersect(layerBounds);
// Clip applies to *us* as well, so go ahead and update the damageRect.
if (m_object->hasClip())
damageRect = damageRect.intersect(m_object->getClipRect(x,y));
// If we establish a clip rect, then we want to intersect that rect
// with the damage rect to form a new damage rect.
bool clipOriginator = false;
......@@ -417,7 +420,8 @@ RenderLayer::constructZTree(QRect overflowClipRect, QRect posClipRect,
continue; // Ignore negative z-indices in this first pass.
RenderZTreeNode* childNode = child->constructZTree(overflowClipRect, posClipRect,
rootLayer, eventProcessing);
rootLayer, eventProcessing,
xMousePos, yMousePos);
if (childNode) {
// Put the new node into the tree at the front of the parent's list.
if (lastChildNode)
......@@ -436,8 +440,7 @@ RenderLayer::constructZTree(QRect overflowClipRect, QRect posClipRect,
if (renderer()->isRoot() || renderer()->isHtml() || renderer()->isBody() ||
renderer()->hasOverhangingFloats() ||
(renderer()->isInline() && !renderer()->isReplaced()) ||
(eventProcessing && layerBounds.contains(damageRect.x(),
damageRect.y())) ||
(eventProcessing && damageRect.contains(xMousePos,yMousePos)) ||
(!eventProcessing && layerBounds.intersects(damageRect))) {
RenderLayerElement* layerElt = new (renderArena) RenderLayerElement(this, layerBounds,
damageRect, clipRectToApply,
......@@ -463,7 +466,8 @@ RenderLayer::constructZTree(QRect overflowClipRect, QRect posClipRect,
continue; // Ignore non-negative z-indices in this second pass.
RenderZTreeNode* childNode = child->constructZTree(overflowClipRect, posClipRect,
rootLayer, eventProcessing);
rootLayer, eventProcessing,
xMousePos, yMousePos);
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
......
......@@ -263,7 +263,7 @@ private:
RenderZTreeNode* constructZTree(QRect overflowClipRect,
QRect clipRect,
RenderLayer* rootLayer,
bool eventProcessing = false);
bool eventProcessing = false, int x=0, int y=0);
// Once the z-tree has been constructed, we call constructLayerList
// to produce a flattened layer list for rendering/event handling.
......
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