Commit graph

109 commits

Author SHA1 Message Date
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Thiago Pontes
a2a9c0489d Make use of FromStr and Default traits in lib canvas
fixup! Make use of FromStr and Default traits in lib canvas
2015-09-03 14:42:53 -03:00
Brandon Fairchild
d61a6e2161 Fix reported test-tidy errors
This fixes lines that were reported to have missing
space after a comma.
2015-09-01 16:30:42 -04:00
Corey Farwell
5ccb0d43ef Merge adjacent identical impl sections
Prior to #7416 and #7401, many of these `impl` sections were not
identical
2015-08-28 10:30:42 -04:00
Anthony Ramine
709d347872 Make the traits for the IDL interfaces take &self 2015-08-27 22:27:43 +02:00
Anthony Ramine
c831c2c0a5 Remove helper traits
Now that JSRef<T> is gone, there is no need to have helper traits.

On components/script/*.rs:

    # Remove imports.
    /^ *use dom::[a-z]+::\{.*Helpers/ {
        s/\{(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers, /\{/
        s/, (Raw[^L]|[^L][^a])[a-zA-Z]+Helpers([,}])/\2/g
        s/\{([a-zA-Z]+)\}/\1/
        /\{\}/d
        s/::self;$/;/
    }
    /^ *use dom::[a-z]+::\{?(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers\}?;$/d

On components/script/dom/*.rs:

    # Ignore layout things.
    /^(pub )?(impl|trait).*Layout.* \{/,/^}$/ { P; D; }

    # Delete helpers traits.
    /^(pub )?trait ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? \{$/,/^\}$/D

    # Patch private helpers.
    /^impl.*Private.*Helpers/,/^\}$/ {
        s/^impl<'a> Private([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for &'a ([^ ]+) \{$/impl \3 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

    # Patch public helpers.
    /^impl.*Helpers/,/^\}$/ {
        s/^impl(<'a>)? ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for (&'a )?([^ ]+) \{$/impl \5 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn .*\(&?self[,)]/s/(unsafe )?fn/pub &/
        /^ *pub (unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

The few error cases were then fixed by hand.
2015-08-27 16:59:02 +02:00
João Oliveira
fd87c8cb3e make dom_struct derive HeapSizeOf,
closes #7357
2015-08-27 01:17:48 +01:00
ecoal95
6341c77700 webgl: Implement multiple calls and improve error detection
This commit implements WebGL's:
 * cullFace
 * frontFace
 * enable
 * disable
 * depthMask
 * colorMask
 * clearDepth
 * clearStencil
 * depthFunc
 * depthRange
 * hint
 * lineWidth
 * pixelStorei
 * polygonOffset
 * texParameteri
 * texParameterf
 * texImage2D (partially)

It inlines a lot of OpenGL calls to keep the file
`components/canvas/webgl_paint_task.rs` as small as possible while
keeping readability.

It also improves error detection on previous calls, and sets node damage
on the canvas in the drawing calls.

It adds a `TexImage2D` reftest, even though it's not enabled because:
 * WebGL paints the image when it loads (asynchronously), so the reftest doesn't wait for it and it finishes early
 * If we change the source for the base64 src of the image it works as expected in non-headless mode, but the test harness locks
2015-08-25 17:16:46 +02:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
Bogdan Cuza
45145108da Measure heap memory usage for more types. Fixes #6951 2015-08-13 21:44:41 +03:00
bors-servo
6a8bc85284 Auto merge of #7092 - dzbarsky:putimagedata, r=jdm
Clean up and fix PutImageData



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7092)
<!-- Reviewable:end -->
2015-08-09 07:00:56 -06:00
David Zbarsky
2f47bdff4b Fix getImageData with sizes < 1 pixel 2015-08-08 15:43:22 -04:00
David Zbarsky
51938d579f Switch PutImageData to using CopySurface 2015-08-08 15:35:08 -04:00
David Zbarsky
48c24f8492 Pass a Rect instead of an Option<Rect> to PutImageData 2015-08-08 04:50:55 -04:00
David Zbarsky
fee8abe5a2 GetImageData should return un-premultiplied alpha values 2015-08-06 05:14:53 -04:00
David Zbarsky
8690414a47 Refactor DrawImage implementations to avoid code duplication 2015-08-06 00:52:28 -04:00
bors-servo
debd7d87d6 Auto merge of #6974 - dzbarsky:tiny-create, r=jdm
Fix createImageData with sizes < 1 pixel



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6974)
<!-- Reviewable:end -->
2015-08-05 11:40:20 -06:00
David Zbarsky
2fb5fda5d0 Fix createImageData with sizes < 1 pixel 2015-08-04 15:45:38 -04:00
David Zbarsky
75e444c3b2 Make createRadialGradient throw for negative radii 2015-08-04 15:08:37 -04:00
David Zbarsky
9e5c2e22d8 Clean up some methods in CanvasRendeingContext2D 2015-08-03 23:32:11 -04:00
Patrick Walton
82b53d83ff script: Make the ImageCacheTask use IPC.
This necessitated getting rid of the boxed trait object that was being
be passed between the script task and the image cache task.
2015-07-26 23:07:44 -07:00
Patrick Walton
bb99b2f3c8 script: Make most of 2D canvas and WebGL run over IPC.
To actually make the multiprocess communication work, we'll need to
reroute the task creation to the pipeline or the compositor. But this
works as a first step.
2015-07-25 00:50:12 -07:00
Glenn Watson
83301ebb75 Add servo Image type. Remove rust-png dependency from script, gfx, layout. 2015-07-07 08:45:01 +10:00
David Winslow
4cf46bff2d Refactor #[jstraceable] to #[derive(JSTraceable)]
fixes #6524
2015-07-01 18:27:06 -04:00
Hyowon Kim
0e8491fb8c Create pattern from HTMLCanvasElement or CanvasRenderingContext2D. 2015-06-24 09:56:28 +09:00
bors-servo
02303941be Auto merge of #6413 - hyowon:invalid_shadow_attrs, r=Ms2ger
Check invalid values for the shadow attributes.

I left out checking invalid values when setting the shadows attributes.
r? @nox @pcwalton 
cc @yichoi

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6413)
<!-- Reviewable:end -->
2015-06-20 06:44:08 -06:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
ecoal95
8cbfb3482c Use euclid from crates.io 2015-06-19 00:04:24 +02:00
Hyowon Kim
cc55e2e426 Check invalid values for the shadow attributes. 2015-06-18 16:54:12 +09:00
Corey Farwell
5c408d2be9 rust-geom API changes
https://github.com/servo/rust-geom/pull/81
2015-06-13 12:28:21 -07:00
Hyowon Kim
00240e5550 Implementation of pattern fill style for canvas. 2015-06-13 14:35:13 +09:00
Mátyás Mustoha
3ae64fe739 Remove gfx_traits from the dependencies of [script]. 2015-06-12 12:59:46 +02:00
Hyowon Kim
473afdb196 Add attributes for canvas shadows. 2015-06-12 09:40:00 +09:00
Hyowon Kim
5bbfb42e90 Replace fill_color and stroke_color with fill_style and stroke_style in CanvasContextState.
The fillStyle and strokeStyle attributes can be either
strings(color), CanvasGradients, or CanvasPatterns.
2015-06-06 16:15:11 +09:00
Hyowon Kim
5d05ffc417 Serialize colors for fill and stroke styles in canvas. 2015-06-03 09:11:24 +09:00
bors-servo
0de09b936e Auto merge of #6183 - ecoal95:webglcontextattributes, r=nox
r? @jdm

I couldn't add the `getContextAttributes` method since `CodegenRust`
doesn't know how to return a dictionary value, I'll take a look at it ASAP.

I think the helper functions can return directly the renderer, since they're used just for that, but I wanted to hear your opinions about this.

By the way I'm interested in adding more serious tests for WebGL, and I think the [khronos conformance suit](https://github.com/KhronosGroup/WebGL/tree/master/conformance-suites/1.0.3) should be the best option.

Should I try to integrate it in wpt, or making a `tests/webgl` directory (or similar) inside the servo tree? (Maybe this question should be for @Ms2ger)

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6183)
<!-- Reviewable:end -->
2015-06-01 08:37:48 -05:00
ecoal95
b3ac346749 Add WebGLContextAttributes support
This commit also:
* Allows to return non-rootable dictionaries from
Codegen.
* Merges the two context types in an enum type.
2015-06-01 15:29:38 +02:00
Hyowon Kim
a512e9e507 Correct the calculation of rects for drawimage. 2015-06-01 15:58:38 +09:00
Corey Farwell
8e3f4bba85 Reduce max line length from 150 to 120 characters
Part of https://github.com/servo/servo/issues/6041
2015-05-24 00:01:49 -04:00
bors-servo
77099b25d5 Auto merge of #5586 - pcwalton:no-broken-background-image-redux, r=glennw
r? @jdm

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5586)
<!-- Reviewable:end -->
2015-05-20 16:43:31 -05:00
Patrick Walton
7e7675c1dc net: Don't load the placeholder image for background images, only for
image fragments.

This also changes the way the placeholder is handled in the image cache
task to decode it up front instead of each time an image fails to load,
both because it was more convenient to implement that way and because
it saves CPU cycles to do so.

This matches the behavior of Gecko and WebKit. It improves the look of
our cached copy of Wikipedia.
2015-05-20 12:00:33 -07:00
ecoal95
3350522306 Layerize canvas
Note that this keeps using readback right now, `NativeSurface` painting
will be implemented soon.

Also see https://github.com/servo/servo/issues/6142
2015-05-20 19:10:50 +02:00
bors-servo
5f2a8494be Auto merge of #5949 - mmatyas:canvas_dirty, r=jdm
With this patch, it is now possible to create nice animations using the canvas.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5949)
<!-- Reviewable:end -->
2015-05-07 07:09:41 -05:00
Mátyás Mustoha
9302aaab96 Canvas: implement transformation matrix reset. 2015-05-06 20:37:14 +02:00
Mátyás Mustoha
53af4e4cb5 Mark the canvas as dirty on certain drawing calls. 2015-05-06 20:27:26 +02:00
bors-servo
3327fe3013 Auto merge of #5945 - mmatyas:canvas_mxrotate, r=jdm
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5945)
<!-- Reviewable:end -->
2015-05-06 08:53:56 -05:00
Mátyás Mustoha
e3e2119c4c Canvas: implement transformation matrix rotation. 2015-05-06 12:38:48 +02:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00