https://bugs.webkit.org/show_bug.cgi?id=127539
Reviewed by Gyuyoung Kim.
Source/WebCore:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
Added m_viewBackgroundColor to clear when m_setDrawsBackground is false.
(WebCore::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
(WebCore::CoordinatedGraphicsScene::paintToCurrentGLContext):
(WebCore::CoordinatedGraphicsScene::paintToGraphicsContext):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:
(WebCore::CoordinatedGraphicsScene::setViewBackgroundColor):
(WebCore::CoordinatedGraphicsScene::viewBackgroundColor):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
Added EFL guard not to set opaque as a default for MainFrameRenderViewLayer.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::ensureRootLayer):
Added EFL guard to apply page scale on RenderView like IOS.
Source/WebKit2:
EFL have a way to change the color using evas_object_color_set and we used it to change background.
But, We should not use it because the alpha value of color_set is used
for the transparancy of object itself including background and contents.
This patch added ewk_view_bg_color_{get|set} to change the background color.
* UIProcess/API/C/efl/WKViewEfl.cpp:
Extracted controls of page background out of color_set.
color_set will be only used for the opacity of whole contents.
(WKViewSetBackgroundColor): Added to share page background color.
(WKViewGetBackgroundColor):
* UIProcess/API/C/efl/WKViewEfl.h:
* UIProcess/API/efl/EwkView.cpp:
(EwkView::handleEvasObjectColorSet):
* UIProcess/API/efl/ewk_view.cpp:
Removed ewk_view_draws_page_background_set which just control whether to draw background.
ewk_view_bg_color_set will conver it.
(ewk_view_bg_color_set):
(ewk_view_bg_color_get):
* UIProcess/API/efl/ewk_view.h:
* UIProcess/API/efl/tests/test_ewk2_view.cpp: Added simple test case.
* UIProcess/efl/WebViewEfl.cpp:
(WebKit::WebViewEfl::setViewBackgroundColor):
(WebKit::WebViewEfl::viewBackgroundColor):
* UIProcess/efl/WebViewEfl.h:
Tools:
Added an option(C) to change background color.
* MiniBrowser/efl/main.c:
(window_create):
(elm_main):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166566
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-03-31 Ryuan Choi <ryuan.choi@samsung.com>
+
+ [EFL][WK2] Extract the control of page background out of color_set
+ https://bugs.webkit.org/show_bug.cgi?id=127539
+
+ Reviewed by Gyuyoung Kim.
+
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
+ Added m_viewBackgroundColor to clear when m_setDrawsBackground is false.
+ (WebCore::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
+ (WebCore::CoordinatedGraphicsScene::paintToCurrentGLContext):
+ (WebCore::CoordinatedGraphicsScene::paintToGraphicsContext):
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:
+ (WebCore::CoordinatedGraphicsScene::setViewBackgroundColor):
+ (WebCore::CoordinatedGraphicsScene::viewBackgroundColor):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
+ Added EFL guard not to set opaque as a default for MainFrameRenderViewLayer.
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::ensureRootLayer):
+ Added EFL guard to apply page scale on RenderView like IOS.
+
2014-03-31 Byungseon Shin <sun.shin@lge.com>
[WebGL][OpenGLES] Enable MSAA support for WebGL Canvas
, m_isActive(false)
, m_rootLayerID(InvalidCoordinatedLayerID)
, m_backgroundColor(Color::white)
+ , m_viewBackgroundColor(Color::white)
, m_setDrawsBackground(false)
{
ASSERT(isMainThread());
m_backgroundColor.green(), m_backgroundColor.blue(),
m_backgroundColor.alpha() * opacity);
m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), Color(rgba));
+ } else {
+ GraphicsContext3D* context = static_cast<TextureMapperGL*>(m_textureMapper.get())->graphicsContext3D();
+ context->clearColor(m_viewBackgroundColor.red() / 255.0f, m_viewBackgroundColor.green() / 255.0f, m_viewBackgroundColor.blue() / 255.0f, m_viewBackgroundColor.alpha() / 255.0f);
+ context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
}
if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) {
IntRect clipRect = graphicsContext.clipBounds();
if (m_setDrawsBackground)
m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), m_backgroundColor);
+ else
+ m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), m_viewBackgroundColor);
layer->paint();
m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location());
void setBackgroundColor(const Color&);
void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; }
+ void setViewBackgroundColor(const Color& color) { m_viewBackgroundColor = color; }
+ Color viewBackgroundColor() const { return m_viewBackgroundColor; }
+
private:
void setRootLayerID(CoordinatedLayerID);
void createLayers(const Vector<CoordinatedLayerID>&);
FloatPoint m_scrollPosition;
FloatPoint m_renderedContentsScrollPosition;
Color m_backgroundColor;
+ Color m_viewBackgroundColor;
bool m_setDrawsBackground;
TextureMapperFPSCounter m_fpsCounter;
m_graphicsLayer->addChild(m_childContainmentLayer.get());
}
+#if !PLATFORM(IOS) && !PLATFORM(EFL)
if (m_isMainFrameRenderViewLayer) {
-#if !PLATFORM(IOS)
// Page scale is applied above the RenderView on iOS.
m_graphicsLayer->setContentsOpaque(true);
m_graphicsLayer->setAppliesPageScale();
-#endif
}
+#endif
#if PLATFORM(COCOA) && USE(CA)
if (!compositor().acceleratedDrawingEnabled() && renderer().isCanvas()) {
#include "HitTestResult.h"
#include "InspectorInstrumentation.h"
#include "Logging.h"
+#include "MainFrame.h"
#include "NodeList.h"
#include "Page.h"
#include "ProgressTracker.h"
m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.maxY()));
m_rootContentLayer->setPosition(FloatPoint());
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) || PLATFORM(EFL)
// Page scale is applied above this on iOS, so we'll just say that our root layer applies it.
Frame& frame = m_renderView.frameView().frame();
if (frame.isMainFrame())
+2014-03-31 Ryuan Choi <ryuan.choi@samsung.com>
+
+ [EFL][WK2] Extract the control of page background out of color_set
+ https://bugs.webkit.org/show_bug.cgi?id=127539
+
+ Reviewed by Gyuyoung Kim.
+
+ EFL have a way to change the color using evas_object_color_set and we used it to change background.
+ But, We should not use it because the alpha value of color_set is used
+ for the transparancy of object itself including background and contents.
+
+ This patch added ewk_view_bg_color_{get|set} to change the background color.
+
+ * UIProcess/API/C/efl/WKViewEfl.cpp:
+ Extracted controls of page background out of color_set.
+ color_set will be only used for the opacity of whole contents.
+ (WKViewSetBackgroundColor): Added to share page background color.
+ (WKViewGetBackgroundColor):
+ * UIProcess/API/C/efl/WKViewEfl.h:
+ * UIProcess/API/efl/EwkView.cpp:
+ (EwkView::handleEvasObjectColorSet):
+ * UIProcess/API/efl/ewk_view.cpp:
+ Removed ewk_view_draws_page_background_set which just control whether to draw background.
+ ewk_view_bg_color_set will conver it.
+ (ewk_view_bg_color_set):
+ (ewk_view_bg_color_get):
+ * UIProcess/API/efl/ewk_view.h:
+ * UIProcess/API/efl/tests/test_ewk2_view.cpp: Added simple test case.
+ * UIProcess/efl/WebViewEfl.cpp:
+ (WebKit::WebViewEfl::setViewBackgroundColor):
+ (WebKit::WebViewEfl::viewBackgroundColor):
+ * UIProcess/efl/WebViewEfl.h:
+
2014-03-31 Joonghun Park <jh718.park@samsung.com>
[EFL][WK2]Implement ewk APIs of web local storage which have deletion functions of the local storage entries
{
static_cast<WebViewEfl*>(toImpl(viewRef))->sendMouseEvent(event);
}
+
+void WKViewSetBackgroundColor(WKViewRef viewRef, int red, int green, int blue, int alpha)
+{
+ static_cast<WebViewEfl*>(toImpl(viewRef))->setViewBackgroundColor(WebCore::Color(red, green, blue, alpha));
+}
+
+void WKViewGetBackgroundColor(WKViewRef viewRef, int* red, int* green, int* blue, int* alpha)
+{
+ WebCore::Color backgroundColor = static_cast<WebViewEfl*>(toImpl(viewRef))->viewBackgroundColor();
+
+ if (red)
+ *red = backgroundColor.red();
+ if (green)
+ *green = backgroundColor.green();
+ if (blue)
+ *blue = backgroundColor.blue();
+ if (alpha)
+ *alpha = backgroundColor.alpha();
+}
WK_EXPORT void WKViewSendMouseUpEvent(WKViewRef, Evas_Event_Mouse_Up*);
WK_EXPORT void WKViewSendMouseMoveEvent(WKViewRef, Evas_Event_Mouse_Move*);
+WK_EXPORT void WKViewSetBackgroundColor(WKViewRef, int red, int green, int blue, int alpha);
+WK_EXPORT void WKViewGetBackgroundColor(WKViewRef, int* red, int* green, int* blue, int* alpha);
+
#ifdef __cplusplus
}
#endif
Ewk_View_Smart_Data* smartData = toSmartData(evasObject);
ASSERT(smartData);
- EwkView* view = toEwkView(smartData);
- ASSERT(view);
-
- alpha = clampTo(alpha, 0, 255);
- red = clampTo(red, 0, alpha);
- green = clampTo(green, 0, alpha);
- blue = clampTo(blue, 0, alpha);
-
evas_object_image_alpha_set(smartData->image, alpha < 255);
- WKViewSetDrawsBackground(view->wkView(), red || green || blue);
- WKViewSetDrawsTransparentBackground(view->wkView(), alpha < 255);
-
parentSmartClass.color_set(evasObject, red, green, blue, alpha);
}
#include <WebKit2/WKString.h>
#include <WebKit2/WKURL.h>
#include <WebKit2/WKView.h>
+#include <WebKit2/WKViewEfl.h>
#include <wtf/text/CString.h>
#if ENABLE(INSPECTOR)
#endif
}
-void ewk_view_draws_page_background_set(Evas_Object *ewkView, Eina_Bool enabled)
-{
- EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
-
- WKViewSetDrawsBackground(impl->wkView(), enabled);
-}
-
/// Creates a type name for Ewk_Page_Contents_Context.
typedef struct Ewk_Page_Contents_Context Ewk_Page_Contents_Context;
return WKPageUseFixedLayout(WKViewGetPage(impl->wkView()));
}
+
+void ewk_view_bg_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha)
+{
+ if (EINA_UNLIKELY(alpha < 0 || alpha > 255)) {
+ EINA_LOG_CRIT("Alpha should be between 0 and 255");
+ return;
+ }
+
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
+
+ if (red == 255 && green == 255 && blue == 255 && alpha == 255)
+ WKViewSetDrawsBackground(impl->wkView(), true);
+ else
+ WKViewSetDrawsBackground(impl->wkView(), false);
+
+ WKViewSetBackgroundColor(impl->wkView(), red, green, blue, alpha);
+}
+
+void ewk_view_bg_color_get(const Evas_Object* ewkView, int* red, int* green, int* blue, int* alpha)
+{
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
+
+ WKViewGetBackgroundColor(impl->wkView(), red, green, blue, alpha);
+}
EAPI Eina_Bool ewk_view_fullscreen_exit(Evas_Object *o);
/**
- * Sets whether the ewk_view background matches page background color.
- *
- * If enabled sets view background color close to page color on page load.
- * This helps to reduce flicker on page scrolling and repainting in places
- * where page content is not ready for painting.
- * View background color can interfere with semi-transparent pages and is
- * disabled by default.
- *
- * @param o view object to enable/disable background matching
- * @param enabled a state to set
- *
- * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
- */
-EAPI void ewk_view_draws_page_background_set(Evas_Object *o, Eina_Bool enabled);
-
-/**
* Get contents of the current web page.
*
* @param o view object to get the page contents
*/
EAPI Eina_Bool ewk_view_layout_fixed_get(const Evas_Object *o);
+/**
+ * Sets the background color and transparency of the view.
+ *
+ * @param o view object to change the background color
+ * @param r red color component
+ * @param g green color component
+ * @param b blue color component
+ * @param a transparency
+ */
+EAPI void ewk_view_bg_color_set(Evas_Object *o, int r, int g, int b, int a);
+
+/**
+ * Gets the background color of the view.
+ *
+ * @param o view object to get the background color
+ * @param r the pointer to store red color component
+ * @param g the pointer to store green color component
+ * @param b the pointer to store blue color component
+ * @param a the pointer to store alpha value
+ */
+EAPI void ewk_view_bg_color_get(const Evas_Object *o, int *r, int *g, int *b, int *a);
+
#ifdef __cplusplus
}
#endif
EXPECT_TRUE(ewk_view_layout_fixed_set(webView(), true));
EXPECT_TRUE(ewk_view_layout_fixed_get(webView()));
}
+
+TEST_F(EWK2ViewTest, ewk_view_bg_color)
+{
+ const char noBackgroundHTML[] = "<!doctype html><body></body>";
+
+ ewk_view_bg_color_set(webView(), 255, 0, 0, 255);
+ ewk_view_html_string_load(webView(), noBackgroundHTML, 0, 0);
+ ASSERT_TRUE(waitUntilLoadFinished());
+
+ int red, green, blue, alpha;
+ ewk_view_bg_color_get(webView(), &red, &green, &blue, &alpha);
+ ASSERT_EQ(255, red);
+ ASSERT_EQ(0, green);
+ ASSERT_EQ(0, blue);
+ ASSERT_EQ(255, red);
+}
m_page->handleMouseEvent(NativeWebMouseEvent(event, transformFromScene(), m_userViewportTransform.toAffineTransform()));
}
+void WebViewEfl::setViewBackgroundColor(const WebCore::Color& color)
+{
+ CoordinatedGraphicsScene* scene = coordinatedGraphicsScene();
+ if (!scene)
+ return;
+
+ scene->setViewBackgroundColor(color);
+}
+
+WebCore::Color WebViewEfl::viewBackgroundColor()
+{
+ CoordinatedGraphicsScene* scene = coordinatedGraphicsScene();
+ if (!scene)
+ return Color();
+
+ return scene->viewBackgroundColor();
+}
+
#if ENABLE(FULLSCREEN_API)
// WebFullScreenManagerProxyClient
virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color&, const WebCore::IntRect&) override;
#endif
+ void setViewBackgroundColor(const WebCore::Color&);
+ WebCore::Color viewBackgroundColor();
private:
WebViewEfl(WebContext*, WebPageGroup*);
2014-03-31 Ryuan Choi <ryuan.choi@samsung.com>
+ [EFL][WK2] Extract the control of page background out of color_set
+ https://bugs.webkit.org/show_bug.cgi?id=127539
+
+ Reviewed by Gyuyoung Kim.
+
+ Added an option(C) to change background color.
+
+ * MiniBrowser/efl/main.c:
+ (window_create):
+ (elm_main):
+
+2014-03-31 Ryuan Choi <ryuan.choi@samsung.com>
+
Unreviewed build fix on the EFL port with latest EFL libraries since r166149
* ImageDiff/PlatformEfl.cmake: Added ECORE_IMF_INCLUDE_DIRS to include dirs
static Eina_List *windows = NULL;
static char *evas_engine_name = NULL;
static char *user_agent_string = NULL;
+static char *background_color_string = NULL;
static Eina_Bool encoding_detector_enabled = EINA_FALSE;
static Eina_Bool frame_flattening_enabled = EINA_FALSE;
static Eina_Bool local_storage_enabled = EINA_TRUE;
ecore_getopt_callback_ecore_evas_list_engines, NULL),
ECORE_GETOPT_STORE_DEF_BOOL
('c', "encoding-detector", "Enable/disable encoding detector.", EINA_FALSE),
+ ECORE_GETOPT_STORE_STR
+ ('C', "background-color", "Background color of page. ex) -C=255:255:255:255"),
ECORE_GETOPT_STORE_DEF_BOOL
('f', "flattening", "Enable/disable frame flattening.", EINA_FALSE),
ECORE_GETOPT_STORE_DEF_BOOL
ewk_view_mouse_events_enabled_set(window->ewk_view, EINA_FALSE);
}
+ if (background_color_string) {
+ int red, green, blue, alpha;
+
+ if (sscanf(background_color_string, "%d:%d:%d:%d", &red, &green, &blue, &alpha))
+ ewk_view_bg_color_set(window->ewk_view, red, green, blue, alpha);
+ }
+
/* Set the zoom level to default */
window->current_zoom_level = DEFAULT_ZOOM_LEVEL;
ECORE_GETOPT_VALUE_DOUBLE(device_pixel_ratio),
ECORE_GETOPT_VALUE_BOOL(quitOption),
ECORE_GETOPT_VALUE_BOOL(encoding_detector_enabled),
+ ECORE_GETOPT_VALUE_STR(background_color_string),
ECORE_GETOPT_VALUE_BOOL(frame_flattening_enabled),
ECORE_GETOPT_VALUE_BOOL(local_storage_enabled),
ECORE_GETOPT_VALUE_BOOL(fullscreen_enabled),