Source/WebCore/ChangeLog

 12012-03-31 Rob Buis <rbuis@rim.com>
 2
 3 SVGColor dom interface is not created for color property in SVG elements
 4 https://bugs.webkit.org/show_bug.cgi?id=15012
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Create SVGColor instances for the color property when in parsing mode SVGAttributeMode.
 9
 10 Test: svg/custom/SVGColor-presentation-attribute.svg
 11
 12 * css/CSSParser.cpp: special case SVGAttribute parsing mode
 13 (WebCore::parseColorValue):
 14 * css/CSSStyleApplyProperty.cpp: special case SVGColor handling
 15 (WebCore::ApplyPropertyColor::applyValue):
 16 * css/SVGCSSParser.cpp:
 17 (WebCore::CSSParser::parseSVGValue): remove unreachable code
 18
1192012-03-31 Jonathan Dong <jonathan.dong@torchmobile.com.cn>
220
321 [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail

Source/WebCore/css/CSSParser.cpp

7878#include "ShadowValue.h"
7979#include "StylePropertySet.h"
8080#include "StyleRule.h"
 81#if ENABLE(SVG)
 82#include "SVGColor.h"
 83#endif
8184#if ENABLE(CSS_FILTERS)
8285#include "WebKitCSSFilterValue.h"
8386#endif

@@static bool parseColorValue(StylePropertySet* declaration, int propertyId, const
332335 CSSParserString cssString;
333336 cssString.characters = const_cast<UChar*>(string.characters());
334337 cssString.length = string.length();
 338#if ENABLE(SVG)
 339 if (cssParserMode == SVGAttributeMode && propertyId == CSSPropertyColor) {
 340 RGBA32 color;
 341 if (!CSSParser::fastParseColor(color, string, strict && string[0] != '#'))
 342 return false;
 343 RefPtr<CSSValue> value = SVGColor::createFromColor(color);
 344 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), important));
 345 return true;
 346 }
 347#endif
335348 int valueID = cssValueKeywordID(cssString);
336349 bool validPrimitive = false;
337350 if (valueID == CSSValueWebkitText)

Source/WebCore/css/CSSStyleApplyProperty.cpp

4141#include "RenderStyle.h"
4242#include "RenderView.h"
4343#include "Settings.h"
 44#if ENABLE(SVG)
 45#include "SVGColor.h"
 46#endif
4447#include <wtf/StdLibExtras.h>
4548#include <wtf/UnusedParam.h>
4649

@@public:
288291
289292 static void applyValue(CSSStyleSelector* selector, CSSValue* value)
290293 {
 294#if ENABLE(SVG)
 295 if (value->isSVGColor()) {
 296 applyColorValue(selector, static_cast<SVGColor*>(value)->color());
 297 return;
 298 }
 299#endif
291300 if (!value->isPrimitiveValue())
292301 return;
293302

Source/WebCore/css/SVGCSSParser.cpp

@@bool CSSParser::parseSVGValue(int propId, bool important)
201201 }
202202 break;
203203
204  case CSSPropertyColor: // <color> | inherit
205  if ((id >= CSSValueAqua && id <= CSSValueWindowtext) ||
206  (id >= CSSValueAliceblue && id <= CSSValueYellowgreen))
207  parsedValue = SVGColor::createFromString(value->string);
208  else
209  parsedValue = parseSVGColor();
210 
211  if (parsedValue)
212  m_valueList->next();
213  break;
214 
215204 case CSSPropertyStopColor: // TODO : icccolor
216205 case CSSPropertyFloodColor:
217206 case CSSPropertyLightingColor:

LayoutTests/ChangeLog

112012-03-31 Rob Buis <rbuis@rim.com>
22
 3 SVGColor dom interface is not created for color property in SVG elements
 4 https://bugs.webkit.org/show_bug.cgi?id=15012
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Test that SVGColor is created for the presentation attribute and that it is applied.
 9
 10 * svg/custom/SVGColor-presentation-attribute-expected.txt: Added.
 11 * svg/custom/SVGColor-presentation-attribute.svg: Added.
 12
 132012-03-31 Rob Buis <rbuis@rim.com>
 14
315 XMLSerializer().serializeToString() doesn't generate the XML declaration markup like Opera and Firefox
416 https://bugs.webkit.org/show_bug.cgi?id=25206
517

LayoutTests/svg/custom/SVGColor-presentation-attribute-expected.txt

 1PASS

LayoutTests/svg/custom/SVGColor-presentation-attribute.svg

 1<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runTest()">
 2<rect id="foo" color="green" fill="currentColor" width="100" height="100"/>
 3<foreignObject>
 4<html xmlns="http://www.w3.org/1999/xhtml">
 5 <body>
 6 <div id="log">
 7 </div>
 8 </body>
 9</html>
 10</foreignObject>
 11<script> <![CDATA[
 12 if (window.layoutTestController)
 13 layoutTestController.dumpAsText();
 14
 15 function log(string) {
 16 var newDiv = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
 17 newDiv.textContent = string;
 18 document.getElementById('log').appendChild(newDiv);
 19 }
 20
 21 function runTest()
 22 {
 23 var element = document.getElementById('foo');
 24 if (element.getPresentationAttribute('color') instanceof SVGColor &&
 25 document.defaultView.getComputedStyle(element).getPropertyValue('color') == 'rgb(0, 128, 0)')
 26 log('PASS');
 27 else
 28 log('FAIL');
 29 }
 30]]></script>
 31</svg>