📄 render_frames.cpp
字号:
} pos += m_colWidth[c] + m_frameset->border(); } pos = m_rowHeight[0]; for(int r = 1; r < m_frameset->totalRows(); r++) { if( _y >= pos && _y <= pos+m_frameset->border()) { if(m_hSplitVar && m_hSplitVar[r-1] == true) m_hSplit = r-1;// kdDebug( 6031 ) << "hsplitvar = " << m_hSplitVar << endl;// kdDebug( 6031 ) << "hsplit!" << endl; res = true; break; } pos += m_rowHeight[r] + m_frameset->border(); }// kdDebug( 6031 ) << m_hSplit << "/" << m_vSplit << endl; /* QCursor cursor; if(m_hSplit != -1 && m_vSplit != -1) { cursor = Qt::sizeAllCursor; } else if( m_vSplit != -1 ) { cursor = Qt::splitHCursor; } else if( m_hSplit != -1 ) { cursor = Qt::splitVCursor; } if(type == DOM::NodeImpl::MousePress) { m_resizing = true; KApplication::setOverrideCursor(cursor); m_vSplitPos = _x; m_hSplitPos = _y; } else static_cast<MGHTMLView *>(m_view)->setCursor(cursor); */ } // ### need to draw a nice movin indicator for the resize. // ### check the resize is not going out of bounds. if(m_resizing && type == DOM::NodeImpl::MouseRelease) { m_resizing = false;#if 0 KApplication::restoreOverrideCursor();#endif if(m_vSplit != -1 ) {// kdDebug( 6031 ) << "split xpos=" << _x << endl; int delta = m_vSplitPos - _x; m_colWidth[m_vSplit] -= delta; m_colWidth[m_vSplit+1] += delta; } if(m_hSplit != -1 ) {// kdDebug( 6031 ) << "split ypos=" << _y << endl; int delta = m_hSplitPos - _y; m_rowHeight[m_hSplit] -= delta; m_rowHeight[m_hSplit+1] += delta; } positionFrames( ); } return res;}/**************************************************************************************/RenderPart::RenderPart( MGHTMLView *view ): RenderWidget( view ){ // init RenderObject attributes m_inline = false; // our object is not Inline m_view = view;}RenderPart::~RenderPart(){ // we must delete it delete m_widget;}void RenderPart::setWidget( MGWidget *widget ){ setQWidget(widget); if ( m_widget ) m_widget->show(); layout(); repaint();}void RenderPart::layout( ){ if ( m_widget ) { // find it is a good place to move child frame :-) int x = m_x, y = m_y; RenderObject *p = parent(); while( p ) { //kdDebug() << "In function: RenderPart::layout" << endl; //kdDebug() << "parent x pos = " << p->xPos() << endl; //kdDebug() << "parent y pos = " << p->yPos() << endl; int xoffset = p->xPos(); int yoffset = p->yPos(); if( xoffset > 0 ) x += xoffset; if( yoffset > 0 ) y += yoffset; p = p->parent(); } m_widget->resize( m_width, m_height );#if 0 setPos ( x, y ); m_widget->moveWindow( x, y );//#else m_widget->moveWindow( x, y );#endif m_widget->layout(); }}/***************************************************************************************/RenderFrame::RenderFrame( MGHTMLView *view, DOM::HTMLFrameElementImpl *frame ): RenderPart( view ){ m_frame = frame;}RenderFrame::~RenderFrame(){}void RenderFrame::setWidget( MGWidget *widget ){// kdDebug(6031) << "RenderFrame::setWidget()" << endl; RenderPart::setWidget(widget); /* slotViewCleared(); if(widget->inherits("KHTMLView")) connect( widget, SIGNAL( cleared() ), this, SLOT( slotViewCleared() ) ); */}/*void RenderFrame::slotViewCleared(){ if(m_widget->inherits("QScrollView")) { kdDebug(6031) << "frame is a scrollview!" << endl; MGHTMLView *view = static_cast<MGHTMLView *>(m_widget); if(!m_frame->frameBorder || !((static_cast<HTMLFrameSetElementImpl *>(m_frame->_parent))->frameBorder())) view->setFrameStyle(QFrame::NoFrame); view->setVScrollBarMode(m_frame->scrolling); view->setHScrollBarMode(m_frame->scrolling); if(view->inherits("KHTMLView")) { kdDebug(6031) << "frame is a KHTMLview!" << endl; MGHTMLView *htmlView = static_cast<MGHTMLView *>(view); if(m_frame->marginWidth != -1) htmlView->setMarginWidth(m_frame->marginWidth); if(m_frame->marginHeight != -1) htmlView->setMarginHeight(m_frame->marginHeight); } }}void RenderFrame::slotWidgetDestructed(){ RenderWidget::slotWidgetDestructed();}*//****************************************************************************************/RenderPartObject::RenderPartObject( MGHTMLView *view, DOM::HTMLElementImpl *o ): RenderPart( view ){ // init RenderObject attributes m_inline = true; // our object is Inline m_obj = o;}RenderPartObject::~RenderPartObject(){}void RenderPartObject::close(){ QString url; QString serviceType; /* if(m_obj->id() == ID_OBJECT) { // check for embed child object HTMLObjectElementImpl *o = static_cast<HTMLObjectElementImpl *>(m_obj); HTMLEmbedElementImpl *embed = 0; NodeImpl *child = o->firstChild(); while ( child ) { if ( child->id() == ID_EMBED ) embed = static_cast<HTMLEmbedElementImpl *>( child ); child = child->nextSibling(); } if ( !embed ) { url = o->url; serviceType = o->serviceType; if(serviceType.isEmpty() || serviceType.isNull()) { if(o->classId.contains(QString::fromLatin1("D27CDB6E-AE6D-11cf-96B8-444553540000"))) serviceType = "application/x-shockwave-flash"; // add more plugins here } if((url.isEmpty() || url.isNull())) { // look for a SRC attribute in the params NodeImpl *child = o->firstChild(); while ( child ) { if ( child->id() == ID_PARAM ) { HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>( child ); if ( p->name().lower()==QString::fromLatin1("src") || p->name().lower()==QString::fromLatin1("movie") || p->name().lower()==QString::fromLatin1("code") ) { url = p->value(); break; } } child = child->nextSibling(); } } // add all <param>'s to the QStringList argument of the part QStringList params; NodeImpl *child = o->firstChild(); while ( child ) { if ( child->id() == ID_PARAM ) { HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>( child ); QString aStr = p->name(); aStr += QString::fromLatin1("=\""); aStr += p->value(); aStr += QString::fromLatin1("\""); params.append(aStr); } child = child->nextSibling(); } if ( url.isEmpty() && serviceType.isEmpty() ) { kdDebug() << "RenderPartObject::close - empty url and serverType" << endl; return; } params.append( QString::fromLatin1("NSPLUGINEMBED=\"YES\"") ); static_cast<MGHTMLView *>(m_view)->part()->requestObject( this, url, serviceType, params ); } else { // render embed object url = embed->url; serviceType = embed->serviceType; if ( url.isEmpty() && serviceType.isEmpty() ) { kdDebug() << "RenderPartObject::close - empty url and serverType" << endl; return; } embed->param.append( QString::fromLatin1("NSPLUGINEMBED=\"YES\"") ); MGHTMLPart *part = static_cast<MGHTMLView *>(m_view)->part(); bool ok = part->requestObject( this, url, serviceType, embed->param ); kdDebug() << "RenderPartObject::close - ok=" << ok << " url=" << url << " serviceType=" << serviceType << endl; if ( !ok && !embed->pluginPage.isEmpty() ) { KParts::BrowserExtension *ext = part->browserExtension(); if ( ext ) ext->createNewWindow( KURL(embed->pluginPage) ); } } } else if ( m_obj->id() == ID_EMBED ) { HTMLEmbedElementImpl *o = static_cast<HTMLEmbedElementImpl *>(m_obj); url = o->url; serviceType = o->serviceType; if ( url.isEmpty() && serviceType.isEmpty() ) { kdDebug() << "RenderPartObject::close - empty url and serverType" << endl; return; } o->param.append( QString::fromLatin1("NSPLUGINEMBED=\"YES\"") ); MGHTMLPart *part = static_cast<MGHTMLView *>(m_view)->part(); bool ok = part->requestObject( this, url, serviceType, o->param ); if ( !ok && !o->pluginPage.isEmpty() ) { KParts::BrowserExtension *ext = part->browserExtension(); if ( ext ) ext->createNewWindow( KURL(o->pluginPage) ); } } else*/ { assert(m_obj->id() == ID_IFRAME); HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(m_obj); url = o->url.string(); if( url.isEmpty()) return; MGHTMLView *v = static_cast<MGHTMLView *>(m_view); v->part()->requestFrame( this, url, o->name.string() ); } layout(); RenderPart::close();}void RenderPartObject::setWidget( MGWidget *w ){ /* if(w->inherits("KHTMLView")) connect( w, SIGNAL( cleared() ), this, SLOT( slotViewCleared() ) ); */ if ( w && m_width == 0 && m_height == 0 ) { MGSize hint = w->sizeHint(); m_width = hint.width(); m_height = hint.height(); m_minWidth = m_maxWidth = m_width; } RenderPart::setWidget( w ); //slotViewCleared(); // WABA ??}void RenderPartObject::setSize( int w, int h ){ m_width = w; m_height = h; m_minWidth = m_maxWidth = w;}void RenderPartObject::layout( ){ // ### shouldn't this be relative to the containingBlock????? setSize( m_style->width().minWidth( m_view->visibleWidth() ), m_style->height().minWidth( m_view->visibleHeight() ) ); calcHorizontalMargins(style()->marginLeft(),style()->marginRight(), containingBlockWidth()); RenderPart::layout();}/*void RenderPartObject::slotViewCleared(){ if(m_widget->inherits("QScrollView") && m_obj->id() == ID_IFRAME) { kdDebug(6031) << "iframe is a scrollview!" << endl; QScrollView *view = static_cast<QScrollView *>(m_widget); HTMLIFrameElementImpl *m_frame = static_cast<HTMLIFrameElementImpl *>(m_obj); if(!m_frame->frameBorder) view->setFrameStyle(QFrame::NoFrame); view->setVScrollBarMode(m_frame->scrolling); view->setHScrollBarMode(m_frame->scrolling); if(view->inherits("KHTMLView")) { kdDebug(6031) << "frame is a KHTMLview!" << endl; KHTMLView *htmlView = static_cast<KHTMLView *>(view); if(m_frame->marginWidth != -1) htmlView->setMarginWidth(m_frame->marginWidth); if(m_frame->marginHeight != -1) htmlView->setMarginHeight(m_frame->marginHeight); } }}void RenderPartObject::slotWidgetDestructed(){ RenderWidget::slotWidgetDestructed();}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -