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

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

Issue 225843002: Oilpan: move ClientRect and its list to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased + code style Created 6 years, 8 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/LayerRect.h » ('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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 if (!s_pagePopupDriver) 758 if (!s_pagePopupDriver)
759 s_pagePopupDriver = MockPagePopupDriver::create(page->mainFrame()).leakP tr(); 759 s_pagePopupDriver = MockPagePopupDriver::create(page->mainFrame()).leakP tr();
760 page->chrome().client().setPagePopupDriver(s_pagePopupDriver); 760 page->chrome().client().setPagePopupDriver(s_pagePopupDriver);
761 } 761 }
762 762
763 PassRefPtrWillBeRawPtr<PagePopupController> Internals::pagePopupController() 763 PassRefPtrWillBeRawPtr<PagePopupController> Internals::pagePopupController()
764 { 764 {
765 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0; 765 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0;
766 } 766 }
767 767
768 PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionState& exception State) 768 PassRefPtrWillBeRawPtr<ClientRect> Internals::unscaledViewportRect(ExceptionStat e& exceptionState)
769 { 769 {
770 Document* document = contextDocument(); 770 Document* document = contextDocument();
771 if (!document || !document->view()) { 771 if (!document || !document->view()) {
772 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's viewport cannot be retrieved." : "No context document can be obtained.") ; 772 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's viewport cannot be retrieved." : "No context document can be obtained.") ;
773 return ClientRect::create(); 773 return ClientRect::create();
774 } 774 }
775 775
776 return ClientRect::create(document->view()->visibleContentRect()); 776 return ClientRect::create(document->view()->visibleContentRect());
777 } 777 }
778 778
779 PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState& exceptionS tate) 779 PassRefPtrWillBeRawPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState & exceptionState)
780 { 780 {
781 Document* document = contextDocument(); 781 Document* document = contextDocument();
782 if (!document || !document->frame()) { 782 if (!document || !document->frame()) {
783 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "No context document can be obtained."); 783 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "No context document can be obtained.");
784 return ClientRect::create(); 784 return ClientRect::create();
785 } 785 }
786 786
787 return ClientRect::create(document->frame()->selection().absoluteCaretBounds ()); 787 return ClientRect::create(document->frame()->selection().absoluteCaretBounds ());
788 } 788 }
789 789
790 PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionState& exceptionState) 790 PassRefPtrWillBeRawPtr<ClientRect> Internals::boundingBox(Element* element, Exce ptionState& exceptionState)
791 { 791 {
792 if (!element) { 792 if (!element) {
793 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element")); 793 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element"));
794 return ClientRect::create(); 794 return ClientRect::create();
795 } 795 }
796 796
797 element->document().updateLayoutIgnorePendingStylesheets(); 797 element->document().updateLayoutIgnorePendingStylesheets();
798 RenderObject* renderer = element->renderer(); 798 RenderObject* renderer = element->renderer();
799 if (!renderer) 799 if (!renderer)
800 return ClientRect::create(); 800 return ClientRect::create();
801 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s()); 801 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s());
802 } 802 }
803 803
804 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document , ExceptionState& exceptionState) 804 PassRefPtrWillBeRawPtr<ClientRectList> Internals::inspectorHighlightRects(Docume nt* document, ExceptionState& exceptionState)
805 { 805 {
806 if (!document || !document->page()) { 806 if (!document || !document->page()) {
807 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's Page cannot be retrieved." : "No context document can be obtained."); 807 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's Page cannot be retrieved." : "No context document can be obtained.");
808 return ClientRectList::create(); 808 return ClientRectList::create();
809 } 809 }
810 810
811 Highlight highlight; 811 Highlight highlight;
812 document->page()->inspectorController().getHighlight(&highlight); 812 document->page()->inspectorController().getHighlight(&highlight);
813 return ClientRectList::create(highlight.quads); 813 return ClientRectList::create(highlight.quads);
814 } 814 }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 1200
1201 IntSize radius(width / 2, height / 2); 1201 IntSize radius(width / 2, height / 2);
1202 IntPoint point(x + radius.width(), y + radius.height()); 1202 IntPoint point(x + radius.width(), y + radius.height());
1203 1203
1204 Node* targetNode = 0; 1204 Node* targetNode = 0;
1205 IntPoint adjustedPoint; 1205 IntPoint adjustedPoint;
1206 document->frame()->eventHandler().bestContextMenuNodeForTouchPoint(point, ra dius, adjustedPoint, targetNode); 1206 document->frame()->eventHandler().bestContextMenuNodeForTouchPoint(point, ra dius, adjustedPoint, targetNode);
1207 return targetNode; 1207 return targetNode;
1208 } 1208 }
1209 1209
1210 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionState& exceptionState) 1210 PassRefPtrWillBeRawPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionState& excepti onState)
1211 { 1211 {
1212 if (!document || !document->frame()) { 1212 if (!document || !document->frame()) {
1213 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "The document provided is invalid."); 1213 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "The document provided is invalid.");
1214 return nullptr; 1214 return nullptr;
1215 } 1215 }
1216 1216
1217 document->updateLayout(); 1217 document->updateLayout();
1218 1218
1219 IntSize radius(width / 2, height / 2); 1219 IntSize radius(width / 2, height / 2);
1220 IntPoint point(x + radius.width(), y + radius.height()); 1220 IntPoint point(x + radius.width(), y + radius.height());
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 String Internals::repaintRectsAsText(Document* document, ExceptionState& excepti onState) const 1856 String Internals::repaintRectsAsText(Document* document, ExceptionState& excepti onState) const
1857 { 1857 {
1858 if (!document || !document->frame()) { 1858 if (!document || !document->frame()) {
1859 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "The document provided is invalid."); 1859 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "The document provided is invalid.");
1860 return String(); 1860 return String();
1861 } 1861 }
1862 1862
1863 return document->frame()->trackedRepaintRectsAsText(); 1863 return document->frame()->trackedRepaintRectsAsText();
1864 } 1864 }
1865 1865
1866 PassRefPtr<ClientRectList> Internals::repaintRects(Element* element, ExceptionSt ate& exceptionState) const 1866 PassRefPtrWillBeRawPtr<ClientRectList> Internals::repaintRects(Element* element, ExceptionState& exceptionState) const
1867 { 1867 {
1868 if (!element) { 1868 if (!element) {
1869 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element")); 1869 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element"));
1870 return nullptr; 1870 return nullptr;
1871 } 1871 }
1872 1872
1873 if (RenderLayer* layer = getRenderLayerForElement(element, exceptionState)) { 1873 if (RenderLayer* layer = getRenderLayerForElement(element, exceptionState)) {
1874 if (layer->compositingState() == PaintsIntoOwnBacking) { 1874 if (layer->compositingState() == PaintsIntoOwnBacking) {
1875 OwnPtr<Vector<FloatRect> > rects = layer->collectTrackedRepaintRects (); 1875 OwnPtr<Vector<FloatRect> > rects = layer->collectTrackedRepaintRects ();
1876 ASSERT(rects.get()); 1876 ASSERT(rects.get());
(...skipping 26 matching lines...) Expand all
1903 if (view->compositor()) 1903 if (view->compositor())
1904 view->compositor()->updateCompositingLayers(); 1904 view->compositor()->updateCompositingLayers();
1905 1905
1906 Page* page = document->page(); 1906 Page* page = document->page();
1907 if (!page) 1907 if (!page)
1908 return String(); 1908 return String();
1909 1909
1910 return page->mainThreadScrollingReasonsAsText(); 1910 return page->mainThreadScrollingReasonsAsText();
1911 } 1911 }
1912 1912
1913 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document, ExceptionState& exceptionState) const 1913 PassRefPtrWillBeRawPtr<ClientRectList> Internals::nonFastScrollableRects(Documen t* document, ExceptionState& exceptionState) const
1914 { 1914 {
1915 if (!document || !document->frame()) { 1915 if (!document || !document->frame()) {
1916 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "The document provided is invalid."); 1916 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "The document provided is invalid.");
1917 return nullptr; 1917 return nullptr;
1918 } 1918 }
1919 1919
1920 Page* page = document->page(); 1920 Page* page = document->page();
1921 if (!page) 1921 if (!page)
1922 return nullptr; 1922 return nullptr;
1923 1923
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 document = toDocument(node); 2127 document = toDocument(node);
2128 } else if (isHTMLIFrameElement(*node)) { 2128 } else if (isHTMLIFrameElement(*node)) {
2129 document = toHTMLIFrameElement(*node).contentDocument(); 2129 document = toHTMLIFrameElement(*node).contentDocument();
2130 } else { 2130 } else {
2131 exceptionState.throwTypeError("The node provided is neither a document n or an IFrame."); 2131 exceptionState.throwTypeError("The node provided is neither a document n or an IFrame.");
2132 return; 2132 return;
2133 } 2133 }
2134 document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksS ynchronously); 2134 document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksS ynchronously);
2135 } 2135 }
2136 2136
2137 PassRefPtr<ClientRectList> Internals::draggableRegions(Document* document, Excep tionState& exceptionState) 2137 PassRefPtrWillBeRawPtr<ClientRectList> Internals::draggableRegions(Document* doc ument, ExceptionState& exceptionState)
2138 { 2138 {
2139 return annotatedRegions(document, true, exceptionState); 2139 return annotatedRegions(document, true, exceptionState);
2140 } 2140 }
2141 2141
2142 PassRefPtr<ClientRectList> Internals::nonDraggableRegions(Document* document, Ex ceptionState& exceptionState) 2142 PassRefPtrWillBeRawPtr<ClientRectList> Internals::nonDraggableRegions(Document* document, ExceptionState& exceptionState)
2143 { 2143 {
2144 return annotatedRegions(document, false, exceptionState); 2144 return annotatedRegions(document, false, exceptionState);
2145 } 2145 }
2146 2146
2147 PassRefPtr<ClientRectList> Internals::annotatedRegions(Document* document, bool draggable, ExceptionState& exceptionState) 2147 PassRefPtrWillBeRawPtr<ClientRectList> Internals::annotatedRegions(Document* doc ument, bool draggable, ExceptionState& exceptionState)
2148 { 2148 {
2149 if (!document || !document->view()) { 2149 if (!document || !document->view()) {
2150 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's view cannot be retrieved." : "The document provided is invalid."); 2150 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's view cannot be retrieved." : "The document provided is invalid.");
2151 return ClientRectList::create(); 2151 return ClientRectList::create();
2152 } 2152 }
2153 2153
2154 document->updateLayout(); 2154 document->updateLayout();
2155 document->view()->updateAnnotatedRegions(); 2155 document->view()->updateAnnotatedRegions();
2156 Vector<AnnotatedRegionValue> regions = document->annotatedRegions(); 2156 Vector<AnnotatedRegionValue> regions = document->annotatedRegions();
2157 2157
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 { 2260 {
2261 String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar)); 2261 String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar));
2262 return SerializedScriptValue::createFromWire(value); 2262 return SerializedScriptValue::createFromWire(value);
2263 } 2263 }
2264 2264
2265 void Internals::forceReload(bool endToEnd) 2265 void Internals::forceReload(bool endToEnd)
2266 { 2266 {
2267 frame()->loader().reload(endToEnd ? EndToEndReload : NormalReload); 2267 frame()->loader().reload(endToEnd ? EndToEndReload : NormalReload);
2268 } 2268 }
2269 2269
2270 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& exceptionState ) 2270 PassRefPtrWillBeRawPtr<ClientRect> Internals::selectionBounds(ExceptionState& ex ceptionState)
2271 { 2271 {
2272 Document* document = contextDocument(); 2272 Document* document = contextDocument();
2273 if (!document || !document->frame()) { 2273 if (!document || !document->frame()) {
2274 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "No context document can be obtained."); 2274 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "No context document can be obtained.");
2275 return nullptr; 2275 return nullptr;
2276 } 2276 }
2277 2277
2278 return ClientRect::create(document->frame()->selection().bounds()); 2278 return ClientRect::create(document->frame()->selection().bounds());
2279 } 2279 }
2280 2280
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2457 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2458 { 2458 {
2459 if (!node) 2459 if (!node)
2460 return String(); 2460 return String();
2461 blink::WebPoint point(x, y); 2461 blink::WebPoint point(x, y);
2462 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength); 2462 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength);
2463 return surroundingText.content(); 2463 return surroundingText.content();
2464 } 2464 }
2465 2465
2466 } 2466 }
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/LayerRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698