Example #1
0
void ScrollbarTheme::readyWRATHScrollCorner(ScrollView *sc, PaintedWidgetsOfWRATHHandleT<ScrollView> &hnd,
                                            ContextOfWRATH *context, const IntRect& cornerRect)
{
  ScrollbarTheme_WRATHCorner *d;
  
  d=ScrollbarTheme_WRATHCorner::object(sc, hnd);
  ContextOfWRATH::AutoPushNode autoPushRoot(context, d->m_root_node);

  d->m_item.update(context, cornerRect, WebCore::Color(Color::white),
                   CompositeCopy);
}
Example #2
0
void RootInlineBox::readyWRATHWidgets(PaintedWidgetsOfWRATHHandleT<InlineBox> &handle, 
                                      PaintInfoOfWRATH &paintInfo, int tx, int ty, int lineTop, int lineBottom)
{
  RootInlineBox_WRATHWidgets *d;

  d=RootInlineBox_WRATHWidgets::object(this, handle);

  ContextOfWRATH::AutoPushNode autoPushRoot(paintInfo.wrath_context, d->m_root_node);  

  InlineFlowBox::readyWRATHWidgets(d->m_inlineFlowBox, paintInfo, tx, ty, lineTop, lineBottom);
  readyWRATHEllipsisBox(d->m_ellipsis, paintInfo, tx, ty, lineTop, lineBottom);
  
}
Example #3
0
void RenderScrollbar::readyWRATHWidgetPart(ContextOfWRATH *ctx,
                                           PaintedWidgetsOfWRATHHandleT<Scrollbar> &hnd,
                                           ScrollbarPart partType, const IntRect &rect)
{
    RenderScrollbar_RenderPart *d;
    
    d=RenderScrollbar_RenderPart::object(this, hnd);
    ContextOfWRATH::AutoPushNode autoPushRoot(ctx, d->m_root_node);
    
    d->m_part.visible(false);

    RenderScrollbarPart* partRenderer = m_parts.get(partType);
    if (!partRenderer)
        return;
    
    d->m_part.visible(true);
    partRenderer->readyWRATHWidgetIntoRect(d->m_part, ctx, x(), y(), rect);
}
Example #4
0
void RenderFrameSet::readyWRATHWidgetColumnBorder(PaintedWidgetsOfWRATHHandle& handle,
						  const PaintInfoOfWRATH& paintInfo, const IntRect& borderRect)
{
    if (!paintInfo.rect.intersects(borderRect))
        return;
    
    RenderFrameSet_ReadyWRATHWidgetColumnBorder *d(RenderFrameSet_ReadyWRATHWidgetColumnBorder::object(this, handle));
    ContextOfWRATH::AutoPushNode autoPushRoot(paintInfo.wrath_context, d->m_root_node);

    if (d->m_edge_stroke_begin.widget())
	d->m_edge_stroke_begin.widget()->visible(false);
    if (d->m_edge_stroke_end.widget())
	d->m_edge_stroke_end.widget()->visible(false);

    // FIXME: We should do something clever when borders from distinct framesets meet at a join.
    
    // Fill first.

    Color color = (frameSet()->hasBorderColor() ? style()->visitedDependentColor(CSSPropertyBorderLeftColor) : borderFillColor());
    d->m_fill.update(paintInfo.wrath_context, borderRect, color, CompositeSourceOver);
    
    // Now stroke the edges but only if we have enough room to paint both edges with a little
    // bit of the fill color showing through.
    if (borderRect.width() >= 3) {
        d->m_edge_stroke_begin.update(paintInfo.wrath_context, 
                                      IntRect(borderRect.location(), IntSize(1, height())),
                                      borderStartEdgeColor(), CompositeSourceOver);

	d->m_edge_stroke_end.update(paintInfo.wrath_context, 
                                    IntRect(IntPoint(borderRect.maxX() - 1, borderRect.y()), IntSize(1, height())),
                                    borderEndEdgeColor(), CompositeSourceOver);

	if(d->m_edge_stroke_begin.widget()) {
	  d->m_edge_stroke_begin.widget()->visible(true);
	}
	if(d->m_edge_stroke_end.widget()) {
	  d->m_edge_stroke_end.widget()->visible(true);
	}
    }
}
Example #5
0
void RenderFrameSet::readyWRATHWidgets(PaintedWidgetsOfWRATHHandle& handle,
				       PaintInfoOfWRATH& paintInfo, int tx, int ty)
{
    RenderFrameSet_ReadyWRATHWidgets *d(RenderFrameSet_ReadyWRATHWidgets::object(this, handle));
    ContextOfWRATH::AutoPushNode autoPushRoot(paintInfo.wrath_context, d->m_root_node);

    ContextOfWRATH::AutoPushNode autoPushSkip(paintInfo.wrath_context, d->m_skip_node);
    d->m_skip_node.widget()->visible(false);

    if (paintInfo.phase != PaintPhaseForeground)
        return;
    
    RenderObject* child = firstChild();
    if (!child)
        return;

    d->m_skip_node.widget()->visible(true);

    // Add in our offsets.
    tx += x();
    ty += y();

    int rows = frameSet()->totalRows();
    int cols = frameSet()->totalCols();
    int borderThickness = frameSet()->border();

    d->m_children.hideEachObject();
    d->m_column_borders.hideEachObject();
    d->m_row_borders.hideEachObject();

    int yPos = 0;
    for (int r = 0; r < rows; r++) {
        int xPos = 0;
        for (int c = 0; c < cols; c++) {
	    PaintedWidgetsOfWRATHHandle& ch(d->m_children.getHandle(child));
	    ch.visible(true);
            child->readyWRATHWidgets(ch, paintInfo, tx, ty);
            xPos += m_cols.m_sizes[c];
            if (borderThickness && m_cols.m_allowBorder[c + 1]) {
		PaintedWidgetsOfWRATHHandle& cbh(d->m_column_borders.getHandle(child));
		cbh.visible(true);
                readyWRATHWidgetColumnBorder(cbh, paintInfo, IntRect(tx + xPos, ty + yPos, borderThickness, height()));
                xPos += borderThickness;
            }
            child = child->nextSibling();
            if (!child) {
		d->m_children.removeNonVisibleHandles();
		d->m_column_borders.removeNonVisibleHandles();
		d->m_row_borders.removeNonVisibleHandles();
                return;
	    }
        }
        yPos += m_rows.m_sizes[r];
        if (borderThickness && m_rows.m_allowBorder[r + 1]) {
	    /* It's not exactly related to the child but it matches the separation */
	    /* TODO: Improve the explanation. */
	    PaintedWidgetsOfWRATHHandle& crh(d->m_row_borders.getHandle(child));
	    crh.visible(true);
	    readyWRATHWidgetRowBorder(crh, paintInfo, IntRect(tx, ty + yPos, width(), borderThickness));
            yPos += borderThickness;
        }
    }
    d->m_children.removeNonVisibleHandles();
    d->m_column_borders.removeNonVisibleHandles();
    d->m_row_borders.removeNonVisibleHandles();
}
Example #6
0
void RenderLineBoxList::readyWRATHWidgets(PaintedWidgetsOfWRATHHandle &handle,
                                          RenderBoxModelObject *renderer,
                                          PaintInfoOfWRATH &paintInfo, int tx, int ty)
{
    RenderLineBoxList_WRATHWidgets *d;
    d=RenderLineBoxList_WRATHWidgets::object(renderer, handle);

    ContextOfWRATH::AutoPushNode autoPushRoot(paintInfo.wrath_context, d->m_root_node);

    /*
      this just.. sucks. WebKit builds a list of 
      RenderInline objects that it will draw outlines.
      It is not clear if and how that list changes,
      so we punt and make all them handle non-visible
      and only those that are found in the list
      are then made visible.
     */
    d->m_handles.hideEachObject();
    d->m_outlineHandles.hideEachObject();

  // Only paint during the foreground/selection phases.
    if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseOutline 
        && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintPhaseChildOutlines && paintInfo.phase != PaintPhaseTextClip
        && paintInfo.phase != PaintPhaseMask)
        return;

    ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer->hasLayer())); // The only way an inline could paint like this is if it has a layer.

    // If we have no lines then we have no work to do.
    if (!firstLineBox())
        return;

    RenderView* v = renderer->view();
    bool usePrintRect = !v->printRect().isEmpty();
    int outlineSize = renderer->maximalOutlineSize(paintInfo.phase);
    if (!anyLineIntersectsRect(renderer, paintInfo.rect, tx, ty, usePrintRect, outlineSize))
        return;

    PaintInfoOfWRATH info(paintInfo);
    ListHashSet<RenderInline*> outlineObjects;
    info.outlineObjects = &outlineObjects;

    

    for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
        if (usePrintRect) {

            RootInlineBox* root = curr->root();
            int topForPaginationCheck = curr->logicalTopVisualOverflow(root->lineTop());
            int bottomForPaginationCheck = curr->logicalLeftVisualOverflow();
            if (!curr->parent()) {
                // We're a root box.  Use lineTop and lineBottom as well here.
                topForPaginationCheck = min(topForPaginationCheck, root->lineTop());
                bottomForPaginationCheck = max(bottomForPaginationCheck, root->lineBottom());
            }
            if (bottomForPaginationCheck - topForPaginationCheck <= v->printRect().height()) {
                if (ty + bottomForPaginationCheck > v->printRect().maxY()) {
                    if (RootInlineBox* nextRootBox = curr->root()->nextRootBox())
                        bottomForPaginationCheck = min(bottomForPaginationCheck, min(nextRootBox->logicalTopVisualOverflow(), nextRootBox->lineTop()));
                }
                if (ty + bottomForPaginationCheck > v->printRect().maxY()) {
                    if (ty + topForPaginationCheck < v->truncatedAt())
                        v->setBestTruncatedAt(ty + topForPaginationCheck, renderer);
                    // If we were able to truncate, don't paint.
                    if (ty + topForPaginationCheck >= v->truncatedAt())
                        break;
                }
            }
        }

        if (lineIntersectsDirtyRect(renderer, curr, info, tx, ty)) {
            RootInlineBox* root = curr->root();
            PaintedWidgetsOfWRATHHandleT<InlineBox> &currHandle(d->m_handles.getHandle(curr));

            currHandle.visible(true);
            curr->readyWRATHWidgets(currHandle, info, tx, ty, root->lineTop(), root->lineBottom());
        }
    }

    if (info.phase == PaintPhaseOutline || info.phase == PaintPhaseSelfOutline || info.phase == PaintPhaseChildOutlines) {
        ListHashSet<RenderInline*>::iterator end = info.outlineObjects->end();
        for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects->begin(); it != end; ++it) {
            RenderInline* flow = *it;
            PaintedWidgetsOfWRATHHandle &handle(d->m_outlineHandles.getHandle(flow));

            handle.visible(true);
            flow->readyWRATHWidgetOutline(handle, info.wrath_context, tx, ty);
        }
        info.outlineObjects->clear();
    }

    
    d->m_handles.removeNonVisibleHandles();
    d->m_outlineHandles.removeNonVisibleHandles();
}
Example #7
0
void BitmapImage::readyWRATHWidgets(PaintedWidgetsOfWRATHHandleT<Image>& handle, ContextOfWRATH *ctx,
                                    const FloatRect& dst, const FloatRect& src,
                                    ColorSpace styleColorSpace, CompositeOperator op)
{
    BitmapImage_readyWRATHWidgets *d(BitmapImage_readyWRATHWidgets::object(this, handle));

    ContextOfWRATH::AutoPushNode autoPushRoot(ctx, d->m_root_node);

    d->m_solid_color.visible(false);
    if (d->m_image_rect_item.widget())
        d->m_image_rect_item.widget()->visible(false);

    FloatRect normalizedDst = dst.normalized();
    FloatRect normalizedSrc = src.normalized();

    startAnimation();

    if (normalizedSrc.isEmpty() || normalizedDst.isEmpty())
        return;

    NativeImagePtr nativeImage = nativeImageForCurrentFrame();
    if (!nativeImage)
        return;

    // "Hardcode" the requirement for the underlying wrath image type to WRATHImage.
    // The reason is support for setting texture coordinates, which isn't possible for WRATHCompoundImage
    WRATHImage* image = nativeImage->getWrathImage();
    if (!image)
        return;

    if (mayFillWithSolidColor()) {
        d->m_solid_color.visible(true);
        readyWRATHWidgetSolidColor(d->m_solid_color, ctx, this, normalizedDst, solidColor(), styleColorSpace, op);
        return;
    }

    // ImageRectOfWRATH methods handle changing the op with respect to composite operator
    /*
    CompositeOperator previousOperator = ctxt->compositeOperation();
    ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
    */
    if(!nativeImage->hasAlpha() && op == CompositeSourceOver)
      {
        op=CompositeCopy;
      }
    
    /*
      [WRATH-DANGER]: No shadows

    ContextShadow* shadow = ctxt->contextShadow();
    if (shadow->m_type != ContextShadow::NoShadow) {
        QPainter* shadowPainter = shadow->beginShadowLayer(ctxt, normalizedDst);
        if (shadowPainter) {
            shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255);
            shadowPainter->drawPixmap(normalizedDst, *image, normalizedSrc);
            shadow->endShadowLayer(ctxt);
        }
    }
    */

    /*
      [WRATH-DANGER]: Possible rounding errors from converting to IntRect
     */
    d->m_image_rect_item.update(ctx, nativeImage,
                                normalizedDst, IntRect(normalizedSrc),
                                op);
    if (d->m_image_rect_item.widget())
      d->m_image_rect_item.widget()->visible(true);

    /*
      ctxt->platformContext()->drawPixmap(normalizedDst, *image, normalizedSrc);
    */

    /*
    ctxt->setCompositeOperation(previousOperator);
    */

    if (imageObserver())
        imageObserver()->didDraw(this);
}