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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 1142283004: Implement a Hit Test Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove validity rect as per Elliott's request Created 5 years, 6 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
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 unsigned Internals::hitTestCount(Document* doc, ExceptionState& exceptionState) const 310 unsigned Internals::hitTestCount(Document* doc, ExceptionState& exceptionState) const
311 { 311 {
312 if (!doc) { 312 if (!doc) {
313 exceptionState.throwDOMException(InvalidAccessError, "Must supply docume nt to check"); 313 exceptionState.throwDOMException(InvalidAccessError, "Must supply docume nt to check");
314 return 0; 314 return 0;
315 } 315 }
316 316
317 return doc->layoutView()->hitTestCount(); 317 return doc->layoutView()->hitTestCount();
318 } 318 }
319 319
320 unsigned Internals::hitTestCacheHits(Document* doc, ExceptionState& exceptionSta te) const
321 {
322 if (!doc) {
323 exceptionState.throwDOMException(InvalidAccessError, "Must supply docume nt to check");
324 return 0;
325 }
326
327 return doc->layoutView()->hitTestCacheHits();
328 }
329
330 Element* Internals::elementFromPoint(Document* doc, double x, double y, bool ign oreClipping, bool allowChildFrameContent, ExceptionState& exceptionState) const
331 {
332 if (!doc) {
333 exceptionState.throwDOMException(InvalidAccessError, "Must supply docume nt to check");
334 return 0;
335 }
336
337 if (!doc->layoutView())
338 return 0;
339
340 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT estRequest::Active;
341 if (ignoreClipping)
342 hitType |= HitTestRequest::IgnoreClipping;
343 if (allowChildFrameContent)
344 hitType |= HitTestRequest::AllowChildFrameContent;
345
346 HitTestRequest request(hitType);
347
348 return doc->hitTestPoint(x, y, request);
349 }
350
351 void Internals::clearHitTestCache(Document* doc, ExceptionState& exceptionState) const
352 {
353 if (!doc) {
354 exceptionState.throwDOMException(InvalidAccessError, "Must supply docume nt to check");
355 return;
356 }
357
358 if (!doc->layoutView())
359 return;
360
361 doc->layoutView()->clearHitTestCache();
362 }
320 363
321 bool Internals::isPreloaded(const String& url) 364 bool Internals::isPreloaded(const String& url)
322 { 365 {
323 Document* document = contextDocument(); 366 Document* document = contextDocument();
324 return document->fetcher()->isPreloaded(document->completeURL(url)); 367 return document->fetcher()->isPreloaded(document->completeURL(url));
325 } 368 }
326 369
327 bool Internals::isLoadingFromMemoryCache(const String& url) 370 bool Internals::isLoadingFromMemoryCache(const String& url)
328 { 371 {
329 if (!contextDocument()) 372 if (!contextDocument())
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 2424
2382 ClientRectList* Internals::focusRingRects(Element* element) 2425 ClientRectList* Internals::focusRingRects(Element* element)
2383 { 2426 {
2384 Vector<LayoutRect> rects; 2427 Vector<LayoutRect> rects;
2385 if (element && element->layoutObject()) 2428 if (element && element->layoutObject())
2386 element->layoutObject()->addFocusRingRects(rects, LayoutPoint()); 2429 element->layoutObject()->addFocusRingRects(rects, LayoutPoint());
2387 return ClientRectList::create(rects); 2430 return ClientRectList::create(rects);
2388 } 2431 }
2389 2432
2390 } // namespace blink 2433 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698