Title: [175435] trunk/Source/WebCore
Revision
175435
Author
[email protected]
Date
2014-10-31 16:25:05 -0700 (Fri, 31 Oct 2014)

Log Message

Fix several warnings reported by clang static analyzer in WebCore
https://bugs.webkit.org/show_bug.cgi?id=138258

Reviewed by Joseph Pecoraro.

Fix several warnings reported by clang static analyzer in WebCore
related to variable unnecessary assignments and scope.

No new tests, no behavior change.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getUpperLeftCorner):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* inspector/InspectorStyleTextEditor.cpp:
(WebCore::InspectorStyleTextEditor::replaceProperty):
* page/ContextMenuController.cpp:
(WebCore::openNewWindow):
* page/DragController.cpp:
(WebCore::createMouseEvent):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paintSelectionBackground):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175434 => 175435)


--- trunk/Source/WebCore/ChangeLog	2014-10-31 23:21:36 UTC (rev 175434)
+++ trunk/Source/WebCore/ChangeLog	2014-10-31 23:25:05 UTC (rev 175435)
@@ -1,3 +1,30 @@
+2014-10-31  Chris Dumez  <[email protected]>
+
+        Fix several warnings reported by clang static analyzer in WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=138258
+
+        Reviewed by Joseph Pecoraro.
+
+        Fix several warnings reported by clang static analyzer in WebCore
+        related to variable unnecessary assignments and scope.
+
+        No new tests, no behavior change.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::getUpperLeftCorner):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+        * inspector/InspectorStyleTextEditor.cpp:
+        (WebCore::InspectorStyleTextEditor::replaceProperty):
+        * page/ContextMenuController.cpp:
+        (WebCore::openNewWindow):
+        * page/DragController.cpp:
+        (WebCore::createMouseEvent):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::paintSelectionBackground):
+
 2014-10-31  Simon Fraser  <[email protected]>
 
         Whitespace cleanup in Screen.h

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (175434 => 175435)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2014-10-31 23:21:36 UTC (rev 175434)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2014-10-31 23:25:05 UTC (rev 175435)
@@ -809,8 +809,6 @@
         return false;
     // What is this code really trying to do?
     RenderObject* o = renderer();
