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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 1674123003: Remove unnecessary style calculations in HTMLCanvasElement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: simplifications Created 4 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCanvasElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index 51ad64568734c0db8969c0b6ee5d4b1e86923de3..0a357662bb744c5cb6d7ff895575f70208e0c02f 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -135,7 +135,6 @@ inline HTMLCanvasElement::HTMLCanvasElement(Document& document)
, m_didFailToCreateImageBuffer(false)
, m_imageBufferIsClear(false)
{
- setHasCustomStyleCallbacks();
CanvasMetrics::countCanvasContextUsage(CanvasMetrics::CanvasCreated);
}
@@ -165,24 +164,6 @@ LayoutObject* HTMLCanvasElement::createLayoutObject(const ComputedStyle& style)
return HTMLElement::createLayoutObject(style);
}
-void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange)
-{
- SkFilterQuality filterQuality;
- const ComputedStyle* style = ensureComputedStyle();
- if (style && style->imageRendering() == ImageRenderingPixelated) {
- filterQuality = kNone_SkFilterQuality;
- } else {
- filterQuality = kLow_SkFilterQuality;
- }
-
- if (is3D()) {
- m_context->setFilterQuality(filterQuality);
- setNeedsCompositingUpdate();
- } else if (hasImageBuffer()) {
- m_imageBuffer->setFilterQuality(filterQuality);
- }
-}
-
Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode* node)
{
setIsInCanvasSubtree(true);
@@ -265,10 +246,6 @@ CanvasRenderingContext* HTMLCanvasElement::getCanvasRenderingContext(const Strin
return nullptr;
if (m_context->is3d()) {
- document().updateLayoutTreeForNodeIfNeeded(this);
- const ComputedStyle* style = ensureComputedStyle();
- if (style)
- m_context->setFilterQuality(style->imageRendering() == ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality);
updateExternallyAllocatedMemory();
}
setNeedsCompositingUpdate();
@@ -458,6 +435,16 @@ void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r)
// FIXME: crbug.com/438240; there is a bug with the new CSS blending and compositing feature.
if (!m_context)
return;
+
+ const ComputedStyle* style = ensureComputedStyle();
chrishtr 2016/02/10 17:53:40 The change looks good, but one final step: HTMLCan
+ SkFilterQuality filterQuality = (style && style->imageRendering() == ImageRenderingPixelated) ? kNone_SkFilterQuality : kLow_SkFilterQuality;
+
+ if (is3D()) {
+ m_context->setFilterQuality(filterQuality);
+ } else if (hasImageBuffer()) {
+ m_imageBuffer->setFilterQuality(filterQuality);
+ }
+
if (!paintsIntoCanvasBuffer() && !document().printing())
return;
@@ -782,10 +769,6 @@ void HTMLCanvasElement::createImageBufferInternal(PassOwnPtr<ImageBufferSurface>
return;
m_imageBuffer->setClient(this);
- document().updateLayoutTreeIfNeeded();
- const ComputedStyle* style = ensureComputedStyle();
- m_imageBuffer->setFilterQuality((style && (style->imageRendering() == ImageRenderingPixelated)) ? kNone_SkFilterQuality : kLow_SkFilterQuality);
-
m_didFailToCreateImageBuffer = false;
updateExternallyAllocatedMemory();
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCanvasElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698