Diff
Modified: trunk/Source/WebCore/ChangeLog (250200 => 250201)
--- trunk/Source/WebCore/ChangeLog 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/ChangeLog 2019-09-23 03:46:57 UTC (rev 250201)
@@ -1,3 +1,33 @@
+2019-09-22 David Kilzer <[email protected]>
+
+ clang-tidy: Fix unnecessary copy/ref churn of for loop variables in WebCore
+ <https://webkit.org/b/202090>
+
+ Reviewed by Daniel Bates.
+
+ Fix unwanted copying/ref churn of loop variables by making them
+ const references.
+
+ * Modules/encryptedmedia/InitDataRegistry.cpp:
+ (WebCore::InitDataRegistry::extractKeyIDsCenc):
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::getMisspellingRange const):
+ (WebCore::AccessibilityObject::performTextOperation):
+ * html/HTMLSlotElement.cpp:
+ (WebCore::flattenAssignedNodes):
+ * html/track/WebVTTParser.cpp:
+ (WebCore::WebVTTParser::checkAndStoreStyleSheet):
+ * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
+ (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
+ * platform/ios/PlatformPasteboardIOS.mm:
+ (WebCore::PlatformPasteboard::updateSupportedTypeIdentifiers):
+ * platform/ios/WebItemProviderPasteboard.mm:
+ (-[WebItemProviderPasteboard allDroppedFileURLs]):
+ * svg/SVGStringList.h:
+ * testing/MockLibWebRTCPeerConnection.cpp:
+ (WebCore::MockLibWebRTCPeerConnection::GetTransceivers const):
+ Also call transceivers.reserve() to optimize allocations.
+
2019-09-21 Chris Dumez <[email protected]>
Reduce use of SessionID::defaultSessionID() in WebKit
Modified: trunk/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp (250200 => 250201)
--- trunk/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp 2019-09-23 03:46:57 UTC (rev 250201)
@@ -171,7 +171,7 @@
FourCC scheme = fpsPssh.initDataBox().info().scheme();
if (CDMPrivateFairPlayStreaming::validFairPlayStreamingSchemes().contains(scheme)) {
- for (auto request : fpsPssh.initDataBox().requests()) {
+ for (const auto& request : fpsPssh.initDataBox().requests()) {
auto& keyID = request.requestInfo().keyID();
keyIDs.append(SharedBuffer::create(keyID.data(), keyID.size()));
}
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (250200 => 250201)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2019-09-23 03:46:57 UTC (rev 250201)
@@ -490,7 +490,7 @@
// So iterate forward or backwards depending on the desired search
// direction to find the closest misspelling in that direction.
if (direction == AccessibilitySearchDirection::Next) {
- for (auto misspelling : misspellings) {
+ for (const auto& misspelling : misspellings) {
auto misspellingRange = editor.rangeForTextCheckingResult(misspelling);
if (!misspellingRange)
continue;
@@ -982,7 +982,7 @@
if (!frame)
return result;
- for (auto textRange : operation.textRanges) {
+ for (const auto& textRange : operation.textRanges) {
if (!frame->selection().setSelectedRange(textRange.get(), DOWNSTREAM, FrameSelection::ShouldCloseTyping::Yes))
continue;
Modified: trunk/Source/WebCore/html/HTMLSlotElement.cpp (250200 => 250201)
--- trunk/Source/WebCore/html/HTMLSlotElement.cpp 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/html/HTMLSlotElement.cpp 2019-09-23 03:46:57 UTC (rev 250201)
@@ -116,7 +116,7 @@
}
return;
}
- for (RefPtr<Node> node : *assignedNodes) {
+ for (const RefPtr<Node>& node : *assignedNodes) {
if (is<HTMLSlotElement>(*node))
flattenAssignedNodes(nodes, downcast<HTMLSlotElement>(*node));
else
Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (250200 => 250201)
--- trunk/Source/WebCore/html/track/WebVTTParser.cpp 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp 2019-09-23 03:46:57 UTC (rev 250201)
@@ -389,7 +389,7 @@
if (!childRules.size())
return true;
- for (auto rule : childRules) {
+ for (const auto& rule : childRules) {
if (!rule->isStyleRule())
return true;
const auto& styleRule = downcast<StyleRule>(rule.get());
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp (250200 => 250201)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-09-23 03:46:57 UTC (rev 250201)
@@ -363,7 +363,7 @@
auto floatingContext = FloatingContext { formattingRoot(), formattingContext, formattingState.floatingState() };
// Move floats to their final position.
- for (auto floatItem : floats) {
+ for (const auto& floatItem : floats) {
auto& floatBox = floatItem->layoutBox();
auto& displayBox = formattingState.displayBox(floatBox);
// Set static position first.
Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (250200 => 250201)
--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2019-09-23 03:46:57 UTC (rev 250201)
@@ -726,7 +726,7 @@
return;
NSMutableArray *typesArray = [NSMutableArray arrayWithCapacity:types.size()];
- for (auto type : types)
+ for (const auto& type : types)
[typesArray addObject:(NSString *)type];
[m_pasteboard updateSupportedTypeIdentifiers:typesArray];
Modified: trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm (250200 => 250201)
--- trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm 2019-09-23 03:46:57 UTC (rev 250201)
@@ -661,7 +661,7 @@
- (NSArray<NSURL *> *)allDroppedFileURLs
{
NSMutableArray<NSURL *> *fileURLs = [NSMutableArray array];
- for (auto loadResult : _loadResults) {
+ for (const auto& loadResult : _loadResults) {
if ([loadResult canBeRepresentedAsFileUpload])
[fileURLs addObjectsFromArray:[loadResult loadedFileURLs]];
}
Modified: trunk/Source/WebCore/svg/SVGStringList.h (250200 => 250201)
--- trunk/Source/WebCore/svg/SVGStringList.h 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/svg/SVGStringList.h 2019-09-23 03:46:57 UTC (rev 250201)
@@ -75,7 +75,7 @@
{
StringBuilder builder;
- for (auto string : m_items) {
+ for (const auto& string : m_items) {
if (builder.length())
builder.append(' ');
Modified: trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp (250200 => 250201)
--- trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp 2019-09-22 09:57:48 UTC (rev 250200)
+++ trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp 2019-09-23 03:46:57 UTC (rev 250201)
@@ -78,7 +78,8 @@
std::vector<rtc::scoped_refptr<webrtc::RtpTransceiverInterface>> MockLibWebRTCPeerConnection::GetTransceivers() const
{
std::vector<rtc::scoped_refptr<webrtc::RtpTransceiverInterface>> transceivers;
- for (auto transceiver : m_transceivers)
+ transceivers.reserve(m_transceivers.size());
+ for (const auto& transceiver : m_transceivers)
transceivers.push_back(transceiver);
return transceivers;
}