2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include "FrameLoaderClientImpl.h"
37 #include "core/frame/LocalFrame.h"
38 #include "platform/geometry/FloatRect.h"
39 #include "public/platform/WebFileSystemType.h"
40 #include "wtf/Compiler.h"
41 #include "wtf/HashSet.h"
42 #include "wtf/OwnPtr.h"
43 #include "wtf/RefCounted.h"
44 #include "wtf/text/WTFString.h"
47 class GraphicsContext;
48 class HTMLInputElement;
55 struct FrameLoadRequest;
56 struct WindowFeatures;
60 class ChromePrintContext;
61 class SharedWorkerRepositoryClientImpl;
62 class WebDataSourceImpl;
63 class WebInputElement;
66 class WebPluginContainerImpl;
69 struct WebPrintParams;
71 template <typename T> class WebVector;
73 // Implementation of WebFrame, note that this is a reference counted object.
74 class WebFrameImpl FINAL
76 , public RefCounted<WebFrameImpl> {
79 virtual void close() OVERRIDE;
80 virtual WebString uniqueName() const OVERRIDE;
81 virtual WebString assignedName() const OVERRIDE;
82 virtual void setName(const WebString&) OVERRIDE;
83 virtual WebVector<WebIconURL> iconURLs(int iconTypesMask) const OVERRIDE;
84 virtual void setIsRemote(bool) OVERRIDE;
85 virtual void setRemoteWebLayer(WebLayer*) OVERRIDE;
86 virtual void setPermissionClient(WebPermissionClient*) OVERRIDE;
87 virtual void setSharedWorkerRepositoryClient(WebSharedWorkerRepositoryClient*) OVERRIDE;
88 virtual WebSize scrollOffset() const OVERRIDE;
89 virtual void setScrollOffset(const WebSize&) OVERRIDE;
90 virtual WebSize minimumScrollOffset() const OVERRIDE;
91 virtual WebSize maximumScrollOffset() const OVERRIDE;
92 virtual WebSize contentsSize() const OVERRIDE;
93 virtual bool hasVisibleContent() const OVERRIDE;
94 virtual WebRect visibleContentRect() const OVERRIDE;
95 virtual bool hasHorizontalScrollbar() const OVERRIDE;
96 virtual bool hasVerticalScrollbar() const OVERRIDE;
97 virtual WebView* view() const OVERRIDE;
98 virtual WebFrame* opener() const OVERRIDE;
99 virtual void setOpener(WebFrame*) OVERRIDE;
100 virtual void appendChild(WebFrame*) OVERRIDE;
101 virtual void removeChild(WebFrame*) OVERRIDE;
102 virtual WebFrame* parent() const OVERRIDE;
103 virtual WebFrame* top() const OVERRIDE;
104 virtual WebFrame* previousSibling() const OVERRIDE;
105 virtual WebFrame* nextSibling() const OVERRIDE;
106 virtual WebFrame* firstChild() const OVERRIDE;
107 virtual WebFrame* lastChild() const OVERRIDE;
108 virtual WebFrame* traversePrevious(bool wrap) const OVERRIDE;
109 virtual WebFrame* traverseNext(bool wrap) const OVERRIDE;
110 virtual WebFrame* findChildByName(const WebString&) const OVERRIDE;
111 virtual WebFrame* findChildByExpression(const WebString&) const OVERRIDE;
112 virtual WebDocument document() const OVERRIDE;
113 virtual WebPerformance performance() const OVERRIDE;
114 virtual NPObject* windowObject() const OVERRIDE;
115 virtual void bindToWindowObject(const WebString& name, NPObject*) OVERRIDE;
116 virtual void bindToWindowObject(const WebString& name, NPObject*, void*) OVERRIDE;
117 virtual void executeScript(const WebScriptSource&) OVERRIDE;
118 virtual void executeScriptInIsolatedWorld(
119 int worldID, const WebScriptSource* sources, unsigned numSources,
120 int extensionGroup) OVERRIDE;
121 virtual void setIsolatedWorldSecurityOrigin(int worldID, const WebSecurityOrigin&) OVERRIDE;
122 virtual void setIsolatedWorldContentSecurityPolicy(int worldID, const WebString&) OVERRIDE;
123 virtual void addMessageToConsole(const WebConsoleMessage&) OVERRIDE;
124 virtual void collectGarbage() OVERRIDE;
125 virtual bool checkIfRunInsecureContent(const WebURL&) const OVERRIDE;
126 virtual v8::Handle<v8::Value> executeScriptAndReturnValue(
127 const WebScriptSource&) OVERRIDE;
128 virtual void executeScriptInIsolatedWorld(
129 int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
130 int extensionGroup, WebVector<v8::Local<v8::Value> >* results) OVERRIDE;
131 virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled(
132 v8::Handle<v8::Function>,
133 v8::Handle<v8::Value>,
135 v8::Handle<v8::Value> argv[]) OVERRIDE;
136 virtual v8::Local<v8::Context> mainWorldScriptContext() const OVERRIDE;
137 virtual void reload(bool ignoreCache) OVERRIDE;
138 virtual void reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCache) OVERRIDE;
139 virtual void loadRequest(const WebURLRequest&) OVERRIDE;
140 virtual void loadHistoryItem(const WebHistoryItem&, WebURLRequest::CachePolicy) OVERRIDE;
141 virtual void loadData(
142 const WebData&, const WebString& mimeType, const WebString& textEncoding,
143 const WebURL& baseURL, const WebURL& unreachableURL, bool replace) OVERRIDE;
144 virtual void loadHTMLString(
145 const WebData& html, const WebURL& baseURL, const WebURL& unreachableURL,
146 bool replace) OVERRIDE;
147 virtual bool isLoading() const OVERRIDE;
148 virtual void stopLoading() OVERRIDE;
149 virtual WebDataSource* provisionalDataSource() const OVERRIDE;
150 virtual WebDataSource* dataSource() const OVERRIDE;
151 virtual WebHistoryItem previousHistoryItem() const OVERRIDE;
152 virtual WebHistoryItem currentHistoryItem() const OVERRIDE;
153 virtual void enableViewSourceMode(bool enable) OVERRIDE;
154 virtual bool isViewSourceModeEnabled() const OVERRIDE;
155 virtual void setReferrerForRequest(WebURLRequest&, const WebURL& referrer) OVERRIDE;
156 virtual void dispatchWillSendRequest(WebURLRequest&) OVERRIDE;
157 virtual WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions&) OVERRIDE;
158 virtual unsigned unloadListenerCount() const OVERRIDE;
159 virtual void replaceSelection(const WebString&) OVERRIDE;
160 virtual void insertText(const WebString&) OVERRIDE;
161 virtual void setMarkedText(const WebString&, unsigned location, unsigned length) OVERRIDE;
162 virtual void unmarkText() OVERRIDE;
163 virtual bool hasMarkedText() const OVERRIDE;
164 virtual WebRange markedRange() const OVERRIDE;
165 virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const OVERRIDE;
166 virtual size_t characterIndexForPoint(const WebPoint&) const OVERRIDE;
167 virtual bool executeCommand(const WebString&, const WebNode& = WebNode()) OVERRIDE;
168 virtual bool executeCommand(const WebString&, const WebString& value, const WebNode& = WebNode()) OVERRIDE;
169 virtual bool isCommandEnabled(const WebString&) const OVERRIDE;
170 virtual void enableContinuousSpellChecking(bool) OVERRIDE;
171 virtual bool isContinuousSpellCheckingEnabled() const OVERRIDE;
172 virtual void requestTextChecking(const WebElement&) OVERRIDE;
173 virtual void replaceMisspelledRange(const WebString&) OVERRIDE;
174 virtual void removeSpellingMarkers() OVERRIDE;
175 virtual bool hasSelection() const OVERRIDE;
176 virtual WebRange selectionRange() const OVERRIDE;
177 virtual WebString selectionAsText() const OVERRIDE;
178 virtual WebString selectionAsMarkup() const OVERRIDE;
179 virtual bool selectWordAroundCaret() OVERRIDE;
180 virtual void selectRange(const WebPoint& base, const WebPoint& extent) OVERRIDE;
181 virtual void selectRange(const WebRange&) OVERRIDE;
182 virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent) OVERRIDE;
183 virtual void moveCaretSelection(const WebPoint&) OVERRIDE;
184 virtual void setCaretVisible(bool) OVERRIDE;
185 virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode) OVERRIDE;
186 virtual float printPage(int pageToPrint, WebCanvas*) OVERRIDE;
187 virtual float getPrintPageShrink(int page) OVERRIDE;
188 virtual void printEnd() OVERRIDE;
189 virtual bool isPrintScalingDisabledForPlugin(const WebNode&) OVERRIDE;
190 virtual bool hasCustomPageSizeStyle(int pageIndex) OVERRIDE;
191 virtual bool isPageBoxVisible(int pageIndex) OVERRIDE;
192 virtual void pageSizeAndMarginsInPixels(int pageIndex,
197 int& marginLeft) OVERRIDE;
198 virtual WebString pageProperty(const WebString& propertyName, int pageIndex) OVERRIDE;
199 virtual void printPagesWithBoundaries(WebCanvas*, const WebSize&) OVERRIDE;
201 int identifier, const WebString& searchText, const WebFindOptions&,
202 bool wrapWithinFrame, WebRect* selectionRect) OVERRIDE;
203 virtual void stopFinding(bool clearSelection) OVERRIDE;
204 virtual void scopeStringMatches(
205 int identifier, const WebString& searchText, const WebFindOptions&,
206 bool reset) OVERRIDE;
207 virtual void cancelPendingScopingEffort() OVERRIDE;
208 virtual void increaseMatchCount(int count, int identifier) OVERRIDE;
209 virtual void resetMatchCount() OVERRIDE;
210 virtual int findMatchMarkersVersion() const OVERRIDE;
211 virtual WebFloatRect activeFindMatchRect() OVERRIDE;
212 virtual void findMatchRects(WebVector<WebFloatRect>&) OVERRIDE;
213 virtual int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect) OVERRIDE;
215 virtual void sendOrientationChangeEvent(int orientation) OVERRIDE;
217 virtual void dispatchMessageEventWithOriginCheck(
218 const WebSecurityOrigin& intendedTargetOrigin,
219 const WebDOMEvent&) OVERRIDE;
221 virtual WebString contentAsText(size_t maxChars) const OVERRIDE;
222 virtual WebString contentAsMarkup() const OVERRIDE;
223 virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTextNormal) const OVERRIDE;
224 virtual WebString markerTextForListItem(const WebElement&) const OVERRIDE;
225 virtual WebRect selectionBoundsRect() const OVERRIDE;
227 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const OVERRIDE;
228 virtual WebString layerTreeAsText(bool showDebugInfo = false) const OVERRIDE;
230 void willDetachParent();
232 static WebFrameImpl* create(WebFrameClient*);
233 virtual ~WebFrameImpl();
235 // Called by the WebViewImpl to initialize the main frame for the page.
236 void initializeAsMainFrame(WebCore::Page*);
238 PassRefPtr<WebCore::LocalFrame> createChildFrame(
239 const WebCore::FrameLoadRequest&, WebCore::HTMLFrameOwnerElement*);
241 void didChangeContentsSize(const WebCore::IntSize&);
243 void createFrameView();
245 static WebFrameImpl* fromFrame(WebCore::LocalFrame* frame);
246 static WebFrameImpl* fromFrameOwnerElement(WebCore::Element* element);
248 // If the frame hosts a PluginDocument, this method returns the WebPluginContainerImpl
249 // that hosts the plugin.
250 static WebPluginContainerImpl* pluginContainerFromFrame(WebCore::LocalFrame*);
252 // If the frame hosts a PluginDocument, this method returns the WebPluginContainerImpl
253 // that hosts the plugin. If the provided node is a plugin, then it runs its
254 // WebPluginContainerImpl.
255 static WebPluginContainerImpl* pluginContainerFromNode(WebCore::LocalFrame*, const WebNode&);
257 WebViewImpl* viewImpl() const;
259 WebCore::FrameView* frameView() const { return frame() ? frame()->view() : 0; }
261 // Getters for the impls corresponding to Get(Provisional)DataSource. They
262 // may return 0 if there is no corresponding data source.
263 WebDataSourceImpl* dataSourceImpl() const;
264 WebDataSourceImpl* provisionalDataSourceImpl() const;
266 // Returns which frame has an active match. This function should only be
267 // called on the main frame, as it is the only frame keeping track. Returned
268 // value can be 0 if no frame has an active match.
269 WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; }
271 // Returns the active match in the current frame. Could be a null range if
272 // the local frame has no active match.
273 WebCore::Range* activeMatch() const { return m_activeMatch.get(); }
275 // When a Find operation ends, we want to set the selection to what was active
276 // and set focus to the first focusable node we find (starting with the first
277 // node in the matched range and going up the inheritance chain). If we find
278 // nothing to focus we focus the first focusable node in the range. This
279 // allows us to set focus to a link (when we find text inside a link), which
280 // allows us to navigate by pressing Enter after closing the Find box.
281 void setFindEndstateFocusAndSelection();
283 void didFail(const WebCore::ResourceError&, bool wasProvisional);
285 // Sets whether the WebFrameImpl allows its document to be scrolled.
286 // If the parameter is true, allow the document to be scrolled.
287 // Otherwise, disallow scrolling.
288 virtual void setCanHaveScrollbars(bool) OVERRIDE;
290 WebCore::LocalFrame* frame() const { return m_frame.get(); }
291 WebFrameClient* client() const { return m_client; }
292 void setClient(WebFrameClient* client) { m_client = client; }
294 WebPermissionClient* permissionClient() { return m_permissionClient; }
295 SharedWorkerRepositoryClientImpl* sharedWorkerRepositoryClient() const { return m_sharedWorkerRepositoryClient.get(); }
297 void setInputEventsTransformForEmulation(const WebCore::IntSize&, float);
299 static void selectWordAroundPosition(WebCore::LocalFrame*, WebCore::VisiblePosition);
302 class DeferredScopeStringMatches;
303 friend class DeferredScopeStringMatches;
304 friend class FrameLoaderClientImpl;
307 RefPtr<WebCore::Range> m_range;
309 // 1-based index within this frame.
312 // In find-in-page coordinates.
313 // Lazily calculated by updateFindMatchRects.
314 WebCore::FloatRect m_rect;
316 FindMatch(PassRefPtr<WebCore::Range>, int ordinal);
319 // A bit mask specifying area of the frame to invalidate.
320 enum AreaToInvalidate {
322 InvalidateContentArea,
323 InvalidateScrollbar, // Vertical scrollbar only.
324 InvalidateAll // Both content area and the scrollbar.
327 explicit WebFrameImpl(WebFrameClient*);
329 // Sets the local WebCore frame and registers destruction observers.
330 void setWebCoreFrame(PassRefPtr<WebCore::LocalFrame>);
332 // Notifies the delegate about a new selection rect.
333 void reportFindInPageSelection(
334 const WebRect& selectionRect, int activeMatchOrdinal, int identifier);
336 // Clear the find-in-page matches cache forcing rects to be fully
337 // calculated again next time updateFindMatchRects is called.
338 void clearFindMatchesCache();
340 // Check if the activeMatchFrame still exists in the frame tree.
341 bool isActiveMatchFrameValid() const;
343 // Return the index in the find-in-page cache of the match closest to the
344 // provided point in find-in-page coordinates, or -1 in case of error.
345 // The squared distance to the closest match is returned in the distanceSquared parameter.
346 int nearestFindMatch(const WebCore::FloatPoint&, float& distanceSquared);
348 // Select a find-in-page match marker in the current frame using a cache
349 // match index returned by nearestFindMatch. Returns the ordinal of the new
350 // selected match or -1 in case of error. Also provides the bounding box of
351 // the marker in window coordinates if selectionRect is not null.
352 int selectFindMatch(unsigned index, WebRect* selectionRect);
354 // Compute and cache the rects for FindMatches if required.
355 // Rects are automatically invalidated in case of content size changes,
356 // propagating the invalidation to child frames.
357 void updateFindMatchRects();
359 // Append the find-in-page match rects of the current frame to the provided vector.
360 void appendFindMatchRects(Vector<WebFloatRect>& frameRects);
362 // Invalidates a certain area within the frame.
363 void invalidateArea(AreaToInvalidate);
365 // Add a WebKit TextMatch-highlight marker to nodes in a range.
366 void addMarker(WebCore::Range*, bool activeMatch);
368 // Sets the markers within a range as active or inactive.
369 void setMarkerActive(WebCore::Range*, bool active);
371 // Returns the ordinal of the first match in the frame specified. This
372 // function enumerates the frames, starting with the main frame and up to (but
373 // not including) the frame passed in as a parameter and counts how many
374 // matches have been found.
375 int ordinalOfFirstMatchForFrame(WebFrameImpl*) const;
377 // Determines whether the scoping effort is required for a particular frame.
378 // It is not necessary if the frame is invisible, for example, or if this
379 // is a repeat search that already returned nothing last time the same prefix
381 bool shouldScopeMatches(const WTF::String& searchText);
383 // Removes the current frame from the global scoping effort and triggers any
384 // updates if appropriate. This method does not mark the scoping operation
386 void flushCurrentScopingEffort(int identifier);
388 // Finishes the current scoping effort and triggers any updates if appropriate.
389 void finishCurrentScopingEffort(int identifier);
391 // Queue up a deferred call to scopeStringMatches.
392 void scopeStringMatchesSoon(
393 int identifier, const WebString& searchText, const WebFindOptions&,
396 // Called by a DeferredScopeStringMatches instance.
397 void callScopeStringMatches(
398 DeferredScopeStringMatches*, int identifier, const WebString& searchText,
399 const WebFindOptions&, bool reset);
401 // Determines whether to invalidate the content area and scrollbar.
402 void invalidateIfNecessary();
404 void loadJavaScriptURL(const WebCore::KURL&);
406 // Returns a hit-tested VisiblePosition for the given point
407 WebCore::VisiblePosition visiblePositionForWindowPoint(const WebPoint&);
409 FrameLoaderClientImpl m_frameLoaderClientImpl;
411 // The embedder retains a reference to the WebCore LocalFrame while it is active in the DOM. This
412 // reference is released when the frame is removed from the DOM or the entire page is closed.
413 // FIXME: These will need to change to WebFrame when we introduce WebFrameProxy.
414 RefPtr<WebCore::LocalFrame> m_frame;
415 WebFrameImpl* m_parent;
416 WebFrameImpl* m_previousSibling;
417 WebFrameImpl* m_nextSibling;
418 WebFrameImpl* m_firstChild;
419 WebFrameImpl* m_lastChild;
421 WebFrameImpl* m_opener;
422 WTF::HashSet<WebFrameImpl*> m_openedFrames;
424 // Indicate whether the current LocalFrame is local or remote. Remote frames are
425 // rendered in a different process from their parent frames.
428 WebFrameClient* m_client;
429 WebPermissionClient* m_permissionClient;
430 OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient;
432 // A way for the main frame to keep track of which frame has an active
433 // match. Should be 0 for all other frames.
434 WebFrameImpl* m_currentActiveMatchFrame;
436 // The range of the active match for the current frame.
437 RefPtr<WebCore::Range> m_activeMatch;
439 // The index of the active match for the current frame.
440 int m_activeMatchIndexInCurrentFrame;
442 // This flag is used by the scoping effort to determine if we need to figure
443 // out which rectangle is the active match. Once we find the active
444 // rectangle we clear this flag.
445 bool m_locatingActiveRect;
447 // The scoping effort can time out and we need to keep track of where we
448 // ended our last search so we can continue from where we left of.
449 RefPtr<WebCore::Range> m_resumeScopingFromRange;
451 // Keeps track of the last string this frame searched for. This is used for
452 // short-circuiting searches in the following scenarios: When a frame has
453 // been searched and returned 0 results, we don't need to search that frame
454 // again if the user is just adding to the search (making it more specific).
455 WTF::String m_lastSearchString;
457 // Keeps track of how many matches this frame has found so far, so that we
458 // don't loose count between scoping efforts, and is also used (in conjunction
459 // with m_lastSearchString) to figure out if we need to search the frame again.
460 int m_lastMatchCount;
462 // This variable keeps a cumulative total of matches found so far for ALL the
463 // frames on the page, and is only incremented by calling IncreaseMatchCount
464 // (on the main frame only). It should be -1 for all other frames.
465 int m_totalMatchCount;
467 // This variable keeps a cumulative total of how many frames are currently
468 // scoping, and is incremented/decremented on the main frame only.
469 // It should be -1 for all other frames.
470 int m_framesScopingCount;
472 // Identifier of the latest find-in-page request. Required to be stored in
473 // the frame in order to reply if required in case the frame is detached.
474 int m_findRequestIdentifier;
476 // Keeps track of whether there is an scoping effort ongoing in the frame.
477 bool m_scopingInProgress;
479 // Keeps track of whether the last find request completed its scoping effort
480 // without finding any matches in this frame.
481 bool m_lastFindRequestCompletedWithNoMatches;
483 // Keeps track of when the scoping effort should next invalidate the scrollbar
484 // and the frame area.
485 int m_nextInvalidateAfter;
487 // A list of all of the pending calls to scopeStringMatches.
488 Vector<DeferredScopeStringMatches*> m_deferredScopingWork;
490 // Version number incremented on the main frame only whenever the document
491 // find-in-page match markers change. It should be 0 for all other frames.
492 int m_findMatchMarkersVersion;
494 // Local cache of the find match markers currently displayed for this frame.
495 Vector<FindMatch> m_findMatchesCache;
497 // Determines if the rects in the find-in-page matches cache of this frame
498 // are invalid and should be recomputed.
499 bool m_findMatchRectsAreValid;
501 // Contents size when find-in-page match rects were last computed for this
503 WebCore::IntSize m_contentsSizeForCurrentFindMatchRects;
505 // Valid between calls to BeginPrint() and EndPrint(). Containts the print
506 // information. Is used by PrintPage().
507 OwnPtr<ChromePrintContext> m_printContext;
509 // Stores the additional input events offset and scale when device metrics emulation is enabled.
510 WebCore::IntSize m_inputEventsOffsetForEmulation;
511 float m_inputEventsScaleFactorForEmulation;
514 DEFINE_TYPE_CASTS(WebFrameImpl, WebFrame, frame, true, true);