[Webkit-unassigned] [Bug 174470] New: Incorrect call to StyledElement::setInlineStyleProperty in ImageDocument::createDocumentStructure

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 13 11:33:34 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=174470

            Bug ID: 174470
           Summary: Incorrect call to
                    StyledElement::setInlineStyleProperty in
                    ImageDocument::createDocumentStructure
           Product: WebKit
           Version: Other
          Hardware: PC
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at igalia.com
                CC: cdumez at apple.com
            Blocks: 174463

Here is another good GCC 7 warning:

[3172/5861] Building CXX object Source...s/WebCore.dir/html/ImageDocument.cpp.o
../../Source/WebCore/html/ImageDocument.cpp: In member function ‘void WebCore::ImageDocument::createDocumentStructure()’:
../../Source/WebCore/html/ImageDocument.cpp:226:103: warning: enum constant in boolean context [-Wint-in-bool-context]
         body->setInlineStyleProperty(CSSPropertyBackgroundColor, "white", CSSPrimitiveValue::CSS_IDENT);

This call to StyledElement::setInlineStyleProperty inside ImageDocument::createDocumentStructure is incorrect:

    if (MIMETypeRegistry::isPDFMIMEType(document().loader()->responseMIMEType()))
        body->setInlineStyleProperty(CSSPropertyBackgroundColor, "white", CSSPrimitiveValue::CSS_IDENT);

Here are the overloads:

    bool setInlineStyleProperty(CSSPropertyID, CSSValueID identifier, bool important = false);
    bool setInlineStyleProperty(CSSPropertyID, CSSPropertyID identifier, bool important = false);
    WEBCORE_EXPORT bool setInlineStyleProperty(CSSPropertyID, double value, CSSPrimitiveValue::UnitType, bool important = false);
    WEBCORE_EXPORT bool setInlineStyleProperty(CSSPropertyID, const String& value, bool important = false);

Currently it is calling the final overload (CSSPropertyID, const String& value, bool important = false). Surely it is not intended for CSSPrimitiveValue::CSS_IDENT to be implicitly converted to bool (important = true), as is currently occurring. I think the proper fix is probably to just remove that argument. However, I am not sure, because I'm not sure how the important flag is supposed to be used. This is a behavior change, so it would be good for someone familiar with how the code is intended to work to review it.


Referenced Bugs:

https://bugs.webkit.org/show_bug.cgi?id=174463
[Bug 174463] [GTK] Fix compiler warnings when building with GCC 7
-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170713/6f81bb76/attachment-0001.html>


More information about the webkit-unassigned mailing list