Changeset 100285 in webkit
- Timestamp:
- Nov 15, 2011 8:32:02 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r100283 r100285 1 2011-11-15 Philip Rogers <pdr@google.com> 2 3 Implement maxWidth for fillText and strokeText, fixing the canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html test. 4 https://bugs.webkit.org/show_bug.cgi?id=61528 5 6 Reviewed by Stephen White. 7 8 * fast/canvas/2d.text.draw.fill.maxWidth.gradient-expected.txt: Added. 9 * fast/canvas/2d.text.draw.fill.maxWidth.gradient.html: Added. 10 * fast/canvas/2d.text.draw.fill.maxWidth.negative-expected.txt: Added. 11 * fast/canvas/2d.text.draw.fill.maxWidth.negative.html: Added. 12 * fast/canvas/2d.text.draw.fill.maxWidth.veryLarge-expected.txt: Added. 13 * fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html: Added. 14 * fast/canvas/2d.text.draw.fill.maxWidth.verySmall-expected.txt: Added. 15 * fast/canvas/2d.text.draw.fill.maxWidth.verySmall.html: Added. 16 * platform/chromium/canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface-expected.txt: Removed. 17 * platform/chromium/test_expectations.txt: 18 * platform/gtk/Skipped: 19 * platform/mac-leopard/Skipped: 20 * platform/mac/canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface-expected.txt: 21 * platform/qt/Skipped: 22 * resources/Ahem.ttf: Added. 23 1 24 2011-11-15 Cary Clark <caryclark@google.com> 2 25 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r100283 r100285 2013 2013 BUGWK45991 : canvas/philip/tests/2d.text.draw.baseline.middle.html = TEXT 2014 2014 BUGWK38463 : canvas/philip/tests/2d.text.draw.baseline.top.html = TEXT 2015 BUGWK20867 : canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html = TEXT2016 2015 BUGWK45991 : canvas/philip/tests/2d.text.draw.space.collapse.end.html = TEXT 2017 2016 BUGWK45991 : canvas/philip/tests/2d.text.draw.space.collapse.nonspace.html = TEXT -
trunk/LayoutTests/platform/gtk/Skipped
r100272 r100285 1037 1037 canvas/philip/tests/2d.text.draw.baseline.middle.html 1038 1038 canvas/philip/tests/2d.text.draw.baseline.top.html 1039 canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html1040 1039 canvas/philip/tests/2d.text.draw.space.collapse.end.html 1041 1040 canvas/philip/tests/2d.text.draw.space.collapse.nonspace.html -
trunk/LayoutTests/platform/mac-leopard/Skipped
r97407 r100285 167 167 canvas/philip/tests/2d.text.draw.baseline.middle.html 168 168 canvas/philip/tests/2d.text.draw.baseline.top.html 169 canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html170 169 canvas/philip/tests/2d.text.draw.space.collapse.end.html 171 170 canvas/philip/tests/2d.text.draw.space.collapse.nonspace.html -
trunk/LayoutTests/platform/mac/canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface-expected.txt
r77719 r100285 1 Failed assertion: got pixel [255,0,0,255] at (5,5), expected [0,255,0,255] +/- 2 2 Failed assertion: got pixel [255,0,0,255] at (95,5), expected [0,255,0,255] +/- 2 3 Failed assertion: got pixel [255,0,0,255] at (25,25), expected [0,255,0,255] +/- 2 4 Failed assertion: got pixel [255,0,0,255] at (75,25), expected [0,255,0,255] +/- 2 1 Passed -
trunk/LayoutTests/platform/qt/Skipped
r100281 r100285 1553 1553 canvas/philip/tests/2d.text.draw.baseline.middle.html 1554 1554 canvas/philip/tests/2d.text.draw.baseline.top.html 1555 canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html1556 1555 canvas/philip/tests/2d.text.draw.fontface.notinpage.html 1557 1556 canvas/philip/tests/2d.text.draw.space.collapse.end.html -
trunk/Source/WebCore/ChangeLog
r100284 r100285 1 2011-11-15 Philip Rogers <pdr@google.com> 2 3 Implement maxWidth for fillText and strokeText, fixing the canvas/philip/tests/2d.text.draw.fill.maxWidth.fontface.html test. 4 https://bugs.webkit.org/show_bug.cgi?id=61528 5 6 Reviewed by Stephen White. 7 8 Tests: fast/canvas/2d.text.draw.fill.maxWidth.gradient.html 9 fast/canvas/2d.text.draw.fill.maxWidth.negative.html 10 fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html 11 fast/canvas/2d.text.draw.fill.maxWidth.verySmall.html 12 13 * html/canvas/CanvasRenderingContext2D.cpp: 14 (WebCore::CanvasRenderingContext2D::drawTextInternal): 15 1 16 2011-11-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 17 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r100273 r100285 2075 2075 } 2076 2076 2077 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, float /*maxWidth*/, bool /*useMaxWidth*/)2077 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth, bool useMaxWidth) 2078 2078 { 2079 2079 GraphicsContext* c = drawingContext(); … … 2083 2083 return; 2084 2084 if (!isfinite(x) | !isfinite(y)) 2085 return; 2086 if (useMaxWidth && !isfinite(maxWidth)) 2085 2087 return; 2086 2088 … … 2090 2092 const FontMetrics& fontMetrics = font.fontMetrics(); 2091 2093 2092 // FIXME: Handle maxWidth.2093 2094 // FIXME: Need to turn off font smoothing. 2094 2095 … … 2122 2123 } 2123 2124 2124 float width = font.width(TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, direction, override)); 2125 float fontWidth = font.width(TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, direction, override)); 2126 2127 useMaxWidth = (useMaxWidth && maxWidth < fontWidth); 2128 float width = useMaxWidth ? maxWidth : fontWidth; 2125 2129 2126 2130 TextAlign align = state().m_textAlign; … … 2169 2173 2170 2174 maskImageContext->setTextDrawingMode(fill ? TextModeFill : TextModeStroke); 2171 maskImageContext->translate(-maskRect.x(), -maskRect.y()); 2172 2173 maskImageContext->drawBidiText(font, textRun, location); 2175 2176 if (useMaxWidth) { 2177 maskImageContext->translate(location.x() - maskRect.x(), location.y() - maskRect.y()); 2178 // We draw when fontWidth is 0 so compositing operations (eg, a "copy" op) still work. 2179 maskImageContext->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1)); 2180 maskImageContext->drawBidiText(font, textRun, FloatPoint(0, 0)); 2181 } else { 2182 maskImageContext->translate(-maskRect.x(), -maskRect.y()); 2183 maskImageContext->drawBidiText(font, textRun, location); 2184 } 2174 2185 2175 2186 GraphicsContextStateSaver stateSaver(*c); … … 2189 2200 #endif 2190 2201 2191 c->drawBidiText(font, textRun, location); 2202 if (useMaxWidth) { 2203 GraphicsContextStateSaver stateSaver(*c); 2204 c->translate(location.x(), location.y()); 2205 // We draw when fontWidth is 0 so compositing operations (eg, a "copy" op) still work. 2206 c->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1)); 2207 c->drawBidiText(font, textRun, FloatPoint(0, 0)); 2208 stateSaver.restore(); 2209 } else 2210 c->drawBidiText(font, textRun, location); 2192 2211 2193 2212 if (fill)
Note: See TracChangeset
for help on using the changeset viewer.