https://bugs.webkit.org/show_bug.cgi?id=44724
Reviewed by Darin Fisher.
* public/WebBindings.h:
* public/WebFrame.h:
* src/WebBindings.cpp:
(WebKit::getElementImpl):
(WebKit::WebBindings::getElement):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::markerTextForListItem):
* src/WebFrameImpl.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@66176
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2010-08-26 Dumitru Daniliuc <dumi@chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Add support for markerTextForListItem() to Chromium's LayoutTestController.
+ https://bugs.webkit.org/show_bug.cgi?id=44724
+
+ * public/WebBindings.h:
+ * public/WebFrame.h:
+ * src/WebBindings.cpp:
+ (WebKit::getElementImpl):
+ (WebKit::WebBindings::getElement):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::markerTextForListItem):
+ * src/WebFrameImpl.h:
+
2010-08-26 James Robinson <jamesr@chromium.org>
Reviewed by Darin Fisher.
namespace WebKit {
class WebDragData;
+class WebElement;
class WebRange;
// A haphazard collection of functions for dealing with plugins.
// If so, return that range as a WebRange object.
WEBKIT_API static bool getRange(NPObject* range, WebRange*);
+ // Return true (success) if the given npobj is an element.
+ // If so, return that element as a WebElement object.
+ WEBKIT_API static bool getElement(NPObject* element, WebElement*);
+
// Exceptions -------------------------------------------------------------
typedef void (ExceptionHandler)(void* data, const NPUTF8* message);
// used to support layout tests.
virtual WebString counterValueForElementById(const WebString& id) const = 0;
+ // Calls markerTextForListItem() defined in WebCore/rendering/RenderTreeAsText.h.
+ virtual WebString markerTextForListItem(const WebElement&) const = 0;
// Returns the number of page where the specified element will be put.
// This method is used to support layout tests.
#include "Range.h"
#include "V8BindingState.h"
#include "V8DOMWrapper.h"
+#include "V8Element.h"
#include "V8Event.h"
#include "V8Helpers.h"
#include "V8HiddenPropertyName.h"
#include "bridge/c/c_utility.h"
#endif
#include "WebDragData.h"
+#include "WebElement.h"
#include "WebRange.h"
#if USE(JAVASCRIPTCORE_BINDINGS)
return true;
}
+static bool getElementImpl(NPObject* npObj, WebElement* webElement)
+{
+ if (!npObj || (npObj->_class != npScriptObjectClass))
+ return false;
+
+ V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(npObj);
+ v8::Handle<v8::Object> v8Object(v8NPObject->v8Object);
+ Element* native = V8Element::toNative(v8Object);
+ if (!native)
+ return false;
+
+ *webElement = WebElement(native);
+ return true;
+}
+
#endif
bool WebBindings::getDragData(NPObject* event, int* eventId, WebDragData* data)
#endif
}
+bool WebBindings::getElement(NPObject* element, WebElement* webElement)
+{
+#if USE(V8)
+ return getElementImpl(element, webElement);
+#else
+ // Not supported on other ports (JSC, etc.).
+ return false;
+#endif
+}
+
void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data)
{
WebCore::pushExceptionHandler(handler, data);
return counterValueForElement(element);
}
+WebString WebFrameImpl::markerTextForListItem(const WebElement& webElement) const
+{
+ return WebCore::markerTextForListItem(webElement.unwrap<Element>());
+}
+
int WebFrameImpl::pageNumberForElementById(const WebString& id,
float pageWidthInPixels,
float pageHeightInPixels) const
virtual WebString contentAsMarkup() const;
virtual WebString renderTreeAsText() const;
virtual WebString counterValueForElementById(const WebString& id) const;
+ virtual WebString markerTextForListItem(const WebElement&) const;
virtual int pageNumberForElementById(const WebString& id,
float pageWidthInPixels,
float pageHeightInPixels) const;