⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 render_frames.cpp

📁 konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版本源码包.
💻 CPP
📖 第 1 页 / 共 3 页
字号:
#ifdef DEBUG_LAYOUT      kdDebug(6040) << "child frame at (" << xPos << "/" << yPos << ") size (" << m_gridLayout[1][c] << "/" << m_gridLayout[0][r] << ")" << endl;#endif      // has to be resized and itself resize its contents      if ((m_gridLayout[1][c] != child->width()) || (m_gridLayout[0][r] != child->height())) {          child->setWidth( m_gridLayout[1][c] );          child->setHeight( m_gridLayout[0][r] );          child->setNeedsLayout(true);          child->layout();      }      xPos += m_gridLayout[1][c] + element()->border();      child = child->nextSibling();      if ( !child )        return;    }    yPos += m_gridLayout[0][r] + element()->border();  }  // all the remaining frames are hidden to avoid ugly  // spurious unflowed frames  while ( child ) {      child->setWidth( 0 );      child->setHeight( 0 );      child->setNeedsLayout(false);      child = child->nextSibling();  }}bool RenderFrameSet::userResize( MouseEventImpl *evt ){    if (needsLayout()) return false;  bool res = false;  int _x = evt->clientX();  int _y = evt->clientY();  if ( !m_resizing && evt->id() == EventImpl::MOUSEMOVE_EVENT || evt->id() == EventImpl::MOUSEDOWN_EVENT )  {#ifdef DEBUG_LAYOUT    kdDebug( 6031 ) << "mouseEvent:check" << endl;#endif    m_hSplit = -1;    m_vSplit = -1;    //bool resizePossible = true;    // check if we're over a horizontal or vertical boundary    int pos = m_gridLayout[1][0] + xPos();    for(int c = 1; c < element()->totalCols(); c++)    {      if(_x >= pos && _x <= pos+element()->border())      {        if(m_vSplitVar && m_vSplitVar[c-1] == true) m_vSplit = c-1;#ifdef DEBUG_LAYOUT        kdDebug( 6031 ) << "vsplit!" << endl;#endif        res = true;        break;      }      pos += m_gridLayout[1][c] + element()->border();    }    pos = m_gridLayout[0][0] + yPos();    for(int r = 1; r < element()->totalRows(); r++)    {      if( _y >= pos && _y <= pos+element()->border())      {        if(m_hSplitVar && m_hSplitVar[r-1] == true) m_hSplit = r-1;#ifdef DEBUG_LAYOUT        kdDebug( 6031 ) << "hsplitvar = " << m_hSplitVar << endl;        kdDebug( 6031 ) << "hsplit!" << endl;#endif        res = true;        break;      }      pos += m_gridLayout[0][r] + element()->border();    }#ifdef DEBUG_LAYOUT    kdDebug( 6031 ) << m_hSplit << "/" << m_vSplit << endl;#endif  }  m_cursor = Qt::ArrowCursor;  if(m_hSplit != -1 && m_vSplit != -1)      m_cursor = Qt::SizeAllCursor;  else if( m_vSplit != -1 )      m_cursor = Qt::SizeHorCursor;  else if( m_hSplit != -1 )      m_cursor = Qt::SizeVerCursor;  if(!m_resizing && evt->id() == EventImpl::MOUSEDOWN_EVENT)  {      setResizing(true);      KApplication::setOverrideCursor(QCursor(m_cursor));      m_vSplitPos = _x;      m_hSplitPos = _y;      m_oldpos = -1;  }  // ### check the resize is not going out of bounds.  if(m_resizing && evt->id() == EventImpl::MOUSEUP_EVENT)  {    setResizing(false);    KApplication::restoreOverrideCursor();    if(m_vSplit != -1 )    {#ifdef DEBUG_LAYOUT      kdDebug( 6031 ) << "split xpos=" << _x << endl;#endif      int delta = m_vSplitPos - _x;      m_gridDelta[1][m_vSplit] -= delta;      m_gridDelta[1][m_vSplit+1] += delta;    }    if(m_hSplit != -1 )    {#ifdef DEBUG_LAYOUT      kdDebug( 6031 ) << "split ypos=" << _y << endl;#endif      int delta = m_hSplitPos - _y;      m_gridDelta[0][m_hSplit] -= delta;      m_gridDelta[0][m_hSplit+1] += delta;    }    // this just schedules the relayout    // important, otherwise the moving indicator is not correctly erased    setNeedsLayout(true);  }  KHTMLView *view = canvas()->view();  if ((m_resizing || evt->id() == EventImpl::MOUSEUP_EVENT) && view) {      QPainter paint( view );      paint.setPen( Qt::gray );      paint.setBrush( Qt::gray );      paint.setRasterOp( Qt::XorROP );      QRect r(xPos(), yPos(), width(), height());      const int rBord = 3;      int sw = element()->border();      int p = m_resizing ? (m_vSplit > -1 ? _x : _y) : -1;      if (m_vSplit > -1) {          if ( m_oldpos >= 0 )              paint.drawRect( m_oldpos + sw/2 - rBord , r.y(),                              2*rBord, r.height() );          if ( p >= 0 )              paint.drawRect( p  + sw/2 - rBord, r.y(), 2*rBord, r.height() );      } else {          if ( m_oldpos >= 0 )              paint.drawRect( r.x(), m_oldpos + sw/2 - rBord,                              r.width(), 2*rBord );          if ( p >= 0 )              paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );      }      m_oldpos = p;  }  return res;}void RenderFrameSet::setResizing(bool e){      m_resizing = e;      for (RenderObject* p = parent(); p; p = p->parent())          if (p->isFrameSet()) static_cast<RenderFrameSet*>(p)->m_clientresizing = m_resizing;}bool RenderFrameSet::canResize( int _x, int _y ){    // if we haven't received a layout, then the gridLayout doesn't contain useful data yet    if (needsLayout() || !m_gridLayout[0] || !m_gridLayout[1] ) return false;    // check if we're over a horizontal or vertical boundary    int pos = m_gridLayout[1][0];    for(int c = 1; c < element()->totalCols(); c++)        if(_x >= pos && _x <= pos+element()->border())            return true;    pos = m_gridLayout[0][0];    for(int r = 1; r < element()->totalRows(); r++)        if( _y >= pos && _y <= pos+element()->border())            return true;    return false;}#ifdef ENABLE_DUMPvoid RenderFrameSet::dump(QTextStream &stream, const QString &ind) const{    RenderBox::dump(stream,ind);    stream << " totalrows=" << element()->totalRows();    stream << " totalcols=" << element()->totalCols();    if ( m_hSplitVar )        for (uint i = 0; i < (uint)element()->totalRows(); i++) {            stream << " hSplitvar(" << i << ")=" << m_hSplitVar[i];        }    if ( m_vSplitVar )        for (uint i = 0; i < (uint)element()->totalCols(); i++)            stream << " vSplitvar(" << i << ")=" << m_vSplitVar[i];}#endif/**************************************************************************************/RenderPart::RenderPart(DOM::HTMLElementImpl* node)    : RenderWidget(node){    // init RenderObject attributes    setInline(false);}void RenderPart::setWidget( QWidget *widget ){#ifdef DEBUG_LAYOUT    kdDebug(6031) << "RenderPart::setWidget()" << endl;#endif    setQWidget( widget );    widget->setFocusPolicy(QWidget::WheelFocus);    if(widget->inherits("KHTMLView"))        connect( widget, SIGNAL( cleared() ), this, SLOT( slotViewCleared() ) );    setNeedsLayoutAndMinMaxRecalc();    // make sure the scrollbars are set correctly for restore    // ### find better fix    slotViewCleared();}bool RenderPart::partLoadingErrorNotify(khtml::ChildFrame *, const KURL& , const QString& ){    return false;}short RenderPart::intrinsicWidth() const{    return 300;}int RenderPart::intrinsicHeight() const{    return 200;}void RenderPart::slotViewCleared(){}/***************************************************************************************/RenderFrame::RenderFrame( DOM::HTMLFrameElementImpl *frame )    : RenderPart(frame){    setInline( false );}void RenderFrame::slotViewCleared(){    if(m_widget->inherits("QScrollView")) {#ifdef DEBUG_LAYOUT        kdDebug(6031) << "frame is a scrollview!" << endl;#endif        QScrollView *view = static_cast<QScrollView *>(m_widget);        if(!element()->frameBorder || !((static_cast<HTMLFrameSetElementImpl *>(element()->parentNode()))->frameBorder()))            view->setFrameStyle(QFrame::NoFrame);	    view->setVScrollBarMode(element()->scrolling );	    view->setHScrollBarMode(element()->scrolling );        if(view->inherits("KHTMLView")) {#ifdef DEBUG_LAYOUT            kdDebug(6031) << "frame is a KHTMLview!" << endl;#endif            KHTMLView *htmlView = static_cast<KHTMLView *>(view);            if(element()->marginWidth != -1) htmlView->setMarginWidth(element()->marginWidth);            if(element()->marginHeight != -1) htmlView->setMarginHeight(element()->marginHeight);        }    }}/****************************************************************************************/RenderPartObject::RenderPartObject( DOM::HTMLElementImpl* element )    : RenderPart( element ){    // init RenderObject attributes    setInline(true);}void RenderPartObject::updateWidget(){  QString url;  KHTMLPart *part = m_view->part();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -