Title: [123214] trunk/Source/WebCore
Revision
123214
Author
[email protected]
Date
2012-07-20 07:23:37 -0700 (Fri, 20 Jul 2012)

Log Message

ColorChooserClient should expose the element's location
https://bugs.webkit.org/show_bug.cgi?id=91767

Reviewed by Kent Tamura.

The rationale is that the chrome client could have an interest in placing the picker next to
the element for usability reasons.

No new tests as there is not much logic here: Just exposing a geometry information to WebKit.

* html/ColorInputType.cpp:
(WebCore::ColorInputType::elementRectRelativeToWindow):
(WebCore):
* html/ColorInputType.h:
(ColorInputType):
* platform/ColorChooserClient.h:
(ColorChooserClient):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123213 => 123214)


--- trunk/Source/WebCore/ChangeLog	2012-07-20 14:11:17 UTC (rev 123213)
+++ trunk/Source/WebCore/ChangeLog	2012-07-20 14:23:37 UTC (rev 123214)
@@ -1,3 +1,23 @@
+2012-07-20  Pierre Rossi  <[email protected]>
+
+        ColorChooserClient should expose the element's location
+        https://bugs.webkit.org/show_bug.cgi?id=91767
+
+        Reviewed by Kent Tamura.
+
+        The rationale is that the chrome client could have an interest in placing the picker next to
+        the element for usability reasons.
+
+        No new tests as there is not much logic here: Just exposing a geometry information to WebKit.
+
+        * html/ColorInputType.cpp:
+        (WebCore::ColorInputType::elementRectRelativeToWindow):
+        (WebCore):
+        * html/ColorInputType.h:
+        (ColorInputType):
+        * platform/ColorChooserClient.h:
+        (ColorChooserClient):
+
 2012-07-20  Thiago Marcos P. Santos  <[email protected]>
 
         [WK2] WebIntents doesn't build if mutation observers is disabled

Modified: trunk/Source/WebCore/html/ColorInputType.cpp (123213 => 123214)


--- trunk/Source/WebCore/html/ColorInputType.cpp	2012-07-20 14:11:17 UTC (rev 123213)
+++ trunk/Source/WebCore/html/ColorInputType.cpp	2012-07-20 14:23:37 UTC (rev 123214)
@@ -38,6 +38,8 @@
 #include "HTMLDivElement.h"
 #include "HTMLInputElement.h"
 #include "MouseEvent.h"
+#include "RenderObject.h"
+#include "RenderView.h"
 #include "ScriptController.h"
 #include "ShadowRoot.h"
 
@@ -195,6 +197,13 @@
     return shadow ? toHTMLElement(shadow->firstChild()->firstChild()) : 0;
 }
 
+IntRect ColorInputType::elementRectRelativeToWindow() const
+{
+    RenderObject* renderer = element()->renderer();
+    ASSERT(renderer);
+    return pixelSnappedIntRect(renderer->view()->frameView()->contentsToWindow(renderer->absoluteBoundingBoxRect()));
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INPUT_TYPE_COLOR)

Modified: trunk/Source/WebCore/html/ColorInputType.h (123213 => 123214)


--- trunk/Source/WebCore/html/ColorInputType.h	2012-07-20 14:11:17 UTC (rev 123213)
+++ trunk/Source/WebCore/html/ColorInputType.h	2012-07-20 14:23:37 UTC (rev 123214)
@@ -46,6 +46,7 @@
     // ColorChooserClient implementation.
     virtual void didChooseColor(const Color&) OVERRIDE;
     virtual void didEndChooser() OVERRIDE;
+    virtual IntRect elementRectRelativeToWindow() const OVERRIDE;
 
 private:
     ColorInputType(HTMLInputElement* element) : BaseClickableWithKeyInputType(element) { }

Modified: trunk/Source/WebCore/platform/ColorChooserClient.h (123213 => 123214)


--- trunk/Source/WebCore/platform/ColorChooserClient.h	2012-07-20 14:11:17 UTC (rev 123213)
+++ trunk/Source/WebCore/platform/ColorChooserClient.h	2012-07-20 14:23:37 UTC (rev 123214)
@@ -4,6 +4,7 @@
 #if ENABLE(INPUT_TYPE_COLOR)
 
 #include "ColorChooser.h"
+#include "IntRect.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 
@@ -17,6 +18,7 @@
 
     virtual void didChooseColor(const Color&) = 0;
     virtual void didEndChooser() = 0;
+    virtual IntRect elementRectRelativeToWindow() const = 0;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to