The QWebElement documentation says that about QWebElement::InlineStyle: "Return the property value as it is defined in the element, without respecting style inheritance and other CSS rules". In our QWebElement test, we do the following: """ ... p.setStyleProperty("color", "green !important"); QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("green")); QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("green")); p.setStyleProperty("color", "blue"); QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue")); ... """ But the test fails: """ FAIL! : tst_QWebElement::style() Compared values are not the same Actual (p.styleProperty("color", QWebElement::InlineStyle)): green Expected (QLatin1String("blue")): blue Loc: [/opt/projects/webkit/webkit/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp(486)] """ When this was first implemented, the test expectation was wrong and thus the test was passing. Then there was a change in the CSS code that introduced a regression that curiously made our implementation actually work (and the test fail). The test was fixed and right after so was the regression, so now we have a broken test (as it should be). See Bug 58032 for the whole story.
From WebCore::CSSMutableStyleDeclaration::setProperty(): """ // When replacing an existing property value, this moves the property to the end of the list. """ (it also says "Firefox preserves the position, and MSIE moves the property to the beginning", but that's not relevant for this bug) In the testing code, we set the property twice for the same element: p.setStyleProperty("color", "green !important"); ... p.setStyleProperty("color", "blue"); ... So when we call styleProperty(QWebElement::InlineStyle) after the second setStyleProperty(), there are two inline styles and we get the one with high priority. In summary, the implementation is right and the test is wrong, so it's just a matter or reverting the previous "fix".
Reopening, please ignore my previous round of comments. :-P I'll make sure my patch includes better documentation to avoid more confusion.
Created attachment 94212 [details] mark failing test case as expected fail
Comment on attachment 94212 [details] mark failing test case as expected fail LGTM. Fixing this will take some more time (time that I don't have at the moment) :(
Comment on attachment 94212 [details] mark failing test case as expected fail Clearing flags on attachment: 94212 Committed r86953: <http://trac.webkit.org/changeset/86953>
All reviewed patches have been landed. Closing bug.
Reopen to fix it.
Revision r86953 cherry-picked into qtwebkit-2.2 with commit b6ea329 <http://gitorious.org/webkit/qtwebkit/commit/b6ea329>
Ademar was right in comment #1, a non-important inline style shouldn't be overwritten by a non-important one. So InlineStyle doesn't apply inheritance, but does consider the importance.
Created attachment 173313 [details] Patch Unmark the failure and fix the expected value.
Committed r134233: <http://trac.webkit.org/changeset/134233>