Auto merge of #19492 - tigercosmos:b1, r=jdm

use entry global's origin in `is_origin_clean` check for canvas rendering

use entry global's origin in `is_origin_clean` check for canvas rendering

There is no change with:
```
./mach test-wpt tests/wpt/web-platform-tests/2dcontext
./mach test-wpt tests/wpt/web-platform-tests/html/semantics/embedded-content/the-canvas-element
```

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix  #19480 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19492)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-12-05 11:33:03 -06:00 committed by GitHub
commit 79f43ec3b5

View file

@ -30,7 +30,7 @@ use dom::canvaspattern::CanvasPattern;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use dom::htmlcanvaselement::HTMLCanvasElement; use dom::htmlcanvaselement::HTMLCanvasElement;
use dom::imagedata::ImageData; use dom::imagedata::ImageData;
use dom::node::{document_from_node, Node, NodeDamage, window_from_node}; use dom::node::{Node, NodeDamage, window_from_node};
use dom_struct::dom_struct; use dom_struct::dom_struct;
use euclid::{Transform2D, Point2D, Vector2D, Rect, Size2D, vec2}; use euclid::{Transform2D, Point2D, Vector2D, Rect, Size2D, vec2};
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};
@ -249,13 +249,8 @@ impl CanvasRenderingContext2D {
CanvasImageSource::CanvasRenderingContext2D(image) => CanvasImageSource::CanvasRenderingContext2D(image) =>
image.origin_is_clean(), image.origin_is_clean(),
CanvasImageSource::HTMLImageElement(image) => { CanvasImageSource::HTMLImageElement(image) => {
let canvas = match self.canvas {
Some(ref canvas) => canvas,
None => return false,
};
let image_origin = image.get_origin().expect("Image's origin is missing"); let image_origin = image.get_origin().expect("Image's origin is missing");
let document = document_from_node(&**canvas); image_origin.same_origin(GlobalScope::entry().origin())
document.url().clone().origin() == image_origin
} }
CanvasImageSource::CSSStyleValue(_) => true, CanvasImageSource::CSSStyleValue(_) => true,
} }