Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 2336693002: Rendering text to a canvas in a frame-less document. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
index b26fac88465498fccc4f47f4de8167617a340e20..4428ca259a9f712e88db8429570d19ffbd77bd92 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -374,10 +374,6 @@ SkImageFilter* CanvasRenderingContext2D::stateGetFilter()
void CanvasRenderingContext2D::snapshotStateForFilter()
{
- // The style resolution required for fonts is not available in frame-less documents.
- if (!canvas()->document().frame())
- return;
-
modifiableState().setFontForFilter(accessFont());
}
@@ -443,10 +439,6 @@ String CanvasRenderingContext2D::font() const
void CanvasRenderingContext2D::setFont(const String& newFont)
{
- // The style resolution required for rendering text is not available in frame-less documents.
- if (!canvas()->document().frame())
- return;
-
canvas()->document().updateStyleAndLayoutTreeForNode(canvas());
// The following early exit is dependent on the cache not being empty
@@ -727,10 +719,6 @@ TextMetrics* CanvasRenderingContext2D::measureText(const String& text)
{
TextMetrics* metrics = TextMetrics::create();
- // The style resolution required for rendering text is not available in frame-less documents.
- if (!canvas()->document().frame())
- return metrics;
-
canvas()->document().updateStyleAndLayoutTreeForNode(canvas());
const Font& font = accessFont();
@@ -772,10 +760,6 @@ TextMetrics* CanvasRenderingContext2D::measureText(const String& text)
void CanvasRenderingContext2D::drawTextInternal(const String& text, double x, double y, CanvasRenderingContext2DState::PaintType paintType, double* maxWidth)
{
- // The style resolution required for rendering text is not available in frame-less documents.
- if (!canvas()->document().frame())
- return;
-
// accessFont needs the style to be up to date, but updating style can cause script to run,
// (e.g. due to autofocus) which can free the canvas (set size to 0, for example), so update
// style before grabbing the drawingCanvas.

Powered by Google App Engine
This is Rietveld 408576698