Chromium Code Reviews| Index: third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp |
| diff --git a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp |
| index 7da77ddd4e7984fc8c4db12c8f2b3bfb11788796..bb5c2be4a8ffbb707c0531623c0ae8d9bb6bc2dd 100644 |
| --- a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp |
| +++ b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp |
| @@ -21,6 +21,17 @@ |
| namespace blink { |
| +namespace { |
| + |
| +IntSize adjustToCssSize(const IntSize& size, float zoom) |
|
Justin Novosad
2016/07/04 15:45:59
This name is confusing IMHO. My understanding is t
Gleb Lanbin
2016/07/06 20:36:18
done, renamed to getSpecifiedSize, according to Ob
|
| +{ |
| + IntSize newSize(size); |
| + newSize.scale(1 / zoom); |
|
Justin Novosad
2016/07/04 15:45:59
Due to floating-point precision issues, this arith
Gleb Lanbin
2016/07/06 20:36:18
Done.
|
| + return newSize; |
| +} |
| + |
| +} // namespace |
| + |
| CSSPaintDefinition* CSSPaintDefinition::create(ScriptState* scriptState, v8::Local<v8::Function> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>& nativeInvalidationProperties, Vector<AtomicString>& customInvalidationProperties) |
| { |
| return new CSSPaintDefinition(scriptState, constructor, paint, nativeInvalidationProperties, customInvalidationProperties); |
| @@ -39,7 +50,7 @@ CSSPaintDefinition::~CSSPaintDefinition() |
| { |
| } |
| -PassRefPtr<Image> CSSPaintDefinition::paint(const LayoutObject& layoutObject, const IntSize& size) |
| +PassRefPtr<Image> CSSPaintDefinition::paint(const LayoutObject& layoutObject, const IntSize& size, float zoom) |
| { |
| ScriptState::Scope scope(m_scriptState.get()); |
| @@ -55,9 +66,10 @@ PassRefPtr<Image> CSSPaintDefinition::paint(const LayoutObject& layoutObject, co |
| DCHECK(layoutObject.node()); |
| + const auto cssSize = adjustToCssSize(size, zoom); |
|
Justin Novosad
2016/07/04 15:45:58
abuse of "auto".
Gleb Lanbin
2016/07/06 20:36:18
Done.
|
| PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create( |
| ImageBuffer::create(wrapUnique(new RecordingImageBufferSurface(size)))); |
| - PaintSize* paintSize = PaintSize::create(size); |
| + PaintSize* paintSize = PaintSize::create(cssSize); |
| StylePropertyMap* styleMap = FilteredComputedStylePropertyMap::create( |
| CSSComputedStyleDeclaration::create(layoutObject.node()), |
| m_nativeInvalidationProperties, m_customInvalidationProperties); |
| @@ -81,7 +93,7 @@ PassRefPtr<Image> CSSPaintDefinition::paint(const LayoutObject& layoutObject, co |
| return nullptr; |
| } |
| - return PaintGeneratedImage::create(renderingContext->imageBuffer()->getPicture(), size); |
| + return PaintGeneratedImage::create(renderingContext->imageBuffer()->getPicture(), cssSize); |
| } |
| void CSSPaintDefinition::maybeCreatePaintInstance() |