Patch proxy widget rendering and plugins
Koos Vriezen
koos.vriezen at xs4all.nl
Thu Nov 20 20:03:28 GMT 2003
Hi,
KHTML still does things with plugins, dispite code preventing it(*).
Attached something that skips the eventFilter and setBackgroundMode for
widgets not explicitly marked for it. Abused the 'name' for it. Not nice,
but other options I could think of like wrapping plugins or abusing plugin
widget names seems even less nice to me.
Reason for making this patch in the first place is the random disappearing
of the pixmaps on the KMPlayer control buttons and not showing an ugly
blue rectangle when a trailer is fullscreen (and ALT-TAB to konqueror)
but a hole instead. Also I'm still hunting why some java applets appear as
gray rectangles sometimes.
There is still something wrong with (*) khtmlview.cpp:461 (and the code
above) preventing painting over non-form/scrollview widgets. At least
the first time 'paint' is called, plugin widget are not added to the
d->visibleWidgets dict. No idea if it has something to do with gray
rectangles bug.
Koos
-------------- next part --------------
Index: khtmlview.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtmlview.cpp,v
retrieving revision 1.585
diff -u -3 -p -r1.585 khtmlview.cpp
--- khtmlview.cpp 19 Nov 2003 15:19:45 -0000 1.585
+++ khtmlview.cpp 20 Nov 2003 19:40:25 -0000
@@ -1207,7 +1207,7 @@ bool KHTMLView::eventFilter(QObject *o,
QWidget *w = static_cast<QWidget *>(c);
// don't install the event filter on toplevels
if (w->parentWidget(true) == view) {
- if (!::qt_cast<QScrollView *>(w)) {
+ if (!strcmp(w->name(), "__khtml")) {
w->installEventFilter(this);
w->unsetCursor();
w->setBackgroundMode( QWidget::NoBackground );
@@ -1230,10 +1230,12 @@ bool KHTMLView::eventFilter(QObject *o,
}
} else if (o->isWidgetType()) {
QWidget *v = static_cast<QWidget *>(o);
+ QWidget *c = v;
while (v && v != view) {
+ c = v;
v = v->parentWidget(true);
}
- if (v) {
+ if (v && !strcmp(c->name(), "__khtml")) {
bool block = false;
QWidget *w = static_cast<QWidget *>(o);
switch(e->type()) {
Index: rendering/render_form.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_form.cpp,v
retrieving revision 1.254
diff -u -3 -p -r1.254 render_form.cpp
--- rendering/render_form.cpp 13 Nov 2003 15:23:46 -0000 1.254
+++ rendering/render_form.cpp 20 Nov 2003 19:40:25 -0000
@@ -118,7 +118,7 @@ short RenderButton::baselinePosition( bo
RenderCheckBox::RenderCheckBox(HTMLInputElementImpl *element)
: RenderButton(element)
{
- QCheckBox* b = new QCheckBox(view()->viewport());
+ QCheckBox* b = new QCheckBox(view()->viewport(), "__khtml");
b->setAutoMask(true);
b->setMouseTracking(true);
setQWidget(b);
@@ -156,7 +156,7 @@ void RenderCheckBox::slotStateChanged(in
RenderRadioButton::RenderRadioButton(HTMLInputElementImpl *element)
: RenderButton(element)
{
- QRadioButton* b = new QRadioButton(view()->viewport());
+ QRadioButton* b = new QRadioButton(view()->viewport(), "__khtml");
b->setMouseTracking(true);
setQWidget(b);
}
@@ -187,7 +187,7 @@ void RenderRadioButton::calcMinMaxWidth(
RenderSubmitButton::RenderSubmitButton(HTMLInputElementImpl *element)
: RenderButton(element)
{
- QPushButton* p = new QPushButton(view()->viewport());
+ QPushButton* p = new QPushButton(view()->viewport(), "__khtml");
setQWidget(p);
p->setAutoMask(true);
p->setMouseTracking(true);
@@ -283,7 +283,7 @@ QString RenderPushButton::defaultLabel()
// -------------------------------------------------------------------------------
LineEditWidget::LineEditWidget(DOM::HTMLInputElementImpl* input, KHTMLView* view, QWidget* parent)
- : KLineEdit(parent), m_input(input), m_view(view), m_spell(0)
+ : KLineEdit(parent, "__khtml"), m_input(input), m_view(view), m_spell(0)
{
setMouseTracking(true);
KActionCollection *ac = new KActionCollection(this);
@@ -714,7 +714,7 @@ void RenderFieldset::paintBorderMinusLeg
RenderFileButton::RenderFileButton(HTMLInputElementImpl *element)
: RenderFormElement(element)
{
- KURLRequester* w = new KURLRequester( view()->viewport() );
+ KURLRequester* w = new KURLRequester( view()->viewport(), "__khtml" );
connect(w->lineEdit(), SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
connect(w->lineEdit(), SIGNAL(textChanged(const QString &)),this,SLOT(slotTextChanged(const QString &)));
@@ -807,7 +807,7 @@ RenderLegend::RenderLegend(HTMLGenericFo
// -------------------------------------------------------------------------------
ComboBoxWidget::ComboBoxWidget(QWidget *parent)
- : KComboBox(false, parent)
+ : KComboBox(false, parent, "__khtml")
{
setAutoMask(true);
if (listBox()) listBox()->installEventFilter(this);
@@ -1151,7 +1151,7 @@ void RenderSelect::setOptionsChanged(boo
KListBox* RenderSelect::createListBox()
{
- KListBox *lb = new KListBox(view()->viewport());
+ KListBox *lb = new KListBox(view()->viewport(), "__khtml");
lb->setSelectionMode(m_multiple ? QListBox::Extended : QListBox::Single);
// ### looks broken
//lb->setAutoMask(true);
Index: rendering/render_replaced.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_replaced.cpp,v
retrieving revision 1.148
diff -u -3 -p -r1.148 render_replaced.cpp
--- rendering/render_replaced.cpp 17 Nov 2003 07:20:10 -0000 1.148
+++ rendering/render_replaced.cpp 20 Nov 2003 19:40:25 -0000
@@ -202,7 +202,7 @@ void RenderWidget::setQWidget(QWidget *w
connect( m_widget, SIGNAL( destroyed()), this, SLOT( slotWidgetDestructed()));
m_widget->installEventFilter(this);
- if ( !::qt_cast<QScrollView*>( m_widget ) )
+ if ( !strcmp(m_widget->name(), "__khtml"))
m_widget->setBackgroundMode( QWidget::NoBackground );
if (m_widget->focusPolicy() > QWidget::StrongFocus)
@@ -417,7 +417,7 @@ void RenderWidget::paintWidget(QPainter
// We have some problems here, as we can't redirect some of the widgets.
allowWidgetPaintEvents = true;
- if (!::qt_cast<QScrollView *>(widget)) {
+ if (!strcmp(widget->name(), "__khtml")) {
bool dsbld = QSharedDoubleBuffer::isDisabled();
QSharedDoubleBuffer::setDisabled(true);
QPixmap pm = copyWidget(tx, ty, p, widget);
More information about the kfm-devel
mailing list