Ejemplo n.º 1
0
NS_IMETHODIMP nsViewManager::InvalidateViewNoSuppression(nsIView *aView,
                                                         const nsRect &aRect)
{
  NS_PRECONDITION(nsnull != aView, "null view");

  nsView* view = static_cast<nsView*>(aView);

  NS_ASSERTION(view->GetViewManager() == this,
               "InvalidateViewNoSuppression called on view we don't own");

  nsRect damagedRect(aRect);
  if (damagedRect.IsEmpty()) {
    return NS_OK;
  }

  nsView* displayRoot = static_cast<nsView*>(GetDisplayRootFor(view));
  nsViewManager* displayRootVM = displayRoot->GetViewManager();
  // Propagate the update to the displayRoot, since iframes, for example,
  // can overlap each other and be translucent.  So we have to possibly
  // invalidate our rect in each of the widgets we have lying about.
  damagedRect.MoveBy(view->GetOffsetTo(displayRoot));
  PRInt32 rootAPD = displayRootVM->AppUnitsPerDevPixel();
  PRInt32 APD = AppUnitsPerDevPixel();
  damagedRect = damagedRect.ConvertAppUnitsRoundOut(APD, rootAPD);

  // accumulate this rectangle in the view's dirty region, so we can
  // process it later.
  AddDirtyRegion(displayRoot, nsRegion(damagedRect));

  return NS_OK;
}
Ejemplo n.º 2
0
static void invalidateNodeBoundingRect(WebViewImpl* webView)
{
    // FIXME: Is it important to just invalidate the rect of the node region
    // given that this is not on a critical codepath?  In order to do so, we'd
    // have to take scrolling into account.
    const WebSize& size = webView->size();
    WebRect damagedRect(0, 0, size.width, size.height);
    if (webView->client())
        webView->client()->didInvalidateRect(damagedRect);
}
Ejemplo n.º 3
0
void WebDevToolsAgentImpl::hideHighlight()
{
    // FIXME: able to invalidate a smaller rect.
    // FIXME: Is it important to just invalidate the rect of the node region
    // given that this is not on a critical codepath?  In order to do so, we'd
    // have to take scrolling into account.
    const WebSize& size = m_webViewImpl->size();
    WebRect damagedRect(0, 0, size.width, size.height);
    if (m_webViewImpl->client())
        m_webViewImpl->client()->didInvalidateRect(damagedRect);
}
Ejemplo n.º 4
0
void gxLightweightControl::OnPaint(wxPaintEvent& WXUNUSED(event))
{
  
  gxPaintDC dc(this);

  // What will be the clip region - a union between all damaged regions.
  gxRect clipRect;

  // Get the damaged areas and put in a gxRects vector.
  gxRects damagedRects;
  wxRegionIterator upd(GetUpdateRegion()); 
  while (upd)
  {
    wxRect rect = upd.GetRect();
    gxRect damagedRect(rect.x, rect.y, rect.width, rect.height);
    // Union the damaged recangle with the clip region
    clipRect.Union(damagedRect);
    damagedRects.push_back(damagedRect);
    upd ++ ;
  }
  
  // Set an absolute clip area (to the union between all damaged areas).
  dc.DestroyClippingRegion();
  dc.SetClippingRegion(clipRect);

  // Temporal: Draw chess board
  dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
  wxSize size = GetSize();
  int boxSize = 40;
  for (int x = 0; x <= (int)(size.GetWidth() / boxSize); x++)
  {
    for (int y = 0; y <= (int)(size.GetHeight() / boxSize); y++)
    {
      if ( (x + y) % 2 == 0)
        dc.SetBrush(wxBrush(wxColor(240,240,240)));
      else
        dc.SetBrush(wxBrush(wxColor(255,255,255)));
      dc.DrawRectangle(x * boxSize, y * boxSize, boxSize, boxSize);     
    }
  }
  dc.SetBrush(wxBrush(_T("white"), wxSOLID));
  dc.SetPen(*wxBLACK_PEN);
  
  // Delegate paint duties to the lightweight system.
  if (mLightweightSystem)
  {
    mLightweightSystem->Paint(&dc, damagedRects);
  }
}
Ejemplo n.º 5
0
void WebPopupMenuImpl::resize(const WebSize& newSize)
{
    if (m_size == newSize)
        return;
    m_size = newSize;

    if (m_widget) {
        IntRect newGeometry(0, 0, m_size.width, m_size.height);
        m_widget->setFrameRect(newGeometry);
    }

    if (m_client) {
        WebRect damagedRect(0, 0, m_size.width, m_size.height);
        m_client->didInvalidateRect(damagedRect);
    }
}