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

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

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. 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
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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 exceptionState.throwDOMException(SyntaxError, "The marker type provided ('" + markerType + "') is invalid."); 861 exceptionState.throwDOMException(SyntaxError, "The marker type provided ('" + markerType + "') is invalid.");
862 return 0; 862 return 0;
863 } 863 }
864 864
865 Vector<DocumentMarker*> markers = node->document().markers().markersFor(node , markerTypes); 865 Vector<DocumentMarker*> markers = node->document().markers().markersFor(node , markerTypes);
866 if (markers.size() <= index) 866 if (markers.size() <= index)
867 return 0; 867 return 0;
868 return markers[index]; 868 return markers[index];
869 } 869 }
870 870
871 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker Type, unsigned index, ExceptionState& exceptionState) 871 PassRefPtrWillBeRawPtr<Range> Internals::markerRangeForNode(Node* node, const St ring& markerType, unsigned index, ExceptionState& exceptionState)
872 { 872 {
873 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); 873 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState);
874 if (!marker) 874 if (!marker)
875 return nullptr; 875 return nullptr;
876 return Range::create(node->document(), node, marker->startOffset(), node, ma rker->endOffset()); 876 return Range::create(node->document(), node, marker->startOffset(), node, ma rker->endOffset());
877 } 877 }
878 878
879 String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionState& exceptionState) 879 String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionState& exceptionState)
880 { 880 {
881 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); 881 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo ng h, ExceptionState& exceptionState) 1071 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo ng h, ExceptionState& exceptionState)
1072 { 1072 {
1073 if (!element || !element->document().view()) { 1073 if (!element || !element->document().view()) {
1074 exceptionState.throwDOMException(InvalidNodeTypeError, element ? "No vie w can be obtained from the provided element's document." : ExceptionMessages::ar gumentNullOrIncorrectType(1, "Element")); 1074 exceptionState.throwDOMException(InvalidNodeTypeError, element ? "No vie w can be obtained from the provided element's document." : ExceptionMessages::ar gumentNullOrIncorrectType(1, "Element"));
1075 return; 1075 return;
1076 } 1076 }
1077 FrameView* frameView = element->document().view(); 1077 FrameView* frameView = element->document().view();
1078 frameView->scrollElementToRect(element, IntRect(x, y, w, h)); 1078 frameView->scrollElementToRect(element, IntRect(x, y, w, h));
1079 } 1079 }
1080 1080
1081 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang eLocation, int rangeLength, ExceptionState& exceptionState) 1081 PassRefPtrWillBeRawPtr<Range> Internals::rangeFromLocationAndLength(Element* sco pe, int rangeLocation, int rangeLength, ExceptionState& exceptionState)
1082 { 1082 {
1083 if (!scope) { 1083 if (!scope) {
1084 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element")); 1084 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element"));
1085 return nullptr; 1085 return nullptr;
1086 } 1086 }
1087 1087
1088 // TextIterator depends on Layout information, make sure layout it up to dat e. 1088 // TextIterator depends on Layout information, make sure layout it up to dat e.
1089 scope->document().updateLayoutIgnorePendingStylesheets(); 1089 scope->document().updateLayoutIgnorePendingStylesheets();
1090 1090
1091 return PlainTextRange(rangeLocation, rangeLocation + rangeLength).createRang e(*scope); 1091 return PlainTextRange(rangeLocation, rangeLocation + rangeLength).createRang e(*scope);
(...skipping 1365 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

Powered by Google App Engine
This is Rietveld 408576698