-    RenderObject* p = o;
-
     if (!o->isInline() || o->isReplaced()) {
         point = o->localToAbsolute(FloatPoint(), UseTransforms);
         return true;
@@ -818,7 +816,7 @@
 
     // find the next text/image child, to get a position
     while (o) {
-        p = o;
+        RenderObject* p = o;
         if (RenderObject* child = o->firstChildSlow())
             o = child;
         else if (o->nextSibling())

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (175434 => 175435)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-10-31 23:21:36 UTC (rev 175434)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-10-31 23:25:05 UTC (rev 175435)
@@ -3785,7 +3785,7 @@
     if (!captionPreferences)
         return;
 
-    CaptionUserPreferences::CaptionDisplayMode displayMode = captionPreferences->captionDisplayMode();
+    CaptionUserPreferences::CaptionDisplayMode displayMode;
     if (trackToSelect == TextTrack::captionMenuOffItem())
         displayMode = CaptionUserPreferences::ForcedOnly;
     else if (trackToSelect == TextTrack::captionMenuAutomaticItem())

Modified: trunk/Source/WebCore/inspector/InspectorStyleTextEditor.cpp (175434 => 175435)


--- trunk/Source/WebCore/inspector/InspectorStyleTextEditor.cpp	2014-10-31 23:21:36 UTC (rev 175434)
+++ trunk/Source/WebCore/inspector/InspectorStyleTextEditor.cpp	2014-10-31 23:25:05 UTC (rev 175435)
@@ -124,17 +124,11 @@
     ASSERT_WITH_SECURITY_IMPLICATION(index < m_allProperties->size());
 
     const InspectorStyleProperty& property = m_allProperties->at(index);
-    long propertyStart = property.sourceData.range.start;
-    long propertyEnd = property.sourceData.range.end;
-    long oldLength = propertyEnd - propertyStart;
-    long newLength = newText.length();
-    long propertyLengthDelta = newLength - oldLength;
-
     if (!property.disabled) {
         SourceRange overwrittenRange;
         unsigned insertedLength;
         internalReplaceProperty(property, newText, &overwrittenRange, &insertedLength);
-        propertyLengthDelta = static_cast<long>(insertedLength) - static_cast<long>(overwrittenRange.length());
+        long propertyLengthDelta = static_cast<long>(insertedLength) - static_cast<long>(overwrittenRange.length());
 
         // Recompute subsequent disabled property ranges if acting on a non-disabled property.
         shiftDisabledProperties(disabledIndexByOrdinal(index, true), propertyLengthDelta);

Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (175434 => 175435)


--- trunk/Source/WebCore/page/ContextMenuController.cpp	2014-10-31 23:21:36 UTC (rev 175434)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp	2014-10-31 23:25:05 UTC (rev 175435)
@@ -199,9 +199,8 @@
         return;
     
     FrameLoadRequest request(frame->document()->securityOrigin(), ResourceRequest(urlToLoad, frame->loader().outgoingReferrer()));
-    Page* newPage = oldPage;
 
-    newPage = oldPage->chrome().createWindow(frame, request, WindowFeatures(), NavigationAction(request.resourceRequest()));
+    Page* newPage = oldPage->chrome().createWindow(frame, request, WindowFeatures(), NavigationAction(request.resourceRequest()));
     if (!newPage)
         return;
     newPage->chrome().show();

Modified: trunk/Source/WebCore/page/DragController.cpp (175434 => 175435)


--- trunk/Source/WebCore/page/DragController.cpp	2014-10-31 23:21:36 UTC (rev 175434)
+++ trunk/Source/WebCore/page/DragController.cpp	2014-10-31 23:25:05 UTC (rev 175435)
@@ -84,13 +84,11 @@
 
 static PlatformMouseEvent createMouseEvent(DragData& dragData)
 {
-    bool shiftKey, ctrlKey, altKey, metaKey;
-    shiftKey = ctrlKey = altKey = metaKey = false;
     int keyState = dragData.modifierKeyState();
-    shiftKey = static_cast<bool>(keyState & PlatformEvent::ShiftKey);
-    ctrlKey = static_cast<bool>(keyState & PlatformEvent::CtrlKey);
-    altKey = static_cast<bool>(keyState & PlatformEvent::AltKey);
-    metaKey = static_cast<bool>(keyState & PlatformEvent::MetaKey);
+    bool shiftKey = static_cast<bool>(keyState & PlatformEvent::ShiftKey);
+    bool ctrlKey = static_cast<bool>(keyState & PlatformEvent::CtrlKey);
+    bool altKey = static_cast<bool>(keyState & PlatformEvent::AltKey);
+    bool metaKey = static_cast<bool>(keyState & PlatformEvent::MetaKey);
 
     return PlatformMouseEvent(dragData.clientPosition(), dragData.globalPosition(),
                               LeftButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey,

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (175434 => 175435)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-10-31 23:21:36 UTC (rev 175434)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-10-31 23:25:05 UTC (rev 175435)
@@ -3944,8 +3944,7 @@
     // Not supporting the quirk has caused us to mis-render some real sites. (See Bugzilla 10517.) 
     bool allowImagesToBreak = !document().inQuirksMode() || !isTableCell() || !styleToUse.logicalWidth().isIntrinsicOrAuto();
 
-    bool autoWrap, oldAutoWrap;
-    autoWrap = oldAutoWrap = styleToUse.autoWrap();
+    bool oldAutoWrap = styleToUse.autoWrap();
 
     InlineMinMaxIterator childIterator(*this);
 
@@ -3959,7 +3958,7 @@
     bool isPrevChildInlineFlow = false;
     bool shouldBreakLineAfterText = false;
     while (RenderObject* child = childIterator.next()) {
-        autoWrap = child->isReplaced() ? child->parent()->style().autoWrap() : 
+        bool autoWrap = child->isReplaced() ? child->parent()->style().autoWrap() :
             child->style().autoWrap();
 
         if (!child->isBR()) {

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (175434 => 175435)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2014-10-31 23:21:36 UTC (rev 175434)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2014-10-31 23:25:05 UTC (rev 175435)
@@ -207,13 +207,6 @@
 
     RenderStyle& style = parentRenderer.style();
 
-    RenderStyle* selectionStyle = &style;
-    if (hasSelection) {
-        selectionStyle = parentRenderer.getCachedPseudoStyle(SELECTION);
-        if (!selectionStyle)
-            selectionStyle = &style;
-    }
-
     int startPosition, endPosition;
     selectionStartEnd(startPosition, endPosition);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to