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

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

Issue 2229743003: add HitTestCanvasResult Class instend of std::pair<Element*, String> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add HitTestCanvasResult Class instend of std::pair<Element*, String> Created 4 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/html/HTMLImageElement.h" 45 #include "core/html/HTMLImageElement.h"
46 #include "core/html/HTMLInputElement.h" 46 #include "core/html/HTMLInputElement.h"
47 #include "core/html/HTMLSelectElement.h" 47 #include "core/html/HTMLSelectElement.h"
48 #include "core/html/ImageData.h" 48 #include "core/html/ImageData.h"
49 #include "core/html/canvas/CanvasAsyncBlobCreator.h" 49 #include "core/html/canvas/CanvasAsyncBlobCreator.h"
50 #include "core/html/canvas/CanvasContextCreationAttributes.h" 50 #include "core/html/canvas/CanvasContextCreationAttributes.h"
51 #include "core/html/canvas/CanvasFontCache.h" 51 #include "core/html/canvas/CanvasFontCache.h"
52 #include "core/html/canvas/CanvasRenderingContext.h" 52 #include "core/html/canvas/CanvasRenderingContext.h"
53 #include "core/html/canvas/CanvasRenderingContextFactory.h" 53 #include "core/html/canvas/CanvasRenderingContextFactory.h"
54 #include "core/imagebitmap/ImageBitmapOptions.h" 54 #include "core/imagebitmap/ImageBitmapOptions.h"
55 #include "core/layout/HitTestCanvasResult.h"
55 #include "core/layout/LayoutHTMLCanvas.h" 56 #include "core/layout/LayoutHTMLCanvas.h"
56 #include "core/paint/PaintLayer.h" 57 #include "core/paint/PaintLayer.h"
57 #include "core/paint/PaintTiming.h" 58 #include "core/paint/PaintTiming.h"
58 #include "platform/Histogram.h" 59 #include "platform/Histogram.h"
59 #include "platform/MIMETypeRegistry.h" 60 #include "platform/MIMETypeRegistry.h"
60 #include "platform/RuntimeEnabledFeatures.h" 61 #include "platform/RuntimeEnabledFeatures.h"
61 #include "platform/graphics/Canvas2DImageBufferSurface.h" 62 #include "platform/graphics/Canvas2DImageBufferSurface.h"
62 #include "platform/graphics/CanvasMetrics.h" 63 #include "platform/graphics/CanvasMetrics.h"
63 #include "platform/graphics/CanvasSurfaceLayerBridgeClientImpl.h" 64 #include "platform/graphics/CanvasSurfaceLayerBridgeClientImpl.h"
64 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 65 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 || element.hasTagName(HTMLNames::tbodyTag) 1214 || element.hasTagName(HTMLNames::tbodyTag)
1214 || element.hasTagName(HTMLNames::tfootTag) 1215 || element.hasTagName(HTMLNames::tfootTag)
1215 || element.hasTagName(HTMLNames::trTag) 1216 || element.hasTagName(HTMLNames::trTag)
1216 || element.hasTagName(HTMLNames::tdTag) 1217 || element.hasTagName(HTMLNames::tdTag)
1217 || element.hasTagName(HTMLNames::thTag)) 1218 || element.hasTagName(HTMLNames::thTag))
1218 return true; 1219 return true;
1219 1220
1220 return false; 1221 return false;
1221 } 1222 }
1222 1223
1223 std::pair<Element*, String> HTMLCanvasElement::getControlAndIdIfHitRegionExists( const LayoutPoint& location) 1224 HitTestCanvasResult* HTMLCanvasElement::getControlAndIdIfHitRegionExists(const L ayoutPoint& location)
1224 { 1225 {
1225 if (m_context && m_context->is2d()) 1226 if (m_context && m_context->is2d())
1226 return m_context->getControlAndIdIfHitRegionExists(location); 1227 return m_context->getControlAndIdIfHitRegionExists(location);
1227 return std::make_pair(nullptr, String()); 1228 return HitTestCanvasResult::create(String(), nullptr);
1228 } 1229 }
1229 1230
1230 String HTMLCanvasElement::getIdFromControl(const Element* element) 1231 String HTMLCanvasElement::getIdFromControl(const Element* element)
1231 { 1232 {
1232 if (m_context) 1233 if (m_context)
1233 return m_context->getIdFromControl(element); 1234 return m_context->getIdFromControl(element);
1234 return String(); 1235 return String();
1235 } 1236 }
1236 1237
1237 bool HTMLCanvasElement::createSurfaceLayer() 1238 bool HTMLCanvasElement::createSurfaceLayer()
1238 { 1239 {
1239 DCHECK(!m_surfaceLayerBridge); 1240 DCHECK(!m_surfaceLayerBridge);
1240 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); 1241 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl());
1241 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); 1242 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient)));
1242 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); 1243 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( ));
1243 } 1244 }
1244 1245
1245 } // namespace blink 1246 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698