[Webkit-unassigned] [Bug 6103] New: Rectangles are not filled according to the Web Applications Working Draft

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Thu Dec 15 14:39:12 PST 2005


http://bugzilla.opendarwin.org/show_bug.cgi?id=6103

           Summary: Rectangles are not filled according to the Web
                    Applications Working Draft
           Product: WebKit
           Version: 412+
          Platform: Macintosh
               URL: http://developer.mozilla.org/en/docs/Canvas_tutorial:App
                    lying_styles_and_colors#A_createLinearGradient_example
        OS/Version: Mac OS X 10.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: Layout and Rendering
        AssignedTo: webkit-unassigned at opendarwin.org
        ReportedBy: david.carson at nokia.com


Mozilla test case fails as the call to fillRect() does not use the specified
fillstyle (in this case a gradient).

Possible solution is implementing FillRect in kjs_html.cpp by building a path,
and using the same Fill code as filling a normal path:

        case Context2D::FillRect: {
            if (args.size() != 4) {
                Object err = Error::create(exec,SyntaxError);
                exec->setException(err);
                return err;
            }
            float x = (float)args[0].toNumber(exec);
            float y = (float)args[1].toNumber(exec);
            float w = (float)args[2].toNumber(exec);
            float h = (float)args[3].toNumber(exec);
            CGContextBeginPath(drawingContext);
            CGContextMoveToPoint (drawingContext, x, y);
            CGContextAddLineToPoint (drawingContext,x+w, y);
            CGContextAddLineToPoint (drawingContext,x+w, y+h);
            CGContextAddLineToPoint (drawingContext,x, y+h);
            CGContextClosePath(drawingContext);

            if (isGradient(contextObject->_fillStyle)) {
                CGContextSaveGState(drawingContext);
                
                // Set the clip from the current path because shading only
                // operates on clippin regions!  Odd, but true.
                CGContextClip(drawingContext);

                ObjectImp *o =
static_cast<ObjectImp*>(contextObject->_fillStyle.imp());
                Gradient *gradient = static_cast<Gradient*>(o);
                CGShadingRef shading = gradient->getShading();
                CGContextDrawShading(drawingContext, shading);
                
                CGContextRestoreGState(drawingContext);
            }
            else
                CGContextFillPath (drawingContext);

            renderer->setNeedsImageUpdate();
            break;
        }

Path creation should be safe as the existing call to CGContextFillRect() clears
the current path.

-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list