Diff
Modified: trunk/Source/WebCore/ChangeLog (235189 => 235190)
--- trunk/Source/WebCore/ChangeLog 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Source/WebCore/ChangeLog 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,3 +1,19 @@
+2018-08-22 David Kilzer <[email protected]>
+
+ Move files in WebCore project to match Xcode folder structure
+ <https://webkit.org/b/188851>
+
+ Reviewed by Tim Horton.
+
+ * Scripts/LocalizableStrings.pm: Renamed from Source/WebCore/LocalizableStrings.pm.
+ * Scripts/extract-localizable-strings.pl: Renamed from Source/WebCore/extract-localizable-strings.pl.
+ * WebCore.xcodeproj/project.pbxproj: Update to match new location of files.
+ * platform/audio/cocoa/WebAudioBufferList.cpp: Renamed from Source/WebCore/platform/audio/WebAudioBufferList.cpp.
+ * platform/audio/cocoa/WebAudioBufferList.h: Renamed from Source/WebCore/platform/audio/WebAudioBufferList.h.
+ * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/MediaSampleAVFObjC.h.
+ * platform/ios/wak/WAKViewInternal.h: Renamed from Source/WebCore/platform/WAKViewInternal.h.
+ Also fix 3 webkit-style warnings.
+
2018-08-22 Zalan Bujtas <[email protected]>
[LFC][Floating] Move files to a dedicated directory.
Deleted: trunk/Source/WebCore/LocalizableStrings.pm (235189 => 235190)
--- trunk/Source/WebCore/LocalizableStrings.pm 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Source/WebCore/LocalizableStrings.pm 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,223 +0,0 @@
-# Copyright (C) 2006, 2007, 2009, 2010, 2013, 2015 Apple Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-# THE POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-
-my $treatWarningsAsErrors = 0;
-
-sub setTreatWarningsAsErrors($)
-{
- ($treatWarningsAsErrors) = @_;
-}
-
-my $sawError = 0;
-
-sub sawError()
-{
- return $sawError;
-}
-
-sub emitError($$$)
-{
- my ($file, $line, $message) = @_;
- print "$file:$line: $message\n";
- $sawError = 1;
-}
-
-sub emitWarning($$$)
-{
- my ($file, $line, $message) = @_;
- my $prefix = $treatWarningsAsErrors ? "" : "warning: ";
- print "$file:$line: $prefix$message\n";
- $sawError = 1 if $treatWarningsAsErrors;
-}
-
-# Unescapes C language hexadecimal escape sequences.
-sub unescapeHexSequence($)
-{
- my ($originalStr) = @_;
-
- my $escapedStr = $originalStr;
- my $unescapedStr = "";
-
- for (;;) {
- if ($escapedStr =~ s-^\\x([[:xdigit:]]+)--) {
- if (256 <= hex($1)) {
- print "Hexadecimal escape sequence out of range: \\x$1\n";
- return undef;
- }
- $unescapedStr .= pack("H*", $1);
- } elsif ($escapedStr =~ s-^(.)--) {
- $unescapedStr .= $1;
- } else {
- return $unescapedStr;
- }
- }
-}
-
-my $keyCollisionCount = 0;
-
-sub keyCollisionCount()
-{
- return $keyCollisionCount;
-}
-
-my $localizedCount = 0;
-
-sub localizedCount()
-{
- return $localizedCount;
-}
-
-my %stringByKey;
-my %commentByKey;
-my %fileByKey;
-my %lineByKey;
-
-sub HandleUIString
-{
- my ($string, $key, $comment, $file, $line) = @_;
-
- $localizedCount++;
-
- my $bad = 0;
- $string = unescapeHexSequence($string);
- if (!defined($string)) {
- print "$file:$line: string has an illegal hexadecimal escape sequence\n";
- $bad = 1;
- }
- $key = unescapeHexSequence($key);
- if (!defined($key)) {
- print "$file:$line: key has an illegal hexadecimal escape sequence\n";
- $bad = 1;
- }
- $comment = unescapeHexSequence($comment);
- if (!defined($comment)) {
- print "$file:$line: comment has an illegal hexadecimal escape sequence\n";
- $bad = 1;
- }
- if (grep { $_ == 0xFFFD } unpack "U*", $string) {
- print "$file:$line: string for translation has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";
- $bad = 1;
- }
- if ($string ne $key && grep { $_ == 0xFFFD } unpack "U*", $key) {
- print "$file:$line: key has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";
- $bad = 1;
- }
- if (grep { $_ == 0xFFFD } unpack "U*", $comment) {
- print "$file:$line: comment for translation has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";
- $bad = 1;
- }
- if ($bad) {
- $sawError = 1;
- return;
- }
-
- if ($stringByKey{$key} && $stringByKey{$key} ne $string) {
- emitWarning($file, $line, "encountered the same key, \"$key\", twice, with different strings");
- emitWarning($fileByKey{$key}, $lineByKey{$key}, "previous occurrence");
- $keyCollisionCount++;
- return;
- }
- if ($commentByKey{$key} && $commentByKey{$key} ne $comment) {
- emitWarning($file, $line, "encountered the same key, \"$key\", twice, with different comments");
- emitWarning($fileByKey{$key}, $lineByKey{$key}, "previous occurrence");
- $keyCollisionCount++;
- return;
- }
-
- $fileByKey{$key} = $file;
- $lineByKey{$key} = $line;
- $stringByKey{$key} = $string;
- $commentByKey{$key} = $comment;
-}
-
-sub writeStringsFile($)
-{
- my ($file) = @_;
-
- my $localizedStrings = "";
-
- for my $key (sort keys %commentByKey) {
- $localizedStrings .= "/* $commentByKey{$key} */\n\"$key\" = \"$stringByKey{$key}\";\n\n";
- }
-
- # Write out the strings file as UTF-8
- open STRINGS, ">", $file or die;
- print STRINGS $localizedStrings;
- close STRINGS;
-}
-
-sub verifyStringsFile($)
-{
- my ($file) = @_;
-
- open STRINGS, $file or die;
-
- my $lastComment;
- my $line;
- my $sawError;
-
- while (<STRINGS>) {
- chomp;
-
- next if (/^\s*$/);
-
- if (/^\/\* (.*) \*\/$/) {
- $lastComment = $1;
- } elsif (/^"((?:[^\\]|\\[^"])*)"\s*=\s*"((?:[^\\]|\\[^"])*)";$/) #
- {
- my $string = delete $stringByKey{$1};
- if (!defined $string) {
- print "$file:$.: unused key \"$1\"\n";
- $sawError = 1;
- } else {
- if (!($string eq $2)) {
- print "$file:$.: unexpected value \"$2\" for key \"$1\"\n";
- print "$fileByKey{$1}:$lineByKey{$1}: expected value \"$string\" defined here\n";
- $sawError = 1;
- }
- if (!($lastComment eq $commentByKey{$1})) {
- print "$file:$.: unexpected comment /* $lastComment */ for key \"$1\"\n";
- print "$fileByKey{$1}:$lineByKey{$1}: expected comment /* $commentByKey{$1} */ defined here\n";
- $sawError = 1;
- }
- }
- } else {
- print "$file:$.: line with unexpected format: $_\n";
- $sawError = 1;
- }
- }
-
- for my $missing (keys %stringByKey) {
- print "$fileByKey{$missing}:$lineByKey{$missing}: missing key \"$missing\"\n";
- $sawError = 1;
- }
-
- if ($sawError) {
- print "\n$file:0: file is not up to date.\n";
- exit 1;
- }
-}
-
-1;
Copied: trunk/Source/WebCore/Scripts/LocalizableStrings.pm (from rev 235189, trunk/Source/WebCore/LocalizableStrings.pm) (0 => 235190)
--- trunk/Source/WebCore/Scripts/LocalizableStrings.pm (rev 0)
+++ trunk/Source/WebCore/Scripts/LocalizableStrings.pm 2018-08-22 19:33:46 UTC (rev 235190)
@@ -0,0 +1,223 @@
+# Copyright (C) 2006, 2007, 2009, 2010, 2013, 2015 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+use strict;
+
+my $treatWarningsAsErrors = 0;
+
+sub setTreatWarningsAsErrors($)
+{
+ ($treatWarningsAsErrors) = @_;
+}
+
+my $sawError = 0;
+
+sub sawError()
+{
+ return $sawError;
+}
+
+sub emitError($$$)
+{
+ my ($file, $line, $message) = @_;
+ print "$file:$line: $message\n";
+ $sawError = 1;
+}
+
+sub emitWarning($$$)
+{
+ my ($file, $line, $message) = @_;
+ my $prefix = $treatWarningsAsErrors ? "" : "warning: ";
+ print "$file:$line: $prefix$message\n";
+ $sawError = 1 if $treatWarningsAsErrors;
+}
+
+# Unescapes C language hexadecimal escape sequences.
+sub unescapeHexSequence($)
+{
+ my ($originalStr) = @_;
+
+ my $escapedStr = $originalStr;
+ my $unescapedStr = "";
+
+ for (;;) {
+ if ($escapedStr =~ s-^\\x([[:xdigit:]]+)--) {
+ if (256 <= hex($1)) {
+ print "Hexadecimal escape sequence out of range: \\x$1\n";
+ return undef;
+ }
+ $unescapedStr .= pack("H*", $1);
+ } elsif ($escapedStr =~ s-^(.)--) {
+ $unescapedStr .= $1;
+ } else {
+ return $unescapedStr;
+ }
+ }
+}
+
+my $keyCollisionCount = 0;
+
+sub keyCollisionCount()
+{
+ return $keyCollisionCount;
+}
+
+my $localizedCount = 0;
+
+sub localizedCount()
+{
+ return $localizedCount;
+}
+
+my %stringByKey;
+my %commentByKey;
+my %fileByKey;
+my %lineByKey;
+
+sub HandleUIString
+{
+ my ($string, $key, $comment, $file, $line) = @_;
+
+ $localizedCount++;
+
+ my $bad = 0;
+ $string = unescapeHexSequence($string);
+ if (!defined($string)) {
+ print "$file:$line: string has an illegal hexadecimal escape sequence\n";
+ $bad = 1;
+ }
+ $key = unescapeHexSequence($key);
+ if (!defined($key)) {
+ print "$file:$line: key has an illegal hexadecimal escape sequence\n";
+ $bad = 1;
+ }
+ $comment = unescapeHexSequence($comment);
+ if (!defined($comment)) {
+ print "$file:$line: comment has an illegal hexadecimal escape sequence\n";
+ $bad = 1;
+ }
+ if (grep { $_ == 0xFFFD } unpack "U*", $string) {
+ print "$file:$line: string for translation has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";
+ $bad = 1;
+ }
+ if ($string ne $key && grep { $_ == 0xFFFD } unpack "U*", $key) {
+ print "$file:$line: key has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";
+ $bad = 1;
+ }
+ if (grep { $_ == 0xFFFD } unpack "U*", $comment) {
+ print "$file:$line: comment for translation has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";
+ $bad = 1;
+ }
+ if ($bad) {
+ $sawError = 1;
+ return;
+ }
+
+ if ($stringByKey{$key} && $stringByKey{$key} ne $string) {
+ emitWarning($file, $line, "encountered the same key, \"$key\", twice, with different strings");
+ emitWarning($fileByKey{$key}, $lineByKey{$key}, "previous occurrence");
+ $keyCollisionCount++;
+ return;
+ }
+ if ($commentByKey{$key} && $commentByKey{$key} ne $comment) {
+ emitWarning($file, $line, "encountered the same key, \"$key\", twice, with different comments");
+ emitWarning($fileByKey{$key}, $lineByKey{$key}, "previous occurrence");
+ $keyCollisionCount++;
+ return;
+ }
+
+ $fileByKey{$key} = $file;
+ $lineByKey{$key} = $line;
+ $stringByKey{$key} = $string;
+ $commentByKey{$key} = $comment;
+}
+
+sub writeStringsFile($)
+{
+ my ($file) = @_;
+
+ my $localizedStrings = "";
+
+ for my $key (sort keys %commentByKey) {
+ $localizedStrings .= "/* $commentByKey{$key} */\n\"$key\" = \"$stringByKey{$key}\";\n\n";
+ }
+
+ # Write out the strings file as UTF-8
+ open STRINGS, ">", $file or die;
+ print STRINGS $localizedStrings;
+ close STRINGS;
+}
+
+sub verifyStringsFile($)
+{
+ my ($file) = @_;
+
+ open STRINGS, $file or die;
+
+ my $lastComment;
+ my $line;
+ my $sawError;
+
+ while (<STRINGS>) {
+ chomp;
+
+ next if (/^\s*$/);
+
+ if (/^\/\* (.*) \*\/$/) {
+ $lastComment = $1;
+ } elsif (/^"((?:[^\\]|\\[^"])*)"\s*=\s*"((?:[^\\]|\\[^"])*)";$/) #
+ {
+ my $string = delete $stringByKey{$1};
+ if (!defined $string) {
+ print "$file:$.: unused key \"$1\"\n";
+ $sawError = 1;
+ } else {
+ if (!($string eq $2)) {
+ print "$file:$.: unexpected value \"$2\" for key \"$1\"\n";
+ print "$fileByKey{$1}:$lineByKey{$1}: expected value \"$string\" defined here\n";
+ $sawError = 1;
+ }
+ if (!($lastComment eq $commentByKey{$1})) {
+ print "$file:$.: unexpected comment /* $lastComment */ for key \"$1\"\n";
+ print "$fileByKey{$1}:$lineByKey{$1}: expected comment /* $commentByKey{$1} */ defined here\n";
+ $sawError = 1;
+ }
+ }
+ } else {
+ print "$file:$.: line with unexpected format: $_\n";
+ $sawError = 1;
+ }
+ }
+
+ for my $missing (keys %stringByKey) {
+ print "$fileByKey{$missing}:$lineByKey{$missing}: missing key \"$missing\"\n";
+ $sawError = 1;
+ }
+
+ if ($sawError) {
+ print "\n$file:0: file is not up to date.\n";
+ exit 1;
+ }
+}
+
+1;
Copied: trunk/Source/WebCore/Scripts/extract-localizable-strings.pl (from rev 235189, trunk/Source/WebCore/extract-localizable-strings.pl) (0 => 235190)
--- trunk/Source/WebCore/Scripts/extract-localizable-strings.pl (rev 0)
+++ trunk/Source/WebCore/Scripts/extract-localizable-strings.pl 2018-08-22 19:33:46 UTC (rev 235190)
@@ -0,0 +1,324 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006, 2007, 2009, 2010, 2013 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# This script is like the genstrings tool (minus most of the options) with these differences.
+#
+# 1) It uses the names UI_STRING and UI_STRING_WITH_KEY for the macros, rather than the macros
+# from NSBundle.h, and doesn't support tables (although they would be easy to add).
+# 2) It supports UTF-8 in key strings (and hence uses "" strings rather than @"" strings;
+# @"" strings only reliably support ASCII since they are decoded based on the system encoding
+# at runtime, so give different results on US and Japanese systems for example).
+# 3) It looks for strings that are not marked for localization, using both macro names that are
+# known to be used for debugging in Intrigue source code and an exceptions file.
+# 4) It finds the files to work on rather than taking them as parameters, and also uses a
+# hardcoded location for both the output file and the exceptions file.
+# It would have been nice to use the project to find the source files, but it's too hard to
+# locate source files after parsing a .pbxproj file.
+
+# The exceptions file has a list of strings in quotes, filenames, and filename/string pairs separated by :.
+
+use strict;
+use warnings;
+use File::Compare;
+use File::Copy;
+use FindBin;
+use Getopt::Long;
+use lib $FindBin::Bin;
+use LocalizableStrings;
+no warnings 'deprecated';
+
+my %isDebugMacro = ( ASSERT_WITH_MESSAGE => 1, LOG_ERROR => 1, ERROR => 1, NSURL_ERROR => 1, FATAL => 1, LOG => 1, LOG_WARNING => 1, UI_STRING_LOCALIZE_LATER => 1, UI_STRING_LOCALIZE_LATER_KEY => 1, LPCTSTR_UI_STRING_LOCALIZE_LATER => 1, UNLOCALIZED_STRING => 1, UNLOCALIZED_LPCTSTR => 1, dprintf => 1, NSException => 1, NSLog => 1, printf => 1 );
+
+my $verify;
+my $exceptionsFile;
+my @directoriesToSkip = ();
+my $treatWarningsAsErrors;
+
+my %options = (
+ 'verify' => \$verify,
+ 'exceptions=s' => \$exceptionsFile,
+ 'skip=s' => \@directoriesToSkip,
+ 'treat-warnings-as-errors' => \$treatWarningsAsErrors,
+);
+
+GetOptions(%options);
+
+setTreatWarningsAsErrors($treatWarningsAsErrors);
+
+@ARGV >= 2 or die "Usage: extract-localizable-strings [--verify] [--treat-warnings-as-errors] [--exceptions <exceptions file>] <file to update> [--skip directory | directory]...\nDid you mean to run update-webkit-localizable-strings instead?\n";
+
+-f $exceptionsFile or die "Couldn't find exceptions file $exceptionsFile\n" unless !defined $exceptionsFile;
+
+my $fileToUpdate = shift @ARGV;
+-f $fileToUpdate or die "Couldn't find file to update $fileToUpdate\n";
+
+my $warnAboutUnlocalizedStrings = defined $exceptionsFile;
+
+my @directories = ();
+if (@ARGV < 1) {
+ push(@directories, ".");
+} else {
+ for my $dir (@ARGV) {
+ push @directories, $dir;
+ }
+}
+
+my $notLocalizedCount = 0;
+my $NSLocalizeCount = 0;
+
+my %exception;
+my %usedException;
+
+if (defined $exceptionsFile && open EXCEPTIONS, $exceptionsFile) {
+ while (<EXCEPTIONS>) {
+ chomp;
+ if (/^"([^\\"]|\\.)*"$/ or /^[-_\/\w\s.]+.(h|m|mm|c|cpp)$/ or /^[-_\/\w\s.]+.(h|m|mm|c|cpp):"([^\\"]|\\.)*"$/) {
+ if ($exception{$_}) {
+ emitWarning($exceptionsFile, $., "exception for $_ appears twice");
+ emitWarning($exceptionsFile, $exception{$_}, "first appearance");
+ } else {
+ $exception{$_} = $.;
+ }
+ } else {
+ emitWarning($exceptionsFile, $., "syntax error");
+ }
+ }
+ close EXCEPTIONS;
+}
+
+my $quotedDirectoriesString = '"' . join('" "', @directories) . '"';
+for my $dir (@directoriesToSkip) {
+ $quotedDirectoriesString .= ' -path "' . $dir . '" -prune -o';
+}
+
+my @files = ( split "\n", `find $quotedDirectoriesString \\( -name "*.h" -o -name "*.m" -o -name "*.mm" -o -name "*.c" -o -name "*.cpp" \\)` );
+
+for my $file (sort @files) {
+ next if $file =~ /\/\w+LocalizableStrings\w*\.h$/ || $file =~ /\/LocalizedStrings\.h$/;
+
+ $file =~ s-^./--;
+
+ open SOURCE, $file or die "can't open $file\n";
+
+ my $inComment = 0;
+
+ my $expected = "";
+ my $macroLine;
+ my $macro;
+ my $UIString;
+ my $key;
+ my $comment;
+ my $mnemonic;
+
+ my $string;
+ my $stringLine;
+ my $nestingLevel;
+
+ my $previousToken = "";
+
+ while (<SOURCE>) {
+ chomp;
+
+ # Handle continued multi-line comment.
+ if ($inComment) {
+ next unless s-.*\*/--;
+ $inComment = 0;
+ }
+
+ next unless defined $nestingLevel or /(\"|\/\*)/;
+
+ # Handle all the tokens in the line.
+ while (s-^\s*([#\w]+|/\*|//|[^#\w/'"()\[\],]+|.)--) {
+ my $token = $1;
+
+ if ($token eq "@" and $expected and $expected eq "a quoted string") {
+ next;
+ }
+
+ if ($token eq "\"") {
+ if ($expected and $expected ne "a quoted string") {
+ emitError($file, $., "found a quoted string but expected $expected");
+ $expected = "";
+ }
+ if (s-^(([^\\$token]|\\.)*?)$token--) {
+ if (!defined $string) {
+ $stringLine = $.;
+ $string = $1;
+ } else {
+ $string .= $1;
+ }
+ } else {
+ emitError($file, $., "mismatched quotes");
+ $_ = "";
+ }
+ next;
+ }
+
+ if (defined $string) {
+handleString:
+ if ($expected) {
+ if (!defined $UIString) {
+ # FIXME: Validate UTF-8 here?
+ $UIString = $string;
+ $expected = ",";
+ } elsif (($macro =~ /(WEB_)?UI_STRING_KEY(_INTERNAL)?$/) and !defined $key) {
+ # FIXME: Validate UTF-8 here?
+ $key = $string;
+ $expected = ",";
+ } elsif (($macro =~ /WEB_UI_STRING_WITH_MNEMONIC$/) and !defined $mnemonic) {
+ $mnemonic = $string;
+ $expected = ",";
+ } elsif (!defined $comment) {
+ # FIXME: Validate UTF-8 here?
+ $comment = $string;
+ $expected = ")";
+ }
+ } else {
+ if (defined $nestingLevel) {
+ # In a debug macro, no need to localize.
+ } elsif ($previousToken eq "#include" or $previousToken eq "#import") {
+ # File name, no need to localize.
+ } elsif ($previousToken eq "extern" and $string eq "C") {
+ # extern "C", no need to localize.
+ } elsif ($string eq "") {
+ # Empty string can sometimes be localized, but we need not complain if not.
+ } elsif ($exception{$file}) {
+ $usedException{$file} = 1;
+ } elsif ($exception{"\"$string\""}) {
+ $usedException{"\"$string\""} = 1;
+ } elsif ($exception{"$file:\"$string\""}) {
+ $usedException{"$file:\"$string\""} = 1;
+ } else {
+ emitWarning($file, $stringLine, "\"$string\" is not marked for localization") if $warnAboutUnlocalizedStrings;
+ $notLocalizedCount++;
+ }
+ }
+ $string = undef;
+ last if !defined $token;
+ }
+
+ $previousToken = $token;
+
+ if ($token =~ /^NSLocalized/ && $token !~ /NSLocalizedDescriptionKey/ && $token !~ /NSLocalizedStringFromTableInBundle/ && $token !~ /NSLocalizedFileSizeDescription/ && $token !~ /NSLocalizedDescriptionKey/ && $token !~ /NSLocalizedRecoverySuggestionErrorKey/) {
+ emitError($file, $., "found a use of an NSLocalized macro ($token); not supported");
+ $nestingLevel = 0 if !defined $nestingLevel;
+ $NSLocalizeCount++;
+ } elsif ($token eq "/*") {
+ if (!s-^.*?\*/--) {
+ $_ = ""; # If the comment doesn't end, discard the result of the line and set flag
+ $inComment = 1;
+ }
+ } elsif ($token eq "//") {
+ $_ = ""; # Discard the rest of the line
+ } elsif ($token eq "'") {
+ if (!s-([^\\]|\\.)'--) { #' <-- that single quote makes the Project Builder editor less confused
+ emitError($file, $., "mismatched single quote");
+ $_ = "";
+ }
+ } else {
+ if ($expected and $expected ne $token) {
+ emitError($file, $., "found $token but expected $expected");
+ $expected = "";
+ }
+ if (($token =~ /(WEB_)?UI_STRING(_KEY)?(_INTERNAL)?$/) || ($token =~ /WEB_UI_NSSTRING$/) || ($token =~ /WEB_UI_STRING_WITH_MNEMONIC$/) || ($token =~ /WEB_UI_CFSTRING$/)) {
+ $expected = "(";
+ $macro = $token;
+ $UIString = undef;
+ $key = undef;
+ $comment = undef;
+ $mnemonic = undef;
+ $macroLine = $.;
+ } elsif ($token eq "(" or $token eq "[") {
+ ++$nestingLevel if defined $nestingLevel;
+ $expected = "a quoted string" if $expected;
+ } elsif ($token eq ",") {
+ $expected = "a quoted string" if $expected;
+ } elsif ($token eq ")" or $token eq "]") {
+ $nestingLevel = undef if defined $nestingLevel && !--$nestingLevel;
+ if ($expected) {
+ $key = $UIString if !defined $key;
+ HandleUIString($UIString, $key, $comment, $file, $macroLine);
+ $macro = "";
+ $expected = "";
+ }
+ } elsif ($isDebugMacro{$token}) {
+ $nestingLevel = 0 if !defined $nestingLevel;
+ }
+ }
+ }
+
+ }
+
+ goto handleString if defined $string;
+
+ if ($expected) {
+ emitError($file, 0, "reached end of file but expected $expected");
+ }
+
+ close SOURCE;
+}
+
+print "\n" if sawError() || $notLocalizedCount || $NSLocalizeCount;
+
+my @unusedExceptions = sort grep { !$usedException{$_} } keys %exception;
+if (@unusedExceptions) {
+ for my $unused (@unusedExceptions) {
+ emitWarning($exceptionsFile, $exception{$unused}, "exception $unused not used");
+ }
+ print "\n";
+}
+
+print localizedCount() . " localizable strings\n" if localizedCount();
+print keyCollisionCount() . " key collisions\n" if keyCollisionCount();
+print "$notLocalizedCount strings not marked for localization\n" if $notLocalizedCount;
+print "$NSLocalizeCount uses of NSLocalize\n" if $NSLocalizeCount;
+print scalar(@unusedExceptions), " unused exceptions\n" if @unusedExceptions;
+
+if (sawError()) {
+ print "\nErrors encountered. Exiting without writing to $fileToUpdate.\n";
+ exit 1;
+}
+
+if (-e "$fileToUpdate") {
+ if (!$verify) {
+ my $temporaryFile = "$fileToUpdate.updated";
+ writeStringsFile($temporaryFile);
+
+ # Avoid updating the target file's modification time if the contents have not changed.
+ if (compare($temporaryFile, $fileToUpdate)) {
+ move($temporaryFile, $fileToUpdate);
+ } else {
+ unlink $temporaryFile;
+ }
+ } else {
+ verifyStringsFile($fileToUpdate);
+ }
+} else {
+ print "error: $fileToUpdate does not exist\n";
+ exit 1;
+}
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (235189 => 235190)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-08-22 19:33:46 UTC (rev 235190)
@@ -6041,7 +6041,7 @@
1A85B2AD0A1B2A6D00D8C87C /* HTMLDivElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLDivElement.idl; sourceTree = "<group>"; };
1A85B2B40A1B2AC700D8C87C /* JSHTMLDivElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDivElement.cpp; sourceTree = "<group>"; };
1A85B2B50A1B2AC700D8C87C /* JSHTMLDivElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLDivElement.h; sourceTree = "<group>"; };
- 1A874ADE19085E9100B03171 /* WAKViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WAKViewInternal.h; path = ../../WAKViewInternal.h; sourceTree = "<group>"; };
+ 1A874ADE19085E9100B03171 /* WAKViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WAKViewInternal.h; sourceTree = "<group>"; };
1A88A90217553CD7000C74F9 /* FileIconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileIconLoader.cpp; sourceTree = "<group>"; };
1A88A90317553CD7000C74F9 /* FileIconLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileIconLoader.h; sourceTree = "<group>"; };
1A8A64371D19FC5300D0E00F /* Payment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Payment.h; sourceTree = "<group>"; };
@@ -6281,7 +6281,7 @@
1AFFC4501D5E7EC700267A66 /* PluginBlacklist.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginBlacklist.mm; sourceTree = "<group>"; };
1AFFC4511D5E7EC700267A66 /* WebGLBlacklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLBlacklist.h; sourceTree = "<group>"; };
1AFFC4521D5E7EC700267A66 /* WebGLBlacklist.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGLBlacklist.mm; sourceTree = "<group>"; };
- 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaSampleAVFObjC.h; path = ../MediaSampleAVFObjC.h; sourceTree = "<group>"; };
+ 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSampleAVFObjC.h; sourceTree = "<group>"; };
1B124D8E1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSampleAVFObjC.mm; sourceTree = "<group>"; };
1BE5BFC11D515715001666D9 /* MediaConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaConstraints.cpp; sourceTree = "<group>"; };
1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineTextBoxStyle.cpp; sourceTree = "<group>"; };
@@ -7078,7 +7078,7 @@
339B5B62131DAA3200F48D02 /* CookiesStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CookiesStrategy.h; sourceTree = "<group>"; };
3662F984047CEDBE5DDDAFAA /* RenderMathMLMenclose.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLMenclose.cpp; sourceTree = "<group>"; };
37119A7920CCB610002C6DC9 /* WebKitTargetConditionals.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKitTargetConditionals.xcconfig; sourceTree = "<group>"; };
- 3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = "extract-localizable-strings.pl"; sourceTree = "<group>"; };
+ 3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = extract-localizable-strings.pl; path = "Scripts/extract-localizable-strings.pl"; sourceTree = "<group>"; };
371A67CA11C6C7DB00047B8B /* HyphenationCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HyphenationCF.cpp; sourceTree = "<group>"; };
371E65CB13661EDC00BEEDB0 /* PageSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageSerializer.h; sourceTree = "<group>"; };
371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageSerializer.cpp; sourceTree = "<group>"; };
@@ -7121,7 +7121,7 @@
37C738EE1EDBD718003F2B0B /* MathMLUnknownElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLUnknownElement.h; sourceTree = "<group>"; };
37C738F11EDBDE87003F2B0B /* DateTimeChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimeChooser.h; sourceTree = "<group>"; };
37C738F21EDBDE87003F2B0B /* DateTimeChooserClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimeChooserClient.h; sourceTree = "<group>"; };
- 37D456FB1A9A50B6003330A1 /* LocalizableStrings.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = LocalizableStrings.pm; sourceTree = "<group>"; };
+ 37D456FB1A9A50B6003330A1 /* LocalizableStrings.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = LocalizableStrings.pm; path = Scripts/LocalizableStrings.pm; sourceTree = "<group>"; };
37DDCD9D13844FFA0008B793 /* Archive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Archive.cpp; sourceTree = "<group>"; };
37E3524A12450C5200BAF5D9 /* InputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputType.cpp; sourceTree = "<group>"; };
37E3524C12450C6600BAF5D9 /* InputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputType.h; sourceTree = "<group>"; };
@@ -13361,8 +13361,8 @@
CDE5959C1BF2757100A1CBE8 /* CDMSessionMediaSourceAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CDMSessionMediaSourceAVFObjC.mm; sourceTree = "<group>"; };
CDE6560E17CA6E7600526BA7 /* mediaControlsApple.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = mediaControlsApple.js; sourceTree = "<group>"; };
CDE667A11E4BBA4D00E8154A /* PlatformAudioData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformAudioData.h; sourceTree = "<group>"; };
- CDE667A21E4BBF1500E8154A /* WebAudioBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebAudioBufferList.cpp; sourceTree = "<group>"; };
- CDE667A31E4BBF1500E8154A /* WebAudioBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAudioBufferList.h; sourceTree = "<group>"; };
+ CDE667A21E4BBF1500E8154A /* WebAudioBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocoa/WebAudioBufferList.cpp; sourceTree = "<group>"; };
+ CDE667A31E4BBF1500E8154A /* WebAudioBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa/WebAudioBufferList.h; sourceTree = "<group>"; };
CDE7FC42181904B1002BBB77 /* OrderIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OrderIterator.cpp; sourceTree = "<group>"; };
CDE7FC43181904B1002BBB77 /* OrderIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrderIterator.h; sourceTree = "<group>"; };
CDE83DAF183C44060031EAA3 /* VideoPlaybackQuality.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoPlaybackQuality.cpp; sourceTree = "<group>"; };
Deleted: trunk/Source/WebCore/extract-localizable-strings.pl (235189 => 235190)
--- trunk/Source/WebCore/extract-localizable-strings.pl 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Source/WebCore/extract-localizable-strings.pl 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,324 +0,0 @@
-#!/usr/bin/env perl
-
-# Copyright (C) 2006, 2007, 2009, 2010, 2013 Apple Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. ("Apple") nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# This script is like the genstrings tool (minus most of the options) with these differences.
-#
-# 1) It uses the names UI_STRING and UI_STRING_WITH_KEY for the macros, rather than the macros
-# from NSBundle.h, and doesn't support tables (although they would be easy to add).
-# 2) It supports UTF-8 in key strings (and hence uses "" strings rather than @"" strings;
-# @"" strings only reliably support ASCII since they are decoded based on the system encoding
-# at runtime, so give different results on US and Japanese systems for example).
-# 3) It looks for strings that are not marked for localization, using both macro names that are
-# known to be used for debugging in Intrigue source code and an exceptions file.
-# 4) It finds the files to work on rather than taking them as parameters, and also uses a
-# hardcoded location for both the output file and the exceptions file.
-# It would have been nice to use the project to find the source files, but it's too hard to
-# locate source files after parsing a .pbxproj file.
-
-# The exceptions file has a list of strings in quotes, filenames, and filename/string pairs separated by :.
-
-use strict;
-use warnings;
-use File::Compare;
-use File::Copy;
-use FindBin;
-use Getopt::Long;
-use lib $FindBin::Bin;
-use LocalizableStrings;
-no warnings 'deprecated';
-
-my %isDebugMacro = ( ASSERT_WITH_MESSAGE => 1, LOG_ERROR => 1, ERROR => 1, NSURL_ERROR => 1, FATAL => 1, LOG => 1, LOG_WARNING => 1, UI_STRING_LOCALIZE_LATER => 1, UI_STRING_LOCALIZE_LATER_KEY => 1, LPCTSTR_UI_STRING_LOCALIZE_LATER => 1, UNLOCALIZED_STRING => 1, UNLOCALIZED_LPCTSTR => 1, dprintf => 1, NSException => 1, NSLog => 1, printf => 1 );
-
-my $verify;
-my $exceptionsFile;
-my @directoriesToSkip = ();
-my $treatWarningsAsErrors;
-
-my %options = (
- 'verify' => \$verify,
- 'exceptions=s' => \$exceptionsFile,
- 'skip=s' => \@directoriesToSkip,
- 'treat-warnings-as-errors' => \$treatWarningsAsErrors,
-);
-
-GetOptions(%options);
-
-setTreatWarningsAsErrors($treatWarningsAsErrors);
-
-@ARGV >= 2 or die "Usage: extract-localizable-strings [--verify] [--treat-warnings-as-errors] [--exceptions <exceptions file>] <file to update> [--skip directory | directory]...\nDid you mean to run update-webkit-localizable-strings instead?\n";
-
--f $exceptionsFile or die "Couldn't find exceptions file $exceptionsFile\n" unless !defined $exceptionsFile;
-
-my $fileToUpdate = shift @ARGV;
--f $fileToUpdate or die "Couldn't find file to update $fileToUpdate\n";
-
-my $warnAboutUnlocalizedStrings = defined $exceptionsFile;
-
-my @directories = ();
-if (@ARGV < 1) {
- push(@directories, ".");
-} else {
- for my $dir (@ARGV) {
- push @directories, $dir;
- }
-}
-
-my $notLocalizedCount = 0;
-my $NSLocalizeCount = 0;
-
-my %exception;
-my %usedException;
-
-if (defined $exceptionsFile && open EXCEPTIONS, $exceptionsFile) {
- while (<EXCEPTIONS>) {
- chomp;
- if (/^"([^\\"]|\\.)*"$/ or /^[-_\/\w\s.]+.(h|m|mm|c|cpp)$/ or /^[-_\/\w\s.]+.(h|m|mm|c|cpp):"([^\\"]|\\.)*"$/) {
- if ($exception{$_}) {
- emitWarning($exceptionsFile, $., "exception for $_ appears twice");
- emitWarning($exceptionsFile, $exception{$_}, "first appearance");
- } else {
- $exception{$_} = $.;
- }
- } else {
- emitWarning($exceptionsFile, $., "syntax error");
- }
- }
- close EXCEPTIONS;
-}
-
-my $quotedDirectoriesString = '"' . join('" "', @directories) . '"';
-for my $dir (@directoriesToSkip) {
- $quotedDirectoriesString .= ' -path "' . $dir . '" -prune -o';
-}
-
-my @files = ( split "\n", `find $quotedDirectoriesString \\( -name "*.h" -o -name "*.m" -o -name "*.mm" -o -name "*.c" -o -name "*.cpp" \\)` );
-
-for my $file (sort @files) {
- next if $file =~ /\/\w+LocalizableStrings\w*\.h$/ || $file =~ /\/LocalizedStrings\.h$/;
-
- $file =~ s-^./--;
-
- open SOURCE, $file or die "can't open $file\n";
-
- my $inComment = 0;
-
- my $expected = "";
- my $macroLine;
- my $macro;
- my $UIString;
- my $key;
- my $comment;
- my $mnemonic;
-
- my $string;
- my $stringLine;
- my $nestingLevel;
-
- my $previousToken = "";
-
- while (<SOURCE>) {
- chomp;
-
- # Handle continued multi-line comment.
- if ($inComment) {
- next unless s-.*\*/--;
- $inComment = 0;
- }
-
- next unless defined $nestingLevel or /(\"|\/\*)/;
-
- # Handle all the tokens in the line.
- while (s-^\s*([#\w]+|/\*|//|[^#\w/'"()\[\],]+|.)--) {
- my $token = $1;
-
- if ($token eq "@" and $expected and $expected eq "a quoted string") {
- next;
- }
-
- if ($token eq "\"") {
- if ($expected and $expected ne "a quoted string") {
- emitError($file, $., "found a quoted string but expected $expected");
- $expected = "";
- }
- if (s-^(([^\\$token]|\\.)*?)$token--) {
- if (!defined $string) {
- $stringLine = $.;
- $string = $1;
- } else {
- $string .= $1;
- }
- } else {
- emitError($file, $., "mismatched quotes");
- $_ = "";
- }
- next;
- }
-
- if (defined $string) {
-handleString:
- if ($expected) {
- if (!defined $UIString) {
- # FIXME: Validate UTF-8 here?
- $UIString = $string;
- $expected = ",";
- } elsif (($macro =~ /(WEB_)?UI_STRING_KEY(_INTERNAL)?$/) and !defined $key) {
- # FIXME: Validate UTF-8 here?
- $key = $string;
- $expected = ",";
- } elsif (($macro =~ /WEB_UI_STRING_WITH_MNEMONIC$/) and !defined $mnemonic) {
- $mnemonic = $string;
- $expected = ",";
- } elsif (!defined $comment) {
- # FIXME: Validate UTF-8 here?
- $comment = $string;
- $expected = ")";
- }
- } else {
- if (defined $nestingLevel) {
- # In a debug macro, no need to localize.
- } elsif ($previousToken eq "#include" or $previousToken eq "#import") {
- # File name, no need to localize.
- } elsif ($previousToken eq "extern" and $string eq "C") {
- # extern "C", no need to localize.
- } elsif ($string eq "") {
- # Empty string can sometimes be localized, but we need not complain if not.
- } elsif ($exception{$file}) {
- $usedException{$file} = 1;
- } elsif ($exception{"\"$string\""}) {
- $usedException{"\"$string\""} = 1;
- } elsif ($exception{"$file:\"$string\""}) {
- $usedException{"$file:\"$string\""} = 1;
- } else {
- emitWarning($file, $stringLine, "\"$string\" is not marked for localization") if $warnAboutUnlocalizedStrings;
- $notLocalizedCount++;
- }
- }
- $string = undef;
- last if !defined $token;
- }
-
- $previousToken = $token;
-
- if ($token =~ /^NSLocalized/ && $token !~ /NSLocalizedDescriptionKey/ && $token !~ /NSLocalizedStringFromTableInBundle/ && $token !~ /NSLocalizedFileSizeDescription/ && $token !~ /NSLocalizedDescriptionKey/ && $token !~ /NSLocalizedRecoverySuggestionErrorKey/) {
- emitError($file, $., "found a use of an NSLocalized macro ($token); not supported");
- $nestingLevel = 0 if !defined $nestingLevel;
- $NSLocalizeCount++;
- } elsif ($token eq "/*") {
- if (!s-^.*?\*/--) {
- $_ = ""; # If the comment doesn't end, discard the result of the line and set flag
- $inComment = 1;
- }
- } elsif ($token eq "//") {
- $_ = ""; # Discard the rest of the line
- } elsif ($token eq "'") {
- if (!s-([^\\]|\\.)'--) { #' <-- that single quote makes the Project Builder editor less confused
- emitError($file, $., "mismatched single quote");
- $_ = "";
- }
- } else {
- if ($expected and $expected ne $token) {
- emitError($file, $., "found $token but expected $expected");
- $expected = "";
- }
- if (($token =~ /(WEB_)?UI_STRING(_KEY)?(_INTERNAL)?$/) || ($token =~ /WEB_UI_NSSTRING$/) || ($token =~ /WEB_UI_STRING_WITH_MNEMONIC$/) || ($token =~ /WEB_UI_CFSTRING$/)) {
- $expected = "(";
- $macro = $token;
- $UIString = undef;
- $key = undef;
- $comment = undef;
- $mnemonic = undef;
- $macroLine = $.;
- } elsif ($token eq "(" or $token eq "[") {
- ++$nestingLevel if defined $nestingLevel;
- $expected = "a quoted string" if $expected;
- } elsif ($token eq ",") {
- $expected = "a quoted string" if $expected;
- } elsif ($token eq ")" or $token eq "]") {
- $nestingLevel = undef if defined $nestingLevel && !--$nestingLevel;
- if ($expected) {
- $key = $UIString if !defined $key;
- HandleUIString($UIString, $key, $comment, $file, $macroLine);
- $macro = "";
- $expected = "";
- }
- } elsif ($isDebugMacro{$token}) {
- $nestingLevel = 0 if !defined $nestingLevel;
- }
- }
- }
-
- }
-
- goto handleString if defined $string;
-
- if ($expected) {
- emitError($file, 0, "reached end of file but expected $expected");
- }
-
- close SOURCE;
-}
-
-print "\n" if sawError() || $notLocalizedCount || $NSLocalizeCount;
-
-my @unusedExceptions = sort grep { !$usedException{$_} } keys %exception;
-if (@unusedExceptions) {
- for my $unused (@unusedExceptions) {
- emitWarning($exceptionsFile, $exception{$unused}, "exception $unused not used");
- }
- print "\n";
-}
-
-print localizedCount() . " localizable strings\n" if localizedCount();
-print keyCollisionCount() . " key collisions\n" if keyCollisionCount();
-print "$notLocalizedCount strings not marked for localization\n" if $notLocalizedCount;
-print "$NSLocalizeCount uses of NSLocalize\n" if $NSLocalizeCount;
-print scalar(@unusedExceptions), " unused exceptions\n" if @unusedExceptions;
-
-if (sawError()) {
- print "\nErrors encountered. Exiting without writing to $fileToUpdate.\n";
- exit 1;
-}
-
-if (-e "$fileToUpdate") {
- if (!$verify) {
- my $temporaryFile = "$fileToUpdate.updated";
- writeStringsFile($temporaryFile);
-
- # Avoid updating the target file's modification time if the contents have not changed.
- if (compare($temporaryFile, $fileToUpdate)) {
- move($temporaryFile, $fileToUpdate);
- } else {
- unlink $temporaryFile;
- }
- } else {
- verifyStringsFile($fileToUpdate);
- }
-} else {
- print "error: $fileToUpdate does not exist\n";
- exit 1;
-}
Deleted: trunk/Source/WebCore/platform/WAKViewInternal.h (235189 => 235190)
--- trunk/Source/WebCore/platform/WAKViewInternal.h 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Source/WebCore/platform/WAKViewInternal.h 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if TARGET_OS_IPHONE
-
-#import "WAKView.h"
-#import "WKView.h"
-
-@interface WAKView () {
-@package
- WKViewContext viewContext;
- WKViewRef viewRef;
-
- NSMutableSet *subviewReferences; // This array is only used to keep WAKViews alive.
- // The actual subviews are maintained by the WKView.
-
- BOOL _isHidden;
- BOOL _drawsOwnDescendants;
-}
-
-- (WKViewRef)_viewRef;
-+ (WAKView *)_wrapperForViewRef:(WKViewRef)_viewRef;
-- (id)_initWithViewRef:(WKViewRef)view;
-- (BOOL)_handleResponderCall:(WKViewResponderCallbackType)type;
-- (NSMutableSet *)_subviewReferences;
-- (BOOL)_selfHandleEvent:(WebEvent *)event;
-
-@end
-
-static inline WAKView *WAKViewForWKViewRef(WKViewRef view)
-{
- if (!view)
- return nil;
- WAKView *wrapper = (WAKView *)view->wrapper;
- if (wrapper)
- return wrapper;
- return [WAKView _wrapperForViewRef:view];
-}
-
-#endif
Deleted: trunk/Source/WebCore/platform/audio/WebAudioBufferList.cpp (235189 => 235190)
--- trunk/Source/WebCore/platform/audio/WebAudioBufferList.cpp 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Source/WebCore/platform/audio/WebAudioBufferList.cpp 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebAudioBufferList.h"
-
-#include "CAAudioStreamDescription.h"
-#include <pal/cf/CoreMediaSoftLink.h>
-
-namespace WebCore {
-using namespace PAL;
-
-WebAudioBufferList::WebAudioBufferList(const CAAudioStreamDescription& format)
-{
- // AudioBufferList is a variable-length struct, so create on the heap with a generic new() operator
- // with a custom size, and initialize the struct manually.
- uint32_t bufferCount = format.numberOfChannelStreams();
- uint32_t channelCount = format.numberOfInterleavedChannels();
-
- uint64_t bufferListSize = offsetof(AudioBufferList, mBuffers) + (sizeof(AudioBuffer) * std::max(1U, bufferCount));
- ASSERT(bufferListSize <= SIZE_MAX);
-
- m_listBufferSize = static_cast<size_t>(bufferListSize);
- m_canonicalList = std::unique_ptr<AudioBufferList>(static_cast<AudioBufferList*>(::operator new (m_listBufferSize)));
- memset(m_canonicalList.get(), 0, m_listBufferSize);
- m_canonicalList->mNumberBuffers = bufferCount;
- for (uint32_t buffer = 0; buffer < bufferCount; ++buffer)
- m_canonicalList->mBuffers[buffer].mNumberChannels = channelCount;
-
- reset();
-}
-
-WebAudioBufferList::WebAudioBufferList(const CAAudioStreamDescription& format, uint32_t sampleCount)
- : WebAudioBufferList(format)
-{
- if (!sampleCount)
- return;
-
- uint32_t bufferCount = format.numberOfChannelStreams();
- uint32_t channelCount = format.numberOfInterleavedChannels();
-
- size_t bytesPerBuffer = sampleCount * channelCount * format.bytesPerFrame();
- m_flatBuffer.reserveInitialCapacity(bufferCount * bytesPerBuffer);
- auto data = ""
-
- for (uint32_t buffer = 0; buffer < m_canonicalList->mNumberBuffers; ++buffer) {
- m_canonicalList->mBuffers[buffer].mData = data;
- m_canonicalList->mBuffers[buffer].mDataByteSize = bytesPerBuffer;
- data += bytesPerBuffer;
- }
-
- reset();
-}
-
-WebAudioBufferList::WebAudioBufferList(const CAAudioStreamDescription& format, CMSampleBufferRef sampleBuffer)
- : WebAudioBufferList(format)
-{
-
- if (!sampleBuffer)
- return;
-
- CMBlockBufferRef buffer = nullptr;
- if (noErr == CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, nullptr, m_canonicalList.get(), m_listBufferSize, kCFAllocatorSystemDefault, kCFAllocatorSystemDefault, kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment, &buffer))
- m_blockBuffer = adoptCF(buffer);
-
- reset();
-}
-
-void WebAudioBufferList::reset()
-{
- if (!m_list)
- m_list = std::unique_ptr<AudioBufferList>(static_cast<AudioBufferList*>(::operator new (m_listBufferSize)));
- memcpy(m_list.get(), m_canonicalList.get(), m_listBufferSize);
-}
-
-WTF::IteratorRange<AudioBuffer*> WebAudioBufferList::buffers() const
-{
- return WTF::makeIteratorRange(&m_list->mBuffers[0], &m_list->mBuffers[m_list->mNumberBuffers]);
-}
-
-uint32_t WebAudioBufferList::bufferCount() const
-{
- return m_list->mNumberBuffers;
-}
-
-AudioBuffer* WebAudioBufferList::buffer(uint32_t index) const
-{
- ASSERT(index < m_list->mNumberBuffers);
- if (index < m_list->mNumberBuffers)
- return &m_list->mBuffers[index];
- return nullptr;
-}
-
-}
Deleted: trunk/Source/WebCore/platform/audio/WebAudioBufferList.h (235189 => 235190)
--- trunk/Source/WebCore/platform/audio/WebAudioBufferList.h 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Source/WebCore/platform/audio/WebAudioBufferList.h 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "PlatformAudioData.h"
-#include <wtf/IteratorRange.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
-
-struct AudioBuffer;
-struct AudioBufferList;
-typedef struct OpaqueCMBlockBuffer *CMBlockBufferRef;
-typedef struct opaqueCMSampleBuffer *CMSampleBufferRef;
-
-namespace WebCore {
-
-class CAAudioStreamDescription;
-
-class WebAudioBufferList : public PlatformAudioData {
-public:
- WebAudioBufferList(const CAAudioStreamDescription&);
- WEBCORE_EXPORT WebAudioBufferList(const CAAudioStreamDescription&, uint32_t sampleCount);
- WebAudioBufferList(const CAAudioStreamDescription&, CMSampleBufferRef);
-
- void reset();
-
- AudioBufferList* list() const { return m_list.get(); }
- operator AudioBufferList&() const { return *m_list; }
-
- uint32_t bufferCount() const;
- AudioBuffer* buffer(uint32_t index) const;
- WTF::IteratorRange<AudioBuffer*> buffers() const;
-
-private:
- Kind kind() const { return Kind::WebAudioBufferList; }
-
- size_t m_listBufferSize { 0 };
- std::unique_ptr<AudioBufferList> m_canonicalList;
- std::unique_ptr<AudioBufferList> m_list;
- RetainPtr<CMBlockBufferRef> m_blockBuffer;
- Vector<uint8_t> m_flatBuffer;
-};
-
-}
-
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WebAudioBufferList)
-static bool isType(const WebCore::PlatformAudioData& data) { return data.kind() == WebCore::PlatformAudioData::Kind::WebAudioBufferList; }
-SPECIALIZE_TYPE_TRAITS_END()
Copied: trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.cpp (from rev 235189, trunk/Source/WebCore/platform/audio/WebAudioBufferList.cpp) (0 => 235190)
--- trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.cpp (rev 0)
+++ trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.cpp 2018-08-22 19:33:46 UTC (rev 235190)
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebAudioBufferList.h"
+
+#include "CAAudioStreamDescription.h"
+#include <pal/cf/CoreMediaSoftLink.h>
+
+namespace WebCore {
+using namespace PAL;
+
+WebAudioBufferList::WebAudioBufferList(const CAAudioStreamDescription& format)
+{
+ // AudioBufferList is a variable-length struct, so create on the heap with a generic new() operator
+ // with a custom size, and initialize the struct manually.
+ uint32_t bufferCount = format.numberOfChannelStreams();
+ uint32_t channelCount = format.numberOfInterleavedChannels();
+
+ uint64_t bufferListSize = offsetof(AudioBufferList, mBuffers) + (sizeof(AudioBuffer) * std::max(1U, bufferCount));
+ ASSERT(bufferListSize <= SIZE_MAX);
+
+ m_listBufferSize = static_cast<size_t>(bufferListSize);
+ m_canonicalList = std::unique_ptr<AudioBufferList>(static_cast<AudioBufferList*>(::operator new (m_listBufferSize)));
+ memset(m_canonicalList.get(), 0, m_listBufferSize);
+ m_canonicalList->mNumberBuffers = bufferCount;
+ for (uint32_t buffer = 0; buffer < bufferCount; ++buffer)
+ m_canonicalList->mBuffers[buffer].mNumberChannels = channelCount;
+
+ reset();
+}
+
+WebAudioBufferList::WebAudioBufferList(const CAAudioStreamDescription& format, uint32_t sampleCount)
+ : WebAudioBufferList(format)
+{
+ if (!sampleCount)
+ return;
+
+ uint32_t bufferCount = format.numberOfChannelStreams();
+ uint32_t channelCount = format.numberOfInterleavedChannels();
+
+ size_t bytesPerBuffer = sampleCount * channelCount * format.bytesPerFrame();
+ m_flatBuffer.reserveInitialCapacity(bufferCount * bytesPerBuffer);
+ auto data = ""
+
+ for (uint32_t buffer = 0; buffer < m_canonicalList->mNumberBuffers; ++buffer) {
+ m_canonicalList->mBuffers[buffer].mData = data;
+ m_canonicalList->mBuffers[buffer].mDataByteSize = bytesPerBuffer;
+ data += bytesPerBuffer;
+ }
+
+ reset();
+}
+
+WebAudioBufferList::WebAudioBufferList(const CAAudioStreamDescription& format, CMSampleBufferRef sampleBuffer)
+ : WebAudioBufferList(format)
+{
+
+ if (!sampleBuffer)
+ return;
+
+ CMBlockBufferRef buffer = nullptr;
+ if (noErr == CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, nullptr, m_canonicalList.get(), m_listBufferSize, kCFAllocatorSystemDefault, kCFAllocatorSystemDefault, kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment, &buffer))
+ m_blockBuffer = adoptCF(buffer);
+
+ reset();
+}
+
+void WebAudioBufferList::reset()
+{
+ if (!m_list)
+ m_list = std::unique_ptr<AudioBufferList>(static_cast<AudioBufferList*>(::operator new (m_listBufferSize)));
+ memcpy(m_list.get(), m_canonicalList.get(), m_listBufferSize);
+}
+
+WTF::IteratorRange<AudioBuffer*> WebAudioBufferList::buffers() const
+{
+ return WTF::makeIteratorRange(&m_list->mBuffers[0], &m_list->mBuffers[m_list->mNumberBuffers]);
+}
+
+uint32_t WebAudioBufferList::bufferCount() const
+{
+ return m_list->mNumberBuffers;
+}
+
+AudioBuffer* WebAudioBufferList::buffer(uint32_t index) const
+{
+ ASSERT(index < m_list->mNumberBuffers);
+ if (index < m_list->mNumberBuffers)
+ return &m_list->mBuffers[index];
+ return nullptr;
+}
+
+}
Copied: trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.h (from rev 235189, trunk/Source/WebCore/platform/audio/WebAudioBufferList.h) (0 => 235190)
--- trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.h (rev 0)
+++ trunk/Source/WebCore/platform/audio/cocoa/WebAudioBufferList.h 2018-08-22 19:33:46 UTC (rev 235190)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "PlatformAudioData.h"
+#include <wtf/IteratorRange.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+
+struct AudioBuffer;
+struct AudioBufferList;
+typedef struct OpaqueCMBlockBuffer *CMBlockBufferRef;
+typedef struct opaqueCMSampleBuffer *CMSampleBufferRef;
+
+namespace WebCore {
+
+class CAAudioStreamDescription;
+
+class WebAudioBufferList : public PlatformAudioData {
+public:
+ WebAudioBufferList(const CAAudioStreamDescription&);
+ WEBCORE_EXPORT WebAudioBufferList(const CAAudioStreamDescription&, uint32_t sampleCount);
+ WebAudioBufferList(const CAAudioStreamDescription&, CMSampleBufferRef);
+
+ void reset();
+
+ AudioBufferList* list() const { return m_list.get(); }
+ operator AudioBufferList&() const { return *m_list; }
+
+ uint32_t bufferCount() const;
+ AudioBuffer* buffer(uint32_t index) const;
+ WTF::IteratorRange<AudioBuffer*> buffers() const;
+
+private:
+ Kind kind() const { return Kind::WebAudioBufferList; }
+
+ size_t m_listBufferSize { 0 };
+ std::unique_ptr<AudioBufferList> m_canonicalList;
+ std::unique_ptr<AudioBufferList> m_list;
+ RetainPtr<CMBlockBufferRef> m_blockBuffer;
+ Vector<uint8_t> m_flatBuffer;
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WebAudioBufferList)
+static bool isType(const WebCore::PlatformAudioData& data) { return data.kind() == WebCore::PlatformAudioData::Kind::WebAudioBufferList; }
+SPECIALIZE_TYPE_TRAITS_END()
Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/MediaSampleAVFObjC.h (235189 => 235190)
--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaSampleAVFObjC.h 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaSampleAVFObjC.h 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "MediaSample.h"
-#include <_javascript_Core/Uint8ClampedArray.h>
-#include <pal/avfoundation/MediaTimeAVFoundation.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class MediaSampleAVFObjC : public MediaSample {
-public:
- static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, int trackID) { return adoptRef(*new MediaSampleAVFObjC(sample, trackID)); }
- static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, AtomicString trackID) { return adoptRef(*new MediaSampleAVFObjC(sample, trackID)); }
- static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, VideoRotation rotation = VideoRotation::None, bool mirrored = false) { return adoptRef(*new MediaSampleAVFObjC(sample, rotation, mirrored)); }
- static RefPtr<MediaSampleAVFObjC> createImageSample(Ref<JSC::Uint8ClampedArray>&&, unsigned long width, unsigned long height);
- static RefPtr<MediaSampleAVFObjC> createImageSample(Vector<uint8_t>&&, unsigned long width, unsigned long height);
-
- RefPtr<JSC::Uint8ClampedArray> getRGBAImageData() const override;
-
- MediaTime presentationTime() const override;
- MediaTime outputPresentationTime() const override;
- MediaTime decodeTime() const override;
- MediaTime duration() const override;
- MediaTime outputDuration() const override;
-
- AtomicString trackID() const override { return m_id; }
- void setTrackID(const String& id) override { m_id = id; }
-
- size_t sizeInBytes() const override;
- FloatSize presentationSize() const override;
-
- SampleFlags flags() const override;
- PlatformSample platformSample() override;
- void dump(PrintStream&) const override;
- void offsetTimestampsBy(const MediaTime&) override;
- void setTimestamps(const MediaTime&, const MediaTime&) override;
- bool isDivisable() const override;
- std::pair<RefPtr<MediaSample>, RefPtr<MediaSample>> divide(const MediaTime& presentationTime) override;
- Ref<MediaSample> createNonDisplayingCopy() const override;
-
- VideoRotation videoRotation() const override { return m_rotation; }
- bool videoMirrored() const override { return m_mirrored; }
-
- CMSampleBufferRef sampleBuffer() const { return m_sample.get(); }
-
-protected:
- MediaSampleAVFObjC(RetainPtr<CMSampleBufferRef>&& sample)
- : m_sample(WTFMove(sample))
- {
- }
- MediaSampleAVFObjC(CMSampleBufferRef sample)
- : m_sample(sample)
- {
- }
- MediaSampleAVFObjC(CMSampleBufferRef sample, AtomicString trackID)
- : m_sample(sample)
- , m_id(trackID)
- {
- }
- MediaSampleAVFObjC(CMSampleBufferRef sample, int trackID)
- : m_sample(sample)
- , m_id(String::format("%d", trackID))
- {
- }
- MediaSampleAVFObjC(CMSampleBufferRef sample, VideoRotation rotation, bool mirrored)
- : m_sample(sample)
- , m_rotation(rotation)
- , m_mirrored(mirrored)
- {
- }
-
- virtual ~MediaSampleAVFObjC() = default;
- RetainPtr<CMSampleBufferRef> m_sample;
- AtomicString m_id;
- VideoRotation m_rotation { VideoRotation::None };
- bool m_mirrored { false };
-};
-
-}
Copied: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h (from rev 235189, trunk/Source/WebCore/platform/graphics/avfoundation/MediaSampleAVFObjC.h) (0 => 235190)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h 2018-08-22 19:33:46 UTC (rev 235190)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "MediaSample.h"
+#include <_javascript_Core/Uint8ClampedArray.h>
+#include <pal/avfoundation/MediaTimeAVFoundation.h>
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class MediaSampleAVFObjC : public MediaSample {
+public:
+ static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, int trackID) { return adoptRef(*new MediaSampleAVFObjC(sample, trackID)); }
+ static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, AtomicString trackID) { return adoptRef(*new MediaSampleAVFObjC(sample, trackID)); }
+ static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, VideoRotation rotation = VideoRotation::None, bool mirrored = false) { return adoptRef(*new MediaSampleAVFObjC(sample, rotation, mirrored)); }
+ static RefPtr<MediaSampleAVFObjC> createImageSample(Ref<JSC::Uint8ClampedArray>&&, unsigned long width, unsigned long height);
+ static RefPtr<MediaSampleAVFObjC> createImageSample(Vector<uint8_t>&&, unsigned long width, unsigned long height);
+
+ RefPtr<JSC::Uint8ClampedArray> getRGBAImageData() const override;
+
+ MediaTime presentationTime() const override;
+ MediaTime outputPresentationTime() const override;
+ MediaTime decodeTime() const override;
+ MediaTime duration() const override;
+ MediaTime outputDuration() const override;
+
+ AtomicString trackID() const override { return m_id; }
+ void setTrackID(const String& id) override { m_id = id; }
+
+ size_t sizeInBytes() const override;
+ FloatSize presentationSize() const override;
+
+ SampleFlags flags() const override;
+ PlatformSample platformSample() override;
+ void dump(PrintStream&) const override;
+ void offsetTimestampsBy(const MediaTime&) override;
+ void setTimestamps(const MediaTime&, const MediaTime&) override;
+ bool isDivisable() const override;
+ std::pair<RefPtr<MediaSample>, RefPtr<MediaSample>> divide(const MediaTime& presentationTime) override;
+ Ref<MediaSample> createNonDisplayingCopy() const override;
+
+ VideoRotation videoRotation() const override { return m_rotation; }
+ bool videoMirrored() const override { return m_mirrored; }
+
+ CMSampleBufferRef sampleBuffer() const { return m_sample.get(); }
+
+protected:
+ MediaSampleAVFObjC(RetainPtr<CMSampleBufferRef>&& sample)
+ : m_sample(WTFMove(sample))
+ {
+ }
+ MediaSampleAVFObjC(CMSampleBufferRef sample)
+ : m_sample(sample)
+ {
+ }
+ MediaSampleAVFObjC(CMSampleBufferRef sample, AtomicString trackID)
+ : m_sample(sample)
+ , m_id(trackID)
+ {
+ }
+ MediaSampleAVFObjC(CMSampleBufferRef sample, int trackID)
+ : m_sample(sample)
+ , m_id(String::format("%d", trackID))
+ {
+ }
+ MediaSampleAVFObjC(CMSampleBufferRef sample, VideoRotation rotation, bool mirrored)
+ : m_sample(sample)
+ , m_rotation(rotation)
+ , m_mirrored(mirrored)
+ {
+ }
+
+ virtual ~MediaSampleAVFObjC() = default;
+ RetainPtr<CMSampleBufferRef> m_sample;
+ AtomicString m_id;
+ VideoRotation m_rotation { VideoRotation::None };
+ bool m_mirrored { false };
+};
+
+}
Copied: trunk/Source/WebCore/platform/ios/wak/WAKViewInternal.h (from rev 235189, trunk/Source/WebCore/platform/WAKViewInternal.h) (0 => 235190)
--- trunk/Source/WebCore/platform/ios/wak/WAKViewInternal.h (rev 0)
+++ trunk/Source/WebCore/platform/ios/wak/WAKViewInternal.h 2018-08-22 19:33:46 UTC (rev 235190)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if TARGET_OS_IPHONE
+
+#import "WAKView.h"
+#import "WKView.h"
+
+@interface WAKView ()
+{
+@package
+ WKViewContext viewContext;
+ WKViewRef viewRef;
+
+ // This array is only used to keep WAKViews alive.
+ // The actual subviews are maintained by the WKView.
+ NSMutableSet *subviewReferences;
+
+ BOOL _isHidden;
+ BOOL _drawsOwnDescendants;
+}
+
+- (WKViewRef)_viewRef;
++ (WAKView *)_wrapperForViewRef:(WKViewRef)_viewRef;
+- (id)_initWithViewRef:(WKViewRef)view;
+- (BOOL)_handleResponderCall:(WKViewResponderCallbackType)type;
+- (NSMutableSet *)_subviewReferences;
+- (BOOL)_selfHandleEvent:(WebEvent *)event;
+
+@end
+
+static inline WAKView *WAKViewForWKViewRef(WKViewRef view)
+{
+ if (!view)
+ return nil;
+ WAKView *wrapper = (WAKView *)view->wrapper;
+ if (wrapper)
+ return wrapper;
+ return [WAKView _wrapperForViewRef:view];
+}
+
+#endif
Modified: trunk/Tools/ChangeLog (235189 => 235190)
--- trunk/Tools/ChangeLog 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Tools/ChangeLog 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,3 +1,14 @@
+2018-08-22 David Kilzer <[email protected]>
+
+ Move files in WebCore project to match Xcode folder structure
+ <https://webkit.org/b/188851>
+
+ Reviewed by Tim Horton.
+
+ * Scripts/extract-localizable-strings:
+ * Scripts/update-webkit-localizable-strings:
+ - Update to match new location of extract-localizable-strings.pl.
+
2018-08-21 Alex Christensen <[email protected]>
Roll out r235139 and r235146
Modified: trunk/Tools/Scripts/extract-localizable-strings (235189 => 235190)
--- trunk/Tools/Scripts/extract-localizable-strings 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Tools/Scripts/extract-localizable-strings 2018-08-22 19:33:46 UTC (rev 235190)
@@ -1,3 +1,3 @@
#!/bin/sh
-exec "$(dirname $0)/../../Source/WebCore/extract-localizable-strings.pl" "$@"
+exec "$(dirname $0)/../../Source/WebCore/Scripts/extract-localizable-strings.pl" "$@"
Modified: trunk/Tools/Scripts/update-webkit-localizable-strings (235189 => 235190)
--- trunk/Tools/Scripts/update-webkit-localizable-strings 2018-08-22 18:53:27 UTC (rev 235189)
+++ trunk/Tools/Scripts/update-webkit-localizable-strings 2018-08-22 19:33:46 UTC (rev 235190)
@@ -45,5 +45,5 @@
chdirWebKit();
-system "Source/WebCore/extract-localizable-strings.pl", $webCoreFileToUpdate, @webKitDirectoriesToScan;
+system "Source/WebCore/Scripts/extract-localizable-strings.pl", $webCoreFileToUpdate, @webKitDirectoriesToScan;
system "Tools/Scripts/extract-localizable-js-strings", "--utf8", $webInspectorUIFileToUpdate, @webInspectorUIDirectoriesToScan;