nsresult SVGTransformListParser::MatchSkewX() { GetNextToken(); float skew; PRUint32 count; ENSURE_MATCHED(MatchNumberArguments(&skew, 1, &count)); if (count != 1) { return NS_ERROR_FAILURE; } SVGTransform* transform = mTransforms.AppendElement(); NS_ENSURE_TRUE(transform, NS_ERROR_OUT_OF_MEMORY); transform->SetSkewX(skew); return NS_OK; }
void SVGTransformList::ParseTransform(StringIn s) { if (s.IsEmpty()) return; ASSERT(0); #if 0 const WCHAR* p = s->c_str(); if (p == NULL) THROW(std::exception("null pointer")); while (*p) { while (*p && std::isspace(*p)) p++; // Skip spaces // Get type const WCHAR* transformType = p; int transformTypeLength = 0; while (*p && std::isalpha(*p)) { transformTypeLength++; p++; } while (*p && std::isspace(*p)) p++; // Skip spaces // Get string inside ( ) if (*p++ != L'(') break; // Error const WCHAR* start = p; while (*p && *p != L')') { p++; } System::StringW* param_string = new System::StringW(string_copy(start, p - start)); if (*p++ != L')') break; // Error while (*p && std::isspace(*p)) p++; // Skip spaces SVGTransform* transform = NULL; #if WIN32 if (!_wcsnicmp(transformType, L"translate", transformTypeLength)) { double x, y; GetTranslateValues(param_string->c_str(), x, y); transform = new SVGTransformMutable; transform->SetTranslate(x, y); } else if (!_wcsnicmp(transformType, L"rotate", transformTypeLength)) { double deg, cx, cy; GetRotateValues(param_string->c_str(), deg, cx, cy); transform = new SVGTransformMutable; transform->SetRotate(deg, cx, cy); } else if (!_wcsnicmp(transformType, L"scale", transformTypeLength)) { double sx, sy; GetScaleValues(param_string->c_str(), sx, sy); transform = new SVGTransformMutable; transform->SetScale(sx, sy); } else if (!_wcsnicmp(transformType, L"skewX", transformTypeLength)) { double deg; GetSkewValues(param_string->c_str(), deg); transform = new SVGTransformMutable; transform->SetSkewX(deg); } else if (!_wcsnicmp(transformType, L"skewY", transformTypeLength)) { double deg; GetSkewValues(param_string->c_str(), deg); transform = new SVGTransformMutable; transform->SetSkewY(deg); } else if (!_wcsnicmp(transformType, L"matrix", transformTypeLength)) { transform = new SVGTransformMutable; transform->m_type = SVG_TRANSFORM_MATRIX; GetMatrixValues(param_string->c_str(), transform->m_matrix); } #else ASSERT(0); #endif if (transform != NULL) { transform->m_owner = this; // transform->m_pListener = this; m_p->m_items.Add(transform); } if (*p == ',') p++; while (*p && std::isspace(*p)) p++; // Skip spaces } #endif }