Commit 953820ad authored by hyatt's avatar hyatt

Fix for 3016385, menus on webreference.com don't show up.

	Fixes to make webreference.com menus show up.  This involved
	fixing layers to not clip positioned objects when overflow:hidden
	is set, fixing the stupid clip/sync layout hack for livepage
	so that it doesn't break webreference, and implementing
	navigator.productSub (right now the date is set to
	Christmas 2002).

        Reviewed by gramps/maciej.

        * khtml/ecma/kjs_navigator.cpp:
        (Navigator::getValueProperty):
        * khtml/ecma/kjs_navigator.h:
        * khtml/ecma/kjs_navigator.lut.h:
        * khtml/rendering/render_box.cpp:
        (RenderBox::getOverflowClipRect):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::layout):
        * khtml/rendering/render_layer.cpp:
        (RenderLayer::paint):
        (RenderLayer::nodeAtPoint):
        (RenderLayer::constructZTree):
        * khtml/rendering/render_layer.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::setLayouted):
        * khtml/rendering/render_object.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3054 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f273a9fd
2002-12-14 David Hyatt <hyatt@apple.com>
Fix for 3016385, menus on webreference.com don't show up.
Fixes to make webreference.com menus show up. This involved
fixing layers to not clip positioned objects when overflow:hidden
is set, fixing the stupid clip/sync layout hack for livepage
so that it doesn't break webreference, and implementing
navigator.productSub (right now the date is set to
Christmas 2002).
Reviewed by gramps/maciej.
* khtml/ecma/kjs_navigator.cpp:
(Navigator::getValueProperty):
* khtml/ecma/kjs_navigator.h:
* khtml/ecma/kjs_navigator.lut.h:
* khtml/rendering/render_box.cpp:
(RenderBox::getOverflowClipRect):
* khtml/rendering/render_box.h:
* khtml/rendering/render_flow.cpp:
(RenderFlow::layout):
* khtml/rendering/render_layer.cpp:
(RenderLayer::paint):
(RenderLayer::nodeAtPoint):
(RenderLayer::constructZTree):
* khtml/rendering/render_layer.h:
* khtml/rendering/render_object.cpp:
(RenderObject::setLayouted):
* khtml/rendering/render_object.h:
2002-12-14 Ken Kocienda <kocienda@apple.com>
Reviewed by Maciej
......
2002-12-14 David Hyatt <hyatt@apple.com>
Fix for 3016385, menus on webreference.com don't show up.
Fixes to make webreference.com menus show up. This involved
fixing layers to not clip positioned objects when overflow:hidden
is set, fixing the stupid clip/sync layout hack for livepage
so that it doesn't break webreference, and implementing
navigator.productSub (right now the date is set to
Christmas 2002).
Reviewed by gramps/maciej.
* khtml/ecma/kjs_navigator.cpp:
(Navigator::getValueProperty):
* khtml/ecma/kjs_navigator.h:
* khtml/ecma/kjs_navigator.lut.h:
* khtml/rendering/render_box.cpp:
(RenderBox::getOverflowClipRect):
* khtml/rendering/render_box.h:
* khtml/rendering/render_flow.cpp:
(RenderFlow::layout):
* khtml/rendering/render_layer.cpp:
(RenderLayer::paint):
(RenderLayer::nodeAtPoint):
(RenderLayer::constructZTree):
* khtml/rendering/render_layer.h:
* khtml/rendering/render_object.cpp:
(RenderObject::setLayouted):
* khtml/rendering/render_object.h:
2002-12-14 Ken Kocienda <kocienda@apple.com>
Reviewed by Maciej
......
......@@ -147,7 +147,7 @@ int KJS::PluginBase::m_refCount = 0;
const ClassInfo Navigator::info = { "Navigator", 0, &NavigatorTable, 0 };
/*
@begin NavigatorTable 11
@begin NavigatorTable 13
appCodeName Navigator::AppCodeName DontDelete|ReadOnly
appName Navigator::AppName DontDelete|ReadOnly
appVersion Navigator::AppVersion DontDelete|ReadOnly
......@@ -157,6 +157,7 @@ const ClassInfo Navigator::info = { "Navigator", 0, &NavigatorTable, 0 };
plugins Navigator::_Plugins DontDelete|ReadOnly
mimeTypes Navigator::_MimeTypes DontDelete|ReadOnly
product Navigator::Product DontDelete|ReadOnly
productSub Navigator::ProductSub DontDelete|ReadOnly
vendor Navigator::Vendor DontDelete|ReadOnly
cookieEnabled Navigator::CookieEnabled DontDelete|ReadOnly
javaEnabled Navigator::JavaEnabled DontDelete|Function 0
......@@ -223,6 +224,8 @@ Value Navigator::getValueProperty(ExecState *exec, int token) const
#else
return String("Konqueror/khtml");
#endif
case ProductSub:
return String("20021225");
case Vendor:
#if APPLE_CHANGES
// FIXME: Should we define a fallback result here besides "KDE"? Perhaps "Apple"?
......
......@@ -35,7 +35,7 @@ namespace KJS {
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { AppCodeName, AppName, AppVersion, Language, UserAgent, Platform,
_Plugins, _MimeTypes, Product, Vendor, CookieEnabled, JavaEnabled };
_Plugins, _MimeTypes, Product, ProductSub, Vendor, CookieEnabled, JavaEnabled };
KHTMLPart *part() const { return m_part; }
private:
KHTMLPart *m_part;
......
......@@ -3,24 +3,25 @@
namespace KJS {
const struct HashEntry NavigatorTableEntries[] = {
{ "language", Navigator::Language, DontDelete|ReadOnly, 0, &NavigatorTableEntries[13] },
{ "javaEnabled", Navigator::JavaEnabled, DontDelete|Function, 0, 0 },
{ "appName", Navigator::AppName, DontDelete|ReadOnly, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "productSub", Navigator::ProductSub, DontDelete|ReadOnly, 0, 0 },
{ "product", Navigator::Product, DontDelete|ReadOnly, 0, 0 },
{ "plugins", Navigator::_Plugins, DontDelete|ReadOnly, 0, 0 },
{ "appName", Navigator::AppName, DontDelete|ReadOnly, 0, &NavigatorTableEntries[13] },
{ 0, 0, 0, 0, 0 },
{ "vendor", Navigator::Vendor, DontDelete|ReadOnly, 0, 0 },
{ "appCodeName", Navigator::AppCodeName, DontDelete|ReadOnly, 0, &NavigatorTableEntries[14] },
{ 0, 0, 0, 0, 0 },
{ "appCodeName", Navigator::AppCodeName, DontDelete|ReadOnly, 0, &NavigatorTableEntries[11] },
{ "cookieEnabled", Navigator::CookieEnabled, DontDelete|ReadOnly, 0, 0 },
{ "mimeTypes", Navigator::_MimeTypes, DontDelete|ReadOnly, 0, 0 },
{ "javaEnabled", Navigator::JavaEnabled, DontDelete|Function, 0, 0 },
{ "appVersion", Navigator::AppVersion, DontDelete|ReadOnly, 0, 0 },
{ "platform", Navigator::Platform, DontDelete|ReadOnly, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "product", Navigator::Product, DontDelete|ReadOnly, 0, 0 },
{ "appVersion", Navigator::AppVersion, DontDelete|ReadOnly, 0, &NavigatorTableEntries[12] },
{ "language", Navigator::Language, DontDelete|ReadOnly, 0, &NavigatorTableEntries[15] },
{ "userAgent", Navigator::UserAgent, DontDelete|ReadOnly, 0, 0 },
{ "platform", Navigator::Platform, DontDelete|ReadOnly, 0, &NavigatorTableEntries[14] },
{ "plugins", Navigator::_Plugins, DontDelete|ReadOnly, 0, &NavigatorTableEntries[15] },
{ "mimeTypes", Navigator::_MimeTypes, DontDelete|ReadOnly, 0, 0 }
{ "vendor", Navigator::Vendor, DontDelete|ReadOnly, 0, &NavigatorTableEntries[16] },
{ "cookieEnabled", Navigator::CookieEnabled, DontDelete|ReadOnly, 0, 0 }
};
const struct HashTable NavigatorTable = { 2, 16, NavigatorTableEntries, 11 };
const struct HashTable NavigatorTable = { 2, 17, NavigatorTableEntries, 13 };
}; // namespace
......@@ -342,6 +342,18 @@ void RenderBox::outlineBox(QPainter *p, int _tx, int _ty, const char *color)
p->drawRect(_tx, _ty, m_width, m_height);
}
QRect RenderBox::getOverflowClipRect(int tx, int ty)
{
// XXX When overflow-clip (CSS3) is implemented, we'll obtain the property
// here.
int bl=borderLeft(),bt=borderTop(),bb=borderBottom(),br=borderRight();
int clipx = tx+bl;
int clipy = ty+bt;
int clipw = m_width-bl-br;
int cliph = m_height-bt-bb;
return QRect(clipx,clipy,clipw,cliph);
}
QRect RenderBox::getClipRect(int tx, int ty)
{
......
......@@ -121,6 +121,7 @@ protected:
void calcAbsoluteHorizontal();
void calcAbsoluteVertical();
virtual QRect getOverflowClipRect(int tx, int ty);
virtual QRect getClipRect(int tx, int ty);
// the actual height of the contents + borders + padding
......
......@@ -332,12 +332,6 @@ void RenderFlow::layout()
m_overflowHeight = m_height;
}
// overflow:hidden will just clip, so we don't have overflow.
if (style()->overflow()==OHIDDEN) {
m_overflowHeight = m_height;
m_overflowWidth = m_width;
}
if (isTableCell()) {
// Table cells need to grow to accommodate both overhanging floats and
// blocks that have overflowed content.
......@@ -378,7 +372,13 @@ void RenderFlow::layout()
// Always ensure our overflow width is at least as large as our width.
if (m_overflowWidth < m_width)
m_overflowWidth = m_width;
// overflow:hidden will just clip, so we don't have overflow.
if (style()->overflow()==OHIDDEN) {
m_overflowHeight = m_height;
m_overflowWidth = m_width;
}
setLayouted();
}
......
......@@ -179,7 +179,8 @@ void
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);
QRect damageRect = QRect(x,y,w,h);
RenderLayer::RenderZTreeNode* node = constructZTree(damageRect, damageRect, this);
if (!node)
return;
......@@ -258,8 +259,7 @@ RenderLayer::paint(QPainter *p, int x, int y, int w, int h)
#endif
}
}
// Paint the layer.
elt->layer->renderer()->paint(p, x, y, w, h,
elt->absBounds.x() - elt->layer->renderer()->xPos(),
elt->absBounds.y() - elt->layer->renderer()->yPos(),
......@@ -284,7 +284,8 @@ bool
RenderLayer::nodeAtPoint(RenderObject::NodeInfo& info, int x, int y)
{
bool inside = false;
RenderLayer::RenderZTreeNode* node = constructZTree(QRect(x, y, 0, 0), this, true);
QRect damageRect = QRect(x,y,0,0);
RenderLayer::RenderZTreeNode* node = constructZTree(damageRect, damageRect, this, true);
if (!node)
return false;
......@@ -315,7 +316,7 @@ RenderLayer::nodeAtPoint(RenderObject::NodeInfo& info, int x, int y)
}
RenderLayer::RenderZTreeNode*
RenderLayer::constructZTree(QRect damageRect,
RenderLayer::constructZTree(QRect overflowClipRect, QRect posClipRect,
RenderLayer* rootLayer,
bool eventProcessing)
{
......@@ -334,10 +335,9 @@ RenderLayer::constructZTree(QRect damageRect,
// damage rect and avoid repainting the layer if it falls outside that rect.
// An exception to this rule is the root layer, which always paints (hence the
// m_parent null check below).
if (!m_object->isPositioned())
updateLayerPosition(); // For relpositioned layers or non-positioned layers,
// we need to keep in sync, since we may have shifted relative
// to our parent layer.
updateLayerPosition(); // For relpositioned layers or non-positioned layers,
// we need to keep in sync, since we may have shifted relative
// to our parent layer.
int x = 0;
int y = 0;
......@@ -346,22 +346,32 @@ RenderLayer::constructZTree(QRect damageRect,
returnNode = new (renderArena) RenderZTreeNode(this);
// 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(QRect(x,y,m_object->width(), m_object->height()));
// 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;
QRect clipRect = damageRect;
if (m_object->style()->overflow() == OHIDDEN || m_object->style()->hasClip()) {
// Update the clip rects that will be passed to children layers.
if (m_object->hasOverflowClip() || m_object->hasClip()) {
// This layer establishes a clip of some kind.
clipOriginator = true;
QRect backgroundRect(x,y,m_object->width(), m_object->height());
clipRect = m_object->getClipRect(x, y);
if ((eventProcessing && !backgroundRect.contains(damageRect.x(),
damageRect.y())) ||
(!eventProcessing && !backgroundRect.intersects(damageRect)))
return 0; // We don't overlap at all.
if (!eventProcessing) {
damageRect = damageRect.intersect(backgroundRect);
clipRect = damageRect.intersect(clipRect);
if (m_object->hasOverflowClip()) {
QRect newOverflowClip = m_object->getOverflowClipRect(x,y);
overflowClipRect = newOverflowClip.intersect(overflowClipRect);
clipRectToApply = clipRectToApply.intersect(newOverflowClip);
}
if (m_object->hasClip()) {
QRect newPosClip = m_object->getClipRect(x,y);
if (m_object->hasOverflowClip())
newPosClip = newPosClip.intersect(m_object->getOverflowClipRect(x,y));
posClipRect = newPosClip.intersect(posClipRect);
overflowClipRect = overflowClipRect.intersect(posClipRect);
clipRectToApply = clipRectToApply.intersect(newPosClip);
}
}
......@@ -372,7 +382,8 @@ RenderLayer::constructZTree(QRect damageRect,
if (child->zIndex() < 0)
continue; // Ignore negative z-indices in this first pass.
RenderZTreeNode* childNode = child->constructZTree(clipRect, rootLayer, eventProcessing);
RenderZTreeNode* childNode = child->constructZTree(overflowClipRect, posClipRect,
rootLayer, eventProcessing);
if (childNode) {
// Put the new node into the tree at the front of the parent's list.
if (lastChildNode)
......@@ -395,7 +406,8 @@ RenderLayer::constructZTree(QRect damageRect,
damageRect.y())) ||
(!eventProcessing && layerBounds.intersects(damageRect))) {
RenderLayerElement* layerElt = new (renderArena) RenderLayerElement(this, layerBounds,
damageRect, clipRect, clipOriginator, x, y);
damageRect, clipRectToApply,
clipOriginator, x, y);
if (returnNode->child) {
RenderZTreeNode* leaf = new (renderArena) RenderZTreeNode(layerElt);
leaf->next = returnNode->child;
......@@ -416,7 +428,8 @@ RenderLayer::constructZTree(QRect damageRect,
if (child->zIndex() >= 0)
continue; // Ignore non-negative z-indices in this second pass.
RenderZTreeNode* childNode = child->constructZTree(clipRect, rootLayer, eventProcessing);
RenderZTreeNode* childNode = child->constructZTree(overflowClipRect, posClipRect,
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
......
......@@ -213,7 +213,7 @@ public:
};
private:
// The createZTree function creates a z-tree for a given layer hierarchy
// The constructZTree function creates a z-tree for a given layer hierarchy
// rooted on this layer. It will ensure that immediate child
// elements of a given z-tree node are at least initially sorted
// into <negative z-index children>, <this layer>, <non-negative z-index
......@@ -240,7 +240,8 @@ private:
// +-------> L(L5)
// +-------> L(L6)
//
RenderZTreeNode* constructZTree(QRect damageRect,
RenderZTreeNode* constructZTree(QRect overflowClipRect,
QRect clipRect,
RenderLayer* rootLayer,
bool eventProcessing = false);
......
......@@ -281,7 +281,22 @@ void RenderObject::setLayouted(bool b)
RenderObject *root = this;
bool rootAlreadyNeedsLayout = false;
RenderObject* clippedObj = (style()->overflow() == OHIDDEN) ? this : 0;
RenderObject* clippedObj =
(style()->overflow() == OHIDDEN && !isText()) ? this : 0;
if (clippedObj) {
// Update our hack for positioned objects. It doesn't work because
// this can be called from setStyle. This whole clip hack is evil and must die. -dwh
bool positioned = style()->position() == ABSOLUTE ||
style()->position() == FIXED;
bool relpositioned = style()->position() == RELATIVE;
if (positioned && !isPositioned()) {
setPositioned(true);
setInline(false);
}
else if (relpositioned && !isRelPositioned())
setRelPositioned(true);
}
while( o ) {
root = o;
......@@ -298,11 +313,11 @@ void RenderObject::setLayouted(bool b)
root->layout();
clippedObj->repaint();
gClipObject = 0;
m_layouted = true;
}
else
root->scheduleRelayout();
}
}
}
......
......@@ -109,7 +109,10 @@ public:
virtual void setHasChildLayers(bool hasLayers) { }
virtual void positionChildLayers() { }
virtual QRect getOverflowClipRect(int tx, int ty) { return QRect(0,0,0,0); }
virtual QRect getClipRect(int tx, int ty) { return QRect(0,0,0,0); }
bool hasClip() { return isPositioned() && style()->hasClip(); }
bool hasOverflowClip() { return style()->overflow() == OHIDDEN; }
// RenderObject tree manipulation
//////////////////////////////////////////
......
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