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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 211773002: Rename updateStyle to updateRenderTree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix tracing test Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/ImageDocument.cpp ('k') | Source/core/svg/SVGElementInstance.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 1986
1987 PassRefPtr<TextMetrics> CanvasRenderingContext2D::measureText(const String& text ) 1987 PassRefPtr<TextMetrics> CanvasRenderingContext2D::measureText(const String& text )
1988 { 1988 {
1989 RefPtr<TextMetrics> metrics = TextMetrics::create(); 1989 RefPtr<TextMetrics> metrics = TextMetrics::create();
1990 1990
1991 // The style resolution required for rendering text is not available in fram e-less documents. 1991 // The style resolution required for rendering text is not available in fram e-less documents.
1992 if (!canvas()->document().frame()) 1992 if (!canvas()->document().frame())
1993 return metrics.release(); 1993 return metrics.release();
1994 1994
1995 FontCachePurgePreventer fontCachePurgePreventer; 1995 FontCachePurgePreventer fontCachePurgePreventer;
1996 canvas()->document().updateStyleIfNeeded(); 1996 canvas()->document().updateRenderTreeIfNeeded();
1997 const Font& font = accessFont(); 1997 const Font& font = accessFont();
1998 const TextRun textRun(text); 1998 const TextRun textRun(text);
1999 FloatRect textBounds = font.selectionRectForText(textRun, FloatPoint(), font .fontDescription().computedSize(), 0, -1, true); 1999 FloatRect textBounds = font.selectionRectForText(textRun, FloatPoint(), font .fontDescription().computedSize(), 0, -1, true);
2000 2000
2001 // x direction 2001 // x direction
2002 metrics->setWidth(font.width(textRun)); 2002 metrics->setWidth(font.width(textRun));
2003 metrics->setActualBoundingBoxLeft(-textBounds.x()); 2003 metrics->setActualBoundingBoxLeft(-textBounds.x());
2004 metrics->setActualBoundingBoxRight(textBounds.maxX()); 2004 metrics->setActualBoundingBoxRight(textBounds.maxX());
2005 2005
2006 // y direction 2006 // y direction
(...skipping 30 matching lines...) Expand all
2037 2037
2038 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo at y, bool fill, float maxWidth, bool useMaxWidth) 2038 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo at y, bool fill, float maxWidth, bool useMaxWidth)
2039 { 2039 {
2040 // The style resolution required for rendering text is not available in fram e-less documents. 2040 // The style resolution required for rendering text is not available in fram e-less documents.
2041 if (!canvas()->document().frame()) 2041 if (!canvas()->document().frame())
2042 return; 2042 return;
2043 2043
2044 // accessFont needs the style to be up to date, but updating style can cause script to run, 2044 // accessFont needs the style to be up to date, but updating style can cause script to run,
2045 // (e.g. due to autofocus) which can free the GraphicsContext, so update sty le before grabbing 2045 // (e.g. due to autofocus) which can free the GraphicsContext, so update sty le before grabbing
2046 // the GraphicsContext. 2046 // the GraphicsContext.
2047 canvas()->document().updateStyleIfNeeded(); 2047 canvas()->document().updateRenderTreeIfNeeded();
2048 2048
2049 GraphicsContext* c = drawingContext(); 2049 GraphicsContext* c = drawingContext();
2050 if (!c) 2050 if (!c)
2051 return; 2051 return;
2052 if (!state().m_invertibleCTM) 2052 if (!state().m_invertibleCTM)
2053 return; 2053 return;
2054 if (!std::isfinite(x) | !std::isfinite(y)) 2054 if (!std::isfinite(x) | !std::isfinite(y))
2055 return; 2055 return;
2056 if (useMaxWidth && (!std::isfinite(maxWidth) || maxWidth <= 0)) 2056 if (useMaxWidth && (!std::isfinite(maxWidth) || maxWidth <= 0))
2057 return; 2057 return;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 c->setAlphaAsFloat(1.0); 2300 c->setAlphaAsFloat(1.0);
2301 c->clearShadow(); 2301 c->clearShadow();
2302 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); 2302 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
2303 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2303 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2304 c->restore(); 2304 c->restore();
2305 2305
2306 didDraw(dirtyRect); 2306 didDraw(dirtyRect);
2307 } 2307 }
2308 2308
2309 } // namespace WebCore 2309 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/ImageDocument.cpp ('k') | Source/core/svg/SVGElementInstance.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698