Make parseCompositeAndBlendOperator() take care of "normal".

Currently, parseCompositeAndBlendOperator() doesn't recognize "normal".
Fortunately, there are not bugs because all clients set blend mode to "normal"
if this function fails.

BUG=425656

Review URL: https://codereview.chromium.org/671713006

git-svn-id: svn://svn.chromium.org/blink/trunk@184239 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4367ff66
...@@ -49,6 +49,7 @@ static const char* const compositeOperatorNames[] = { ...@@ -49,6 +49,7 @@ static const char* const compositeOperatorNames[] = {
}; };
static const char* const blendOperatorNames[] = { static const char* const blendOperatorNames[] = {
"normal",
"multiply", "multiply",
"screen", "screen",
"overlay", "overlay",
...@@ -80,8 +81,7 @@ bool parseCompositeAndBlendOperator(const String& s, CompositeOperator& op, WebB ...@@ -80,8 +81,7 @@ bool parseCompositeAndBlendOperator(const String& s, CompositeOperator& op, WebB
for (int i = 0; i < numBlendOperatorNames; i++) { for (int i = 0; i < numBlendOperatorNames; i++) {
if (s == blendOperatorNames[i]) { if (s == blendOperatorNames[i]) {
blendOp = static_cast<WebBlendMode>(i+1); blendOp = static_cast<WebBlendMode>(i);
// For now, blending will always assume source-over. This will be fixed in the future
op = CompositeSourceOver; op = CompositeSourceOver;
return true; return true;
} }
...@@ -90,16 +90,13 @@ bool parseCompositeAndBlendOperator(const String& s, CompositeOperator& op, WebB ...@@ -90,16 +90,13 @@ bool parseCompositeAndBlendOperator(const String& s, CompositeOperator& op, WebB
return false; return false;
} }
// FIXME: when we support blend modes in combination with compositing other than source-over
// this routine needs to be updated.
String compositeOperatorName(CompositeOperator op, WebBlendMode blendOp) String compositeOperatorName(CompositeOperator op, WebBlendMode blendOp)
{ {
ASSERT(op >= 0); ASSERT(op >= 0);
ASSERT(op < numCompositeOperatorNames); ASSERT(op < numCompositeOperatorNames);
ASSERT(blendOp >= 0); ASSERT(blendOp >= 0);
ASSERT(blendOp <= numBlendOperatorNames);
if (blendOp != WebBlendModeNormal) if (blendOp != WebBlendModeNormal)
return blendOperatorNames[blendOp-1]; return blendOperatorNames[blendOp];
return compositeOperatorNames[op]; return compositeOperatorNames[op];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment