Evas_Point startPoint;
Evas_Point endPoint;
} position;
+
+ struct {
+ int r;
+ int g;
+ int b;
+ int a;
+ } bgColor;
+
+ struct {
+ int r;
+ int g;
+ int b;
+ int a;
+ } color;
};
#if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
-Ewk_Text_Style* ewkTextStyleCreate(int underlineState, int italicState, int boldState, const WebCore::IntPoint& startPoint, const WebCore::IntPoint& endPoint)
-
+Ewk_Text_Style* ewkTextStyleCreate(int underlineState, int italicState, int boldState, const WebCore::IntPoint& startPoint, const WebCore::IntPoint& endPoint, const String& bgColor, const String& color)
{
Ewk_Text_Style* textStyle = new Ewk_Text_Style;
textStyle->position.endPoint.x = endPoint.x();
textStyle->position.endPoint.y = endPoint.y();
+ // for example - rgba(255, 255, 255, 255)
+ // for example - rgb(255, 255, 255)
+ if (equalIgnoringCase(bgColor.left(3), "rgb")) {
+ size_t startPos = bgColor.find("(");
+ size_t endPos = bgColor.find(")");
+
+ String value = bgColor.substring(startPos + 1, endPos - startPos - 1);
+ Vector<String> colorValues;
+ value.split(",", colorValues);
+ textStyle->bgColor.r = colorValues[0].toInt();
+ textStyle->bgColor.g = colorValues[1].toInt();
+ textStyle->bgColor.b = colorValues[2].toInt();
+ if (equalIgnoringCase(bgColor.left(4), "rgba"))
+ textStyle->bgColor.a = colorValues[3].toInt();
+ else
+ textStyle->bgColor.a = 255;
+ }
+
+ if (equalIgnoringCase(color.left(3), "rgb")) {
+ size_t startPos = color.find("(");
+ size_t endPos = color.find(")");
+
+ String value = color.substring(startPos + 1, endPos - startPos - 1);
+ Vector<String> colorValues;
+ value.split(",", colorValues);
+ textStyle->color.r = colorValues[0].toInt();
+ textStyle->color.g = colorValues[1].toInt();
+ textStyle->color.b = colorValues[2].toInt();
+ if (equalIgnoringCase(color.left(4), "rgba"))
+ textStyle->color.a = colorValues[3].toInt();
+ else
+ textStyle->color.a = 255;
+ }
+
return textStyle;
}
return false;
#endif
}
+
+Eina_Bool ewk_text_style_bg_color_get(Ewk_Text_Style* textStyle, int* r, int* g, int* b, int* a)
+{
+#if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
+ EINA_SAFETY_ON_NULL_RETURN_VAL(textStyle, false);
+
+ if (r)
+ *r = textStyle->bgColor.r;
+ if (g)
+ *g = textStyle->bgColor.g;
+ if (b)
+ *b = textStyle->bgColor.b;
+ if (a)
+ *a = textStyle->bgColor.a;
+
+ return true;
+#else
+ return false;
+#endif
+}
+
+Eina_Bool ewk_text_style_color_get(Ewk_Text_Style* textStyle, int* r, int* g, int* b, int* a)
+{
+#if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
+ EINA_SAFETY_ON_NULL_RETURN_VAL(textStyle, false);
+
+ if (r)
+ *r = textStyle->color.r;
+ if (g)
+ *g = textStyle->color.g;
+ if (b)
+ *b = textStyle->color.b;
+ if (a)
+ *a = textStyle->color.a;
+
+ return true;
+#else
+ return false;
+#endif
+}