| OLD | NEW |
| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 315 } |
| 316 | 316 |
| 317 bool Internals::isLoadingFromMemoryCache(const String& url) | 317 bool Internals::isLoadingFromMemoryCache(const String& url) |
| 318 { | 318 { |
| 319 if (!contextDocument()) | 319 if (!contextDocument()) |
| 320 return false; | 320 return false; |
| 321 Resource* resource = memoryCache()->resourceForURL(contextDocument()->comple
teURL(url)); | 321 Resource* resource = memoryCache()->resourceForURL(contextDocument()->comple
teURL(url)); |
| 322 return resource && resource->status() == Resource::Cached; | 322 return resource && resource->status() == Resource::Cached; |
| 323 } | 323 } |
| 324 | 324 |
| 325 void Internals::crash() | |
| 326 { | |
| 327 CRASH(); | |
| 328 } | |
| 329 | |
| 330 void Internals::setStyleResolverStatsEnabled(bool enabled) | |
| 331 { | |
| 332 Document* document = contextDocument(); | |
| 333 if (enabled) | |
| 334 document->ensureStyleResolver().enableStats(StyleResolver::ReportSlowSta
ts); | |
| 335 else | |
| 336 document->ensureStyleResolver().disableStats(); | |
| 337 } | |
| 338 | |
| 339 String Internals::styleResolverStatsReport(ExceptionState& exceptionState) const | |
| 340 { | |
| 341 Document* document = contextDocument(); | |
| 342 if (!document) { | |
| 343 exceptionState.throwDOMException(InvalidAccessError, "No context documen
t is available."); | |
| 344 return String(); | |
| 345 } | |
| 346 if (!document->ensureStyleResolver().stats()) { | |
| 347 exceptionState.throwDOMException(InvalidStateError, "Style resolver stat
s not enabled"); | |
| 348 return String(); | |
| 349 } | |
| 350 return document->ensureStyleResolver().stats()->report(); | |
| 351 } | |
| 352 | |
| 353 String Internals::styleResolverStatsTotalsReport(ExceptionState& exceptionState)
const | |
| 354 { | |
| 355 Document* document = contextDocument(); | |
| 356 if (!document) { | |
| 357 exceptionState.throwDOMException(InvalidAccessError, "No context documen
t is available."); | |
| 358 return String(); | |
| 359 } | |
| 360 if (!document->ensureStyleResolver().statsTotals()) { | |
| 361 exceptionState.throwDOMException(InvalidStateError, "Style resolver stat
s not enabled"); | |
| 362 return String(); | |
| 363 } | |
| 364 return document->ensureStyleResolver().statsTotals()->report(); | |
| 365 } | |
| 366 | |
| 367 bool Internals::isSharingStyle(Element* element1, Element* element2) const | 325 bool Internals::isSharingStyle(Element* element1, Element* element2) const |
| 368 { | 326 { |
| 369 ASSERT(element1 && element2); | 327 ASSERT(element1 && element2); |
| 370 return element1->renderStyle() == element2->renderStyle(); | 328 return element1->renderStyle() == element2->renderStyle(); |
| 371 } | 329 } |
| 372 | 330 |
| 373 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionState& ex
ceptionState) | 331 bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionState& ex
ceptionState) |
| 374 { | 332 { |
| 375 ASSERT(insertionPoint); | 333 ASSERT(insertionPoint); |
| 376 if (!insertionPoint->isInsertionPoint()) { | 334 if (!insertionPoint->isInsertionPoint()) { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 if (!s_pagePopupDriver) | 659 if (!s_pagePopupDriver) |
| 702 s_pagePopupDriver = MockPagePopupDriver::create(page->deprecatedLocalMai
nFrame()).leakPtr(); | 660 s_pagePopupDriver = MockPagePopupDriver::create(page->deprecatedLocalMai
nFrame()).leakPtr(); |
| 703 page->chrome().client().setPagePopupDriver(s_pagePopupDriver); | 661 page->chrome().client().setPagePopupDriver(s_pagePopupDriver); |
| 704 } | 662 } |
| 705 | 663 |
| 706 PassRefPtrWillBeRawPtr<PagePopupController> Internals::pagePopupController() | 664 PassRefPtrWillBeRawPtr<PagePopupController> Internals::pagePopupController() |
| 707 { | 665 { |
| 708 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0; | 666 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0; |
| 709 } | 667 } |
| 710 | 668 |
| 711 PassRefPtrWillBeRawPtr<ClientRect> Internals::unscaledViewportRect(ExceptionStat
e& exceptionState) | |
| 712 { | |
| 713 Document* document = contextDocument(); | |
| 714 if (!document || !document->view()) { | |
| 715 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's viewport cannot be retrieved." : "No context document can be obtained.")
; | |
| 716 return ClientRect::create(); | |
| 717 } | |
| 718 | |
| 719 return ClientRect::create(document->view()->visibleContentRect()); | |
| 720 } | |
| 721 | |
| 722 PassRefPtrWillBeRawPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState
& exceptionState) | 669 PassRefPtrWillBeRawPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState
& exceptionState) |
| 723 { | 670 { |
| 724 Document* document = contextDocument(); | 671 Document* document = contextDocument(); |
| 725 if (!document || !document->frame()) { | 672 if (!document || !document->frame()) { |
| 726 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "No context document can be obtained."); | 673 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "No context document can be obtained."); |
| 727 return ClientRect::create(); | 674 return ClientRect::create(); |
| 728 } | 675 } |
| 729 | 676 |
| 730 return ClientRect::create(document->frame()->selection().absoluteCaretBounds
()); | 677 return ClientRect::create(document->frame()->selection().absoluteCaretBounds
()); |
| 731 } | 678 } |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 ASSERT(element); | 1977 ASSERT(element); |
| 2031 return blink::markerTextForListItem(element); | 1978 return blink::markerTextForListItem(element); |
| 2032 } | 1979 } |
| 2033 | 1980 |
| 2034 String Internals::getImageSourceURL(Element* element) | 1981 String Internals::getImageSourceURL(Element* element) |
| 2035 { | 1982 { |
| 2036 ASSERT(element); | 1983 ASSERT(element); |
| 2037 return element->imageSourceURL(); | 1984 return element->imageSourceURL(); |
| 2038 } | 1985 } |
| 2039 | 1986 |
| 2040 String Internals::baseURL(Document* document) | |
| 2041 { | |
| 2042 ASSERT(document); | |
| 2043 return document->baseURL().string(); | |
| 2044 } | |
| 2045 | |
| 2046 bool Internals::isSelectPopupVisible(Node* node) | 1987 bool Internals::isSelectPopupVisible(Node* node) |
| 2047 { | 1988 { |
| 2048 ASSERT(node); | 1989 ASSERT(node); |
| 2049 if (!isHTMLSelectElement(*node)) | 1990 if (!isHTMLSelectElement(*node)) |
| 2050 return false; | 1991 return false; |
| 2051 | 1992 |
| 2052 HTMLSelectElement& select = toHTMLSelectElement(*node); | 1993 HTMLSelectElement& select = toHTMLSelectElement(*node); |
| 2053 | 1994 |
| 2054 RenderObject* renderer = select.renderer(); | 1995 RenderObject* renderer = select.renderer(); |
| 2055 if (!renderer || !renderer->isMenuList()) | 1996 if (!renderer || !renderer->isMenuList()) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2270 | 2211 |
| 2271 StringBuilder markup; | 2212 StringBuilder markup; |
| 2272 Vector<Document::TransitionElementData>::iterator iter = elementData.begin()
; | 2213 Vector<Document::TransitionElementData>::iterator iter = elementData.begin()
; |
| 2273 for (; iter != elementData.end(); ++iter) | 2214 for (; iter != elementData.end(); ++iter) |
| 2274 markup.append(iter->markup); | 2215 markup.append(iter->markup); |
| 2275 | 2216 |
| 2276 return markup.toString(); | 2217 return markup.toString(); |
| 2277 } | 2218 } |
| 2278 | 2219 |
| 2279 } // namespace blink | 2220 } // namespace blink |
| OLD | NEW |