Changeset 121713 in webkit
- Timestamp:
- Jul 2, 2012 5:53:26 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r121711 r121713 1 2012-07-02 Leandro Gracia Gil <leandrogracia@chromium.org> 2 3 [Chromium] Implement a Layout Test for editing/SurroundingText 4 https://bugs.webkit.org/show_bug.cgi?id=82461 5 6 Reviewed by Ryosuke Niwa. 7 8 Add a new layout test for the surrounding text feature. 9 10 * platform/chromium/editing/surrounding-text/surrounding-text-expected.txt: Added. 11 * platform/chromium/editing/surrounding-text/surrounding-text.html: Added. 12 1 13 2012-07-02 Emil A Eklund <eae@chromium.org> 2 14 -
trunk/Source/WebKit/chromium/ChangeLog
r121707 r121713 1 2012-07-02 Leandro Gracia Gil <leandrogracia@chromium.org> 2 3 [Chromium] Implement a Layout Test for editing/SurroundingText 4 https://bugs.webkit.org/show_bug.cgi?id=82461 5 6 Reviewed by Ryosuke Niwa. 7 8 Allow passing nodes as arguments for layout test methods. 9 10 * public/WebBindings.h: 11 (WebBindings): 12 * src/WebBindings.cpp: 13 (WebKit::getNodeImpl): 14 (WebKit): 15 (WebKit::WebBindings::getNode): 16 1 17 2012-07-02 Benjamin Poulain <bpoulain@apple.com> 2 18 -
trunk/Source/WebKit/chromium/public/WebBindings.h
r101896 r121713 153 153 WEBKIT_EXPORT static bool getArrayBufferView(NPObject* arrayBufferView, WebArrayBufferView*); 154 154 155 // Return true (success) if the given npobj is a node. 156 // If so, return that node as a WebNode object. 157 WEBKIT_EXPORT static bool getNode(NPObject* element, WebNode*); 158 155 159 // Return true (success) if the given npobj is an element. 156 160 // If so, return that element as a WebElement object. -
trunk/Source/WebKit/chromium/src/WebBindings.cpp
r121610 r121713 224 224 } 225 225 226 static bool getNodeImpl(NPObject* object, WebNode* webNode) 227 { 228 if (!object || (object->_class != npScriptObjectClass)) 229 return false; 230 231 V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); 232 v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); 233 Node* native = V8Node::HasInstance(v8Object) ? V8Node::toNative(v8Object) : 0; 234 if (!native) 235 return false; 236 237 *webNode = WebNode(native); 238 return true; 239 } 240 226 241 static bool getElementImpl(NPObject* object, WebElement* webElement) 227 242 { … … 325 340 #else 326 341 // Not supported on other ports (JSC, etc). 342 return false; 343 #endif 344 } 345 346 bool WebBindings::getNode(NPObject* node, WebNode* webNode) 347 { 348 #if USE(V8) 349 return getNodeImpl(node, webNode); 350 #else 351 // Not supported on other ports (JSC, etc.). 327 352 return false; 328 353 #endif -
trunk/Tools/ChangeLog
r121706 r121713 1 2012-07-02 Leandro Gracia Gil <leandrogracia@chromium.org> 2 3 [Chromium] Implement a Layout Test for editing/SurroundingText 4 https://bugs.webkit.org/show_bug.cgi?id=82461 5 6 Reviewed by Ryosuke Niwa. 7 8 Add a new method to the layout test controller in order to retrieve the 9 text surrounding a provided element. 10 11 * DumpRenderTree/chromium/LayoutTestController.cpp: 12 (LayoutTestController::LayoutTestController): 13 (LayoutTestController::textSurroundingElement): 14 * DumpRenderTree/chromium/LayoutTestController.h: 15 (LayoutTestController): 16 1 17 2012-07-02 Ojan Vafai <ojan@chromium.org> 2 18 -
trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
r121489 r121713 39 39 #include "WebAnimationController.h" 40 40 #include "WebBindings.h" 41 #include "WebWorkerInfo.h"42 41 #include "WebConsoleMessage.h" 43 #include "platform/WebData.h"44 42 #include "WebDeviceOrientation.h" 45 43 #include "WebDeviceOrientationClientMock.h" … … 59 57 #include "WebScriptSource.h" 60 58 #include "WebSecurityPolicy.h" 59 #include "WebSettings.h" 60 #include "WebSurroundingText.h" 61 #include "WebView.h" 62 #include "WebViewHost.h" 63 #include "WebWorkerInfo.h" 64 #include "platform/WebData.h" 61 65 #include "platform/WebSerializedScriptValue.h" 62 #include "WebSettings.h"63 66 #include "platform/WebSize.h" 64 67 #include "platform/WebURL.h" 65 #include "WebView.h"66 #include "WebViewHost.h"67 68 #include "v8/include/v8.h" 68 69 #include "webkit/support/webkit_support.h" … … 73 74 #include <limits> 74 75 #include <sstream> 76 #include <wtf/OwnArrayPtr.h> 75 77 #include <wtf/text/WTFString.h> 76 #include <wtf/OwnArrayPtr.h>77 78 78 79 #if OS(LINUX) || OS(ANDROID) … … 276 277 bindMethod("selectionAsMarkup", &LayoutTestController::selectionAsMarkup); 277 278 bindMethod("setHasCustomFullScreenBehavior", &LayoutTestController::setHasCustomFullScreenBehavior); 278 279 bindMethod("textSurroundingElement", &LayoutTestController::textSurroundingElement); 280 279 281 // The fallback method is called when an unknown method is invoked. 280 282 bindFallbackMethod(&LayoutTestController::fallbackMethod); … … 2344 2346 } 2345 2347 #endif 2348 2349 void LayoutTestController::textSurroundingElement(const CppArgumentList& arguments, CppVariant* result) 2350 { 2351 result->setNull(); 2352 if (arguments.size() < 3 || !arguments[0].isObject() || !arguments[1].isNumber() || !arguments[2].isNumber()) 2353 return; 2354 2355 WebNode node; 2356 if (!WebBindings::getNode(arguments[0].value.objectValue, &node)) 2357 return; 2358 2359 if (node.isNull() || !node.isTextNode()) 2360 return; 2361 2362 unsigned offset = arguments[1].toInt32(); 2363 if (offset >= node.nodeValue().length()) { 2364 result->set(WebString().utf8()); 2365 return; 2366 } 2367 2368 WebSurroundingText surroundingText; 2369 unsigned maxLength = arguments[2].toInt32(); 2370 surroundingText.initialize(node, offset, maxLength); 2371 result->set(surroundingText.textContent().utf8()); 2372 } -
trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h
r121453 r121713 456 456 // Used to set the device scale factor. 457 457 void setBackingScaleFactor(const CppArgumentList&, CppVariant*); 458 459 // Retrieves the text surrounding a position in a text node. 460 // The first child of the element given y its id will be used as reference, 461 // or its next sibling if not present. It must be a text node. 462 void textSurroundingElement(const CppArgumentList&, CppVariant*); 458 463 459 464 public:
Note: See TracChangeset
for help on using the changeset viewer.