Title: [127782] trunk/Source/WebKit/blackberry
Revision
127782
Author
[email protected]
Date
2012-09-06 14:00:43 -0700 (Thu, 06 Sep 2012)

Log Message

Add data-blackberry-webworks-context attribute and set the custom context when
getting context.
https://bugs.webkit.org/show_bug.cgi?id=95993

Patch by Genevieve Mak <[email protected]> on 2012-09-06
Reviewed by Antonio Gomes.

PR #193726
Reviewed Internally by Mike Fenton.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::webContext):
    - Check for custom WebWorks context and add it if there.
* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::webWorksContext):
(DOMSupport):
* WebKitSupport/DOMSupport.h:
    - Add a method that checks a given element for the data-webworks-context
      attribute and returns its value if present.

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (127781 => 127782)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-09-06 20:55:13 UTC (rev 127781)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-09-06 21:00:43 UTC (rev 127782)
@@ -2417,6 +2417,13 @@
 
     if (node->isElementNode()) {
         Element* element = static_cast<Element*>(node->shadowAncestorNode());
+
+        String webWorksContext(DOMSupport::webWorksContext(element));
+        if (!webWorksContext.stripWhiteSpace().isEmpty()) {
+            context.setFlag(Platform::WebContext::IsWebWorksContext);
+            context.setWebWorksContext(webWorksContext.utf8().data());
+        }
+
         if (DOMSupport::isTextBasedContentEditableElement(element)) {
             if (!canStartSelection) {
                 // Input fields host node is by spec non-editable unless the field itself has content editable enabled.

Modified: trunk/Source/WebKit/blackberry/ChangeLog (127781 => 127782)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-09-06 20:55:13 UTC (rev 127781)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-09-06 21:00:43 UTC (rev 127782)
@@ -1,3 +1,24 @@
+2012-09-06  Genevieve Mak  <[email protected]>
+
+        Add data-blackberry-webworks-context attribute and set the custom context when
+        getting context.
+        https://bugs.webkit.org/show_bug.cgi?id=95993
+
+        Reviewed by Antonio Gomes.
+
+        PR #193726
+        Reviewed Internally by Mike Fenton.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::webContext):
+            - Check for custom WebWorks context and add it if there.
+        * WebKitSupport/DOMSupport.cpp:
+        (BlackBerry::WebKit::DOMSupport::webWorksContext):
+        (DOMSupport):
+        * WebKitSupport/DOMSupport.h:
+            - Add a method that checks a given element for the data-webworks-context
+              attribute and returns its value if present.
+
 2012-09-06  Antonio Gomes  <[email protected]>
 
         [BlackBerry] Allow overscroll to composited scroll layers

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp (127781 => 127782)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2012-09-06 20:55:13 UTC (rev 127781)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2012-09-06 21:00:43 UTC (rev 127782)
@@ -116,6 +116,18 @@
     return elementText;
 }
 
+WTF::String webWorksContext(const WebCore::Element* element)
+{
+    if (!element)
+        return WTF::String();
+
+    DEFINE_STATIC_LOCAL(QualifiedName, webworksContextAttr, (nullAtom, "data-blackberry-webworks-context", nullAtom));
+    if (element->fastHasAttribute(webworksContextAttr))
+        return element->fastGetAttribute(webworksContextAttr);
+
+    return WTF::String();
+}
+
 bool isElementTypePlugin(const Element* element)
 {
     if (!element)

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h (127781 => 127782)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2012-09-06 20:55:13 UTC (rev 127781)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2012-09-06 21:00:43 UTC (rev 127782)
@@ -63,6 +63,7 @@
 AttributeState elementSupportsSpellCheck(const WebCore::Element*);
 
 WTF::String inputElementText(WebCore::Element*);
+WTF::String webWorksContext(const WebCore::Element*);
 
 WebCore::HTMLTextFormControlElement* toTextControlElement(WebCore::Node*);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to