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

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 1291673005: Adding a null pointer check in HTMLCanvasElement::didRecalcStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | 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, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 LayoutObject* HTMLCanvasElement::createLayoutObject(const ComputedStyle& style) 135 LayoutObject* HTMLCanvasElement::createLayoutObject(const ComputedStyle& style)
136 { 136 {
137 LocalFrame* frame = document().frame(); 137 LocalFrame* frame = document().frame();
138 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript)) 138 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript))
139 return new LayoutHTMLCanvas(this); 139 return new LayoutHTMLCanvas(this);
140 return HTMLElement::createLayoutObject(style); 140 return HTMLElement::createLayoutObject(style);
141 } 141 }
142 142
143 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange) 143 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange)
144 { 144 {
145 SkFilterQuality filterQuality = ensureComputedStyle()->imageRendering() == I mageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality; 145 SkFilterQuality filterQuality;
146 const ComputedStyle* style = ensureComputedStyle();
147 if (style && style->imageRendering() == ImageRenderingPixelated) {
148 filterQuality = kNone_SkFilterQuality;
149 } else {
150 filterQuality = kLow_SkFilterQuality;
151 }
152
146 if (is3D()) { 153 if (is3D()) {
147 m_context->setFilterQuality(filterQuality); 154 m_context->setFilterQuality(filterQuality);
148 setNeedsCompositingUpdate(); 155 setNeedsCompositingUpdate();
149 } else if (hasImageBuffer()) { 156 } else if (hasImageBuffer()) {
150 m_imageBuffer->setFilterQuality(filterQuality); 157 m_imageBuffer->setFilterQuality(filterQuality);
151 } 158 }
152 } 159 }
153 160
154 Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode * node) 161 Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode * node)
155 { 162 {
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 { 899 {
893 return FloatSize(width(), height()); 900 return FloatSize(width(), height());
894 } 901 }
895 902
896 bool HTMLCanvasElement::isOpaque() const 903 bool HTMLCanvasElement::isOpaque() const
897 { 904 {
898 return m_context && !m_context->hasAlpha(); 905 return m_context && !m_context->hasAlpha();
899 } 906 }
900 907
901 } // blink 908 } // blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698