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

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 stray file 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
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::elementFromPointNoCache(Document* doc, double x, double y, E xceptionState& 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 return doc->elementFromPointNoCache(x, y);
341 }
342
343 void Internals::clearHitTestCache(Document* doc, ExceptionState& exceptionState) const
344 {
345 if (!doc) {
346 exceptionState.throwDOMException(InvalidAccessError, "Must supply docume nt to check");
347 return;
348 }
349
350 if (!doc->layoutView())
351 return;
352
353 doc->layoutView()->clearHitTestCache();
354 }
320 355
321 bool Internals::isPreloaded(const String& url) 356 bool Internals::isPreloaded(const String& url)
322 { 357 {
323 Document* document = contextDocument(); 358 Document* document = contextDocument();
324 return document->fetcher()->isPreloaded(document->completeURL(url)); 359 return document->fetcher()->isPreloaded(document->completeURL(url));
325 } 360 }
326 361
327 bool Internals::isLoadingFromMemoryCache(const String& url) 362 bool Internals::isLoadingFromMemoryCache(const String& url)
328 { 363 {
329 if (!contextDocument()) 364 if (!contextDocument())
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 2399
2365 ClientRectList* Internals::focusRingRects(Element* element) 2400 ClientRectList* Internals::focusRingRects(Element* element)
2366 { 2401 {
2367 Vector<LayoutRect> rects; 2402 Vector<LayoutRect> rects;
2368 if (element && element->layoutObject()) 2403 if (element && element->layoutObject())
2369 element->layoutObject()->addFocusRingRects(rects, LayoutPoint()); 2404 element->layoutObject()->addFocusRingRects(rects, LayoutPoint());
2370 return ClientRectList::create(rects); 2405 return ClientRectList::create(rects);
2371 } 2406 }
2372 2407
2373 } // namespace blink 2408 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